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

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

Introduction

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

Prototype

int ABORT_ID

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

Click Source Link

Document

Button id for an "Abort" button (value 7).

Usage

From source file:com.agynamix.platform.frontend.dialogs.ProgressBarDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.ABORT_ID, IDialogConstants.ABORT_LABEL, true);
}

From source file:com.agynamix.platform.frontend.dialogs.ProgressBarDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.ABORT_ID) {
        isClosed = true;//from   w ww. j  a  va 2  s.  c om
    }
    super.buttonPressed(buttonId);
}

From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.CleanupUncomittedChangesDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.PROCEED_ID:
        CommitUI commitUI = new CommitUI(getShell(), repository, new IResource[0], true);
        shouldContinue = commitUI.commit();
        break;/*from w ww  . jav a 2 s.  c  o m*/
    case IDialogConstants.ABORT_ID:
        final ResetOperation operation = new ResetOperation(repository, Constants.HEAD, ResetType.HARD);
        String jobname = NLS.bind(UIText.ResetAction_reset, Constants.HEAD);
        JobUtil.scheduleUserWorkspaceJob(operation, jobname, JobFamilies.RESET);
        shouldContinue = true;
        break;
    case IDialogConstants.SKIP_ID:
        StashCreateUI stashCreateUI = new StashCreateUI(repository);
        shouldContinue = stashCreateUI.createStash(getShell());
        break;
    case IDialogConstants.CANCEL_ID:
    }
    super.buttonPressed(buttonId);
}

From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.CleanupUncomittedChangesDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    createButton(parent, IDialogConstants.PROCEED_ID, UIText.BranchResultDialog_buttonCommit, false);
    createButton(parent, IDialogConstants.SKIP_ID, UIText.BranchResultDialog_buttonStash, false);
    createButton(parent, IDialogConstants.ABORT_ID, UIText.BranchResultDialog_buttonReset, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
}

From source file:com.motorola.studio.android.launch.ui.StartedInstancesDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK, Ignore and Abort buttons
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    ignoreButton = createButton(parent, IDialogConstants.IGNORE_ID, IDialogConstants.IGNORE_LABEL, false);
    abortButton = createButton(parent, IDialogConstants.ABORT_ID, IDialogConstants.ABORT_LABEL, false);

    ignoreButton.addMouseListener(new MouseListener() {

        public void mouseUp(MouseEvent e) {
            setReturnCode(IDialogConstants.IGNORE_ID);
            close();/*from w  ww  . jav  a 2s.  c  om*/
        }

        public void mouseDown(MouseEvent e) {
            //do nothing
        }

        public void mouseDoubleClick(MouseEvent e) {
            //do nothing
        }
    });

    abortButton.addMouseListener(new MouseListener() {

        public void mouseUp(MouseEvent e) {
            setReturnCode(IDialogConstants.ABORT_ID);
            close();
        }

        public void mouseDown(MouseEvent e) {
            //do nothing
        }

        public void mouseDoubleClick(MouseEvent e) {
            //do nothing
        }
    });
}

From source file:com.rinke.solutions.pinball.GlobalExceptionHandler.java

public void showError(Exception e) {
    display.asyncExec(new Runnable() {

        @Override/*  w w w .  j a  v a  2  s. c  o m*/
        public void run() {
            if (e instanceof LicenseException) {
                MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);

                messageBox.setText("License problem");
                messageBox.setMessage("This action requires a license. Error message was: " + e.getMessage()
                        + "\nIf you hav a license file please register your key file via menu Help/Register.");
                messageBox.open();
            } else {
                MultiStatus status = createMultiStatus(e.getLocalizedMessage(), e);
                ErrorDialog errorDialog = new ErrorDialog(Display.getCurrent().getActiveShell(), "Error",
                        "Ein unerwarteter Fehler ist aufgetreten", status,
                        IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR) {
                    protected void createButtonsForButtonBar(Composite parent) {
                        createButton(parent, IDialogConstants.ABORT_ID, IDialogConstants.ABORT_LABEL, true);
                        createButton(parent, IDialogConstants.PROCEED_ID, IDialogConstants.PROCEED_LABEL,
                                false);
                        createDetailsButton(parent);
                    }

                    @Override
                    protected void buttonPressed(int id) {
                        super.buttonPressed(id);
                        if (id == IDialogConstants.ABORT_ID || id == IDialogConstants.PROCEED_ID) {
                            setReturnCode(id);
                            close();
                        }
                    }

                };
                int ret = errorDialog.open();
                if (ret == IDialogConstants.ABORT_ID)
                    System.exit(1);
            }
            //System.out.println(ret); // cancel = 1
            lastException = null;
        }
    });
}

From source file:com.salesforce.ide.core.internal.utils.DialogUtils.java

License:Open Source License

public int abortMessage(String title, String message) {
    // ok is the default
    MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR,
            new String[] { IDialogConstants.ABORT_LABEL }, IDialogConstants.ABORT_ID);
    return dialog.open();
}

From source file:de.defmacro.dandelion.internal.ui.dialogs.EvalFailureDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.ABORT_ID, IDialogConstants.ABORT_LABEL, true);
    if (!fRestarts.isEmpty()) {
        createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
        setOKButtonEnabled(false);//  ww w .  ja  v a2  s.c o  m
        hintSelectRestart(true);
    }
}

From source file:de.defmacro.dandelion.internal.ui.dialogs.EvalFailureDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.ABORT_ID) {
        abort();//from   ww w .  j a v a2  s  .c o  m
    }

    super.buttonPressed(buttonId);
}

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());
    }/*from   w w w  . j  a  va 2  s  .  co 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();
    }
}