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:org.eclipse.andmore.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() {

        @Override//  www. ja  v a 2s  . c  o m
        public void mouseUp(MouseEvent e) {
            setReturnCode(IDialogConstants.IGNORE_ID);
            close();
        }

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

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

    abortButton.addMouseListener(new MouseListener() {

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

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

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

From source file:org.eclipse.debug.internal.ui.preferences.RunDebugPropertiesPage.java

License:Open Source License

/**
 * Edit the selection//w  w  w .  j a  v a 2 s  .co  m
 */
private void handleEdit() {
    ILaunchConfigurationWorkingCopy config = getSelectedConfigurations()[0];
    int ret = edit(config, false);
    if (ret == IDialogConstants.OK_ID) {
        fChangedConfigurations.add(config);
        fViewer.refresh(config, true, true);
    } else if (ret == IDialogConstants.ABORT_ID) {
        setErrorMessage(MessageFormat.format(DebugPreferencesMessages.RunDebugPropertiesPage_0,
                new String[] { config.getName() }));
    }
}

From source file:org.eclipse.debug.internal.ui.preferences.RunDebugPropertiesPage.java

License:Open Source License

/**
 * Edits the given configuration as a nested working copy.
 * Returns the code from the dialog used to edit the configuration.
 * //from  w w  w  .j a va2 s  . co  m
 * @param configuration the configuration working copy to editor
 * @param setDefaults whether to set default values in the config
 * @return dialog return code - OK or CANCEL
 */
private int edit(ILaunchConfigurationWorkingCopy configuration, boolean setDefaults) {
    try {
        LaunchConfigurationManager lcm = DebugUIPlugin.getDefault().getLaunchConfigurationManager();
        ILaunchGroup group = null;
        // bug 208034, we should try modes we know about first then guess
        ILaunchConfigurationType type = configuration.getType();
        if (type.supportsMode(ILaunchManager.RUN_MODE)) {
            group = lcm.getLaunchGroup(type, ILaunchManager.RUN_MODE);
        } else if (type.supportsMode(ILaunchManager.DEBUG_MODE)) {
            group = lcm.getLaunchGroup(type, ILaunchManager.DEBUG_MODE);
        } else if (type.supportsMode(ILaunchManager.PROFILE_MODE)) {
            group = lcm.getLaunchGroup(type, ILaunchManager.PROFILE_MODE);
        } else {
            Set modes = type.getSupportedModeCombinations();
            for (Iterator iter = modes.iterator(); iter.hasNext();) {
                group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(type,
                        (Set) iter.next());
                if (group != null) {
                    break;
                }
            }
        }
        if (group != null) {
            return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration,
                    group.getIdentifier(), getConfigurationNames(), null, setDefaults);
        }
    } catch (CoreException ce) {
    }
    return IDialogConstants.ABORT_ID;
}

From source file:org.eclipse.debug.internal.ui.preferences.RunDebugPropertiesPage.java

License:Open Source License

/**
 * Create a new configuration/*from  www .j  a va  2s .co  m*/
 */
private void handleNew() {

    final ILaunchConfigurationType[] typeCandidates = collectTypeCandidates();

    SelectionDialog dialog = new AbstractDebugListSelectionDialog(getShell()) {

        /* (non-Javadoc)
         * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getDialogSettingsId()
         */
        protected String getDialogSettingsId() {
            return DebugUIPlugin.getUniqueIdentifier() + ".SELECT_CONFIGURATION_TYPE_DIALOG"; //$NON-NLS-1$
        }

        /* (non-Javadoc)
         * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerInput()
         */
        protected Object getViewerInput() {
            return typeCandidates;
        }

        /* (non-Javadoc)
         * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getHelpContextId()
         */
        protected String getHelpContextId() {
            return IDebugHelpContextIds.SELECT_CONFIGURATION_TYPE_DIALOG;
        }

        /* (non-Javadoc)
         * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerLabel()
         */
        protected String getViewerLabel() {
            return DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_12;
        }

    };
    dialog.setTitle(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_11);

    if (dialog.open() == Window.OK) {
        Object[] result = dialog.getResult();
        if (result.length == 1) {
            ILaunchConfigurationType type = (ILaunchConfigurationType) result[0];
            try {
                ILaunchConfigurationWorkingCopy wc = type.newInstance(null,
                        ((LaunchManager) DebugPlugin.getDefault().getLaunchManager())
                                .generateUniqueLaunchConfigurationNameFrom("New_configuration", //$NON-NLS-1$
                                        getConfigurationNames()));
                int ret = edit(wc, true);
                if (ret == Window.OK) {
                    fChangedConfigurations.add(wc);
                    fViewer.add(wc);
                    fViewer.setSelection(new StructuredSelection(wc));
                } else if (ret == IDialogConstants.ABORT_ID) {
                    setErrorMessage(MessageFormat.format(DebugPreferencesMessages.RunDebugPropertiesPage_0,
                            new String[] { wc.getName() }));
                }
            } catch (CoreException e) {
                setErrorMessage(e.getMessage());
            }
        }
    }
}

From source file:org.eclipse.egit.ui.internal.branch.BranchResultDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    boolean shouldCheckout = false;
    switch (buttonId) {
    case IDialogConstants.PROCEED_ID:
        CommitUI commitUI = new CommitUI(getShell(), repository, new IResource[0], true);
        shouldCheckout = commitUI.commit();
        break;//  w  ww  .ja  v  a2  s.co 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.scheduleUserJob(operation, jobname, JobFamilies.RESET);
        shouldCheckout = true;
        break;
    case IDialogConstants.SKIP_ID:
        StashCreateUI stashCreateUI = new StashCreateUI(getShell(), repository);
        shouldCheckout = stashCreateUI.createStash();
        break;
    case IDialogConstants.CANCEL_ID:
        super.buttonPressed(buttonId);
        return;
    }
    if (shouldCheckout) {
        super.buttonPressed(buttonId);
        BranchOperationUI op = BranchOperationUI.checkout(repository, target);
        op.start();
    }
}

From source file: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 www  . ja v a  2  s . co  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:
    default:
        break;
    }
    super.buttonPressed(buttonId);
}

From source file:org.eclipse.egit.ui.internal.dialogs.CheckoutConflictDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.PROCEED_ID:
        CommonUtils.runCommand(CommitCommand.ID, new StructuredSelection(new RepositoryNode(null, repository)));
        break;/*from  ww w  .j a  v  a2s  .  c om*/
    case IDialogConstants.ABORT_ID:
        CommonUtils.runCommand(ResetCommand.ID, new StructuredSelection(new RepositoryNode(null, repository)));
        break;
    case IDialogConstants.SKIP_ID:
        CommonUtils.runCommand(StashCreateCommand.ID,
                new StructuredSelection(new RepositoryNode(null, repository)));
        break;
    }
    super.buttonPressed(buttonId);
}

From source file:org.eclipse.egit.ui.internal.dialogs.CheckoutConflictDialog.java

License:Open Source License

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

From source file:org.eclipse.sirius.common.ui.tools.api.dialog.SiriusMessageDialogWithToggle.java

License:Open Source License

/**
 * Attempt to find a standard JFace button id that matches the specified
 * button label. If no match can be found, use the default id provided.
 * //from  w ww  .j a v a2  s .c o  m
 * Overridden to investigate the provided buttons.
 * 
 * @param buttonLabel
 *            the button label whose id is sought
 * @param defaultId
 *            the id to use for the button if there is no standard id
 * @return the id for the specified button label
 */
// CHECKSTYLE:OFF
private int mapButtonLabelToButtonID(String buttonLabel, int defaultId) {
    // CHECKSTYLE:OON
    // Not pretty but does the job...
    if (IDialogConstants.OK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OK_ID;
    }

    if (IDialogConstants.YES_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_ID;
    }

    if (IDialogConstants.NO_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_ID;
    }

    if (IDialogConstants.CANCEL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CANCEL_ID;
    }

    if (IDialogConstants.YES_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_TO_ALL_ID;
    }

    if (IDialogConstants.SKIP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.SKIP_ID;
    }

    if (IDialogConstants.STOP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.STOP_ID;
    }

    if (IDialogConstants.ABORT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.ABORT_ID;
    }

    if (IDialogConstants.RETRY_LABEL.equals(buttonLabel)) {
        return IDialogConstants.RETRY_ID;
    }

    if (IDialogConstants.IGNORE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.IGNORE_ID;
    }

    if (IDialogConstants.PROCEED_LABEL.equals(buttonLabel)) {
        return IDialogConstants.PROCEED_ID;
    }

    if (IDialogConstants.OPEN_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OPEN_ID;
    }

    if (IDialogConstants.CLOSE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CLOSE_ID;
    }

    if (IDialogConstants.BACK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.BACK_ID;
    }

    if (IDialogConstants.NEXT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NEXT_ID;
    }

    if (IDialogConstants.FINISH_LABEL.equals(buttonLabel)) {
        return IDialogConstants.FINISH_ID;
    }

    if (IDialogConstants.HELP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.HELP_ID;
    }

    if (IDialogConstants.NO_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_TO_ALL_ID;
    }

    if (IDialogConstants.SHOW_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    if (IDialogConstants.HIDE_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    for (String providedButton : buttonsMap.keySet()) {
        if (providedButton.equals(buttonLabel)) {
            return buttonsMap.get(providedButton);
        }
    }

    // No XXX_LABEL in IDialogConstants for these. Unlikely
    // they would be used in a message dialog though.
    // public int SELECT_ALL_ID = 18;
    // public int DESELECT_ALL_ID = 19;
    // public int SELECT_TYPES_ID = 20;

    return defaultId;
}

From source file:org.jkiss.dbeaver.ui.controls.resultset.ColorSettingsDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    createButton(parent, IDialogConstants.ABORT_ID, CoreMessages.controls_resultset_filter_button_reset, false);
}