Example usage for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID.

Prototype

int CANCEL_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants CANCEL_ID.

Click Source Link

Document

Button id for a "Cancel" button (value 1).

Usage

From source file:edu.tsinghua.lumaqq.ui.helper.ExportHelper.java

License:Open Source License

/**
 * //from   ww  w. ja  va  2  s  .  co m
 * 
 * @param mobile
 * @param entries
 */
public void exportMessage(String mobile, List<RecordEntry> entries) {
    // ?
    RecordExportTypeDialog dialog = new RecordExportTypeDialog(main.getShell(), factory);
    if (dialog.open() == IDialogConstants.CANCEL_ID)
        return;
    String fileTypeName = dialog.getFileTypeName();

    // ??
    FileDialog fd = new FileDialog(main.getShell(), SWT.SAVE);
    fd.setFilterExtensions(new String[] { '*' + factory.getFilterExtension(fileTypeName), "*.*" });
    fd.setFilterNames(new String[] { factory.getFilterName(fileTypeName), "All Files" });
    fd.setFileName(mobile + factory.getFilterExtension(fileTypeName));
    String filename = fd.open();
    if (filename == null)
        return;

    exportMessage(mobile, fileTypeName, filename, entries);
}

From source file:edu.tsinghua.lumaqq.ui.helper.ExportHelper.java

License:Open Source License

/**
 * ?// w  w  w.j  a  va2  s .c om
 * 
 * @param entries
 */
public void exportSystemMessage(List<RecordEntry> entries) {
    // ?
    RecordExportTypeDialog dialog = new RecordExportTypeDialog(main.getShell(), factory);
    if (dialog.open() == IDialogConstants.CANCEL_ID)
        return;
    String fileTypeName = dialog.getFileTypeName();

    // ??
    FileDialog fd = new FileDialog(main.getShell(), SWT.SAVE);
    fd.setFilterExtensions(new String[] { '*' + factory.getFilterExtension(fileTypeName), "*.*" });
    fd.setFilterNames(new String[] { factory.getFilterName(fileTypeName), "All Files" });
    fd.setFileName("system" + factory.getFilterExtension(fileTypeName));
    String filename = fd.open();
    if (filename == null)
        return;

    exportSystemMessge(fileTypeName, filename, entries);
}

From source file:edu.umd.cs.eclipse.courseProjectManager.PasswordDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    if (password != null) {
        passwordText.setText(password);/*from   w w  w .j  a va  2  s.com*/
        passwordText.selectAll();
    }

    usernameText.setFocus();
    if (username != null) {
        usernameText.setText(username);
        usernameText.selectAll();
    }
}

From source file:edu.umd.cs.eclipse.courseProjectManager.SubmitUserDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    userDataText.setFocus();// w  w  w. ja  v  a 2  s . c om
    if (userData != null) {
        userDataText.setText(userData);
        userDataText.selectAll();
    }
}

From source file:edu.washington.cs.cupid.usage.internal.Activator.java

License:Open Source License

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    pluginLog = Platform.getLog(context.getBundle());
    collector = CupidDataCollector.getInstance();

    final IPreferenceStore preferences = getPreferenceStore();

    if (preferences.getString(PreferenceConstants.P_UUID).equals("")) {
        preferences.setValue(PreferenceConstants.P_UUID, UUID.randomUUID().toString());
    }/*w ww.j a  v  a 2  s .  c o m*/

    preferences.addPropertyChangeListener(this);

    if (preferences.getBoolean(PreferenceConstants.P_ENABLE_COLLECTION)) {
        collector.start();
        collector.upload.schedule(1000 * 10 /* 10 s */);
    }

    if (!preferences.getBoolean(PreferenceConstants.P_SHOWN_ENABLE_DIALOG)) {
        new UIJob("Cupid Data Collection Dialog") {

            @Override
            public IStatus runInUIThread(IProgressMonitor monitor) {
                IShellProvider workbench = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

                if (workbench != null) {
                    Shell shell = workbench.getShell();

                    if (shell != null) {
                        DataCollectorDialog dialog = new DataCollectorDialog(shell);
                        dialog.create();
                        dialog.setBlockOnOpen(true);

                        if (dialog.open() == Dialog.OK) {
                            preferences.setValue(PreferenceConstants.P_ENABLE_COLLECTION, true);
                        } else {
                            preferences.setValue(PreferenceConstants.P_ENABLE_COLLECTION, false);
                        }

                        preferences.setValue(PreferenceConstants.P_SHOWN_ENABLE_DIALOG, true);
                    }
                }

                return Status.OK_STATUS;
            }
        }.schedule();
    }

    boolean doSurvey = preferences.getBoolean(PreferenceConstants.P_REMIND_SURVEY);
    Date next = new Date(preferences.getLong(PreferenceConstants.P_NEXT_SURVEY_DATE));
    Date today = new Date();

    if (doSurvey && today.after(next)) {
        new UIJob("Usage Survey Job") {
            @Override
            public IStatus runInUIThread(IProgressMonitor monitor) {
                IShellProvider workbench = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

                if (workbench != null) {
                    SurveyDialog dialog = new SurveyDialog(workbench.getShell());
                    int result = dialog.open();

                    if (result == IDialogConstants.ABORT_ID) {
                        preferences.setValue(PreferenceConstants.P_REMIND_SURVEY, false);
                    } else if (result == IDialogConstants.OK_ID) {
                        preferences.setValue(PreferenceConstants.P_REMIND_SURVEY, false);
                    } else if (result == IDialogConstants.IGNORE_ID) {
                        preferences.setValue(PreferenceConstants.P_REMIND_SURVEY, true);
                        preferences.setValue(PreferenceConstants.P_NEXT_SURVEY_DATE,
                                SurveyDialog.addDaysToDate(new Date(), 7).getTime());
                    } else if (result == IDialogConstants.CANCEL_ID) {
                        // NOP
                    } else {
                        Activator.getDefault().logError("Unexpected result from Cupid survey dialog", null);
                    }
                }

                return Status.OK_STATUS;
            }
        }.schedule();
    }
}

From source file:edu.washington.cs.cupid.usage.internal.DataCollectorDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    GridData gridData = new GridData(SWT.CENTER, SWT.FILL, true, true);
    parent.setLayoutData(gridData);//from  w  w  w .  j  a v a 2s.  c om

    createButton(parent, IDialogConstants.OK_ID, "Enable Data Collection", true);
    createButton(parent, IDialogConstants.CANCEL_ID, "Do Not Collect Data", false);
}

From source file:es.axios.udig.spatialoperations.internal.ui.dialogs.CreateNewLayerDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    this.okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    this.cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

}

From source file:eu.abc4trust.ri.ui.user.wizard.IssueWizardDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    Button ok = getButton(IDialogConstants.NEXT_ID);
    ok.setText("Get credential!");
    setButtonLayoutData(ok);//w  ww  .j  a v  a 2s.c  om
    ok.addMouseListener(new MouseListener() {
        private static final long serialVersionUID = 6732595815149773092L;

        @Override
        public void mouseDoubleClick(MouseEvent arg0) {
        }

        @Override
        public void mouseDown(MouseEvent arg0) {
            ProtocolHandler.doProtocol(wizard);
        }

        @Override
        public void mouseUp(MouseEvent arg0) {
        }

    });

    Button finish = getButton(IDialogConstants.FINISH_ID);
    finish.setText("Thanks!");
    setButtonLayoutData(finish);

    Button cancel = getButton(IDialogConstants.CANCEL_ID);
    cancel.setText("I changed my mind");
    setButtonLayoutData(cancel);
}

From source file:eu.aniketos.wp1.ststool.analysis.dialog.AnalysisDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//from  w  w w  . ja  v  a  2  s . c  o m
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, getMessage(AnalysisDialog_btn_StartAnalysis), true);
    createButton(parent, IDialogConstants.CANCEL_ID, getMessage(AnalysisDialog_btn_Exit), false);
}

From source file:eu.aniketos.wp1.ststool.analysis.dialog.AnalysisDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.OK_ID:
        startAnalysis();//from  ww  w  . j  a  va 2 s  . c o  m
        break;
    case IDialogConstants.CANCEL_ID:
        if (analysisStarted) {
            monitor.setCanceled(true);
        } else {
            performClose(analysisResult);
        }
        break;
    }
}