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

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

Introduction

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

Prototype

int CLOSE_ID

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

Click Source Link

Document

Button id for a "Close" button (value 12).

Usage

From source file:org.summer.sdt.internal.ui.text.java.ContentAssistProcessor.java

License:Open Source License

/**
 * Informs the user about the fact that there are no enabled categories in the default content
 * assist set and shows a link to the preferences.
 *
 * @return  <code>true</code> if the default should be restored
 * @since 3.3/*from  www.j  a va2 s  .  co  m*/
 */
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = JavaPlugin.getActiveWorkbenchShell();
        String title = JavaTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = JavaTextMessages.ContentAssistProcessor_all_disabled_message;
        // see PreferencePage#createControl for the 'defaults' label
        final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$
        final String linkMessage = Messages.format(
                JavaTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final int settingsId = IDialogConstants.CLIENT_ID + 11;
        final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
                shell, title, null /* default image */, message, MessageDialog.WARNING,
                new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
            /*
             * @see org.summer.sdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected Control createCustomArea(Composite composite) {
                // wrap link and checkbox in one composite without space
                Composite parent = new Composite(composite, SWT.NONE);
                GridLayout layout = new GridLayout();
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.verticalSpacing = 0;
                parent.setLayout(layout);

                Composite linkComposite = new Composite(parent, SWT.NONE);
                layout = new GridLayout();
                layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
                layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
                linkComposite.setLayout(layout);

                Link link = new Link(linkComposite, SWT.NONE);
                link.setText(linkMessage);
                link.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        setReturnCode(settingsId);
                        close();
                    }
                });
                GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
                gridData.widthHint = this.getMinimumMessageWidth();
                link.setLayoutData(gridData);

                // create checkbox and "don't show this message" prompt
                super.createCustomArea(parent);

                return parent;
            }

            /*
             * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected void createButtonsForButtonBar(Composite parent) {
                Button[] buttons = new Button[2];
                buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
                buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
                        true);
                setButtons(buttons);
            }
        };
        int returnValue = dialog.open();
        if (restoreId == returnValue || settingsId == returnValue) {
            if (restoreId == returnValue) {
                IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
                store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
                store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            }
            if (settingsId == returnValue)
                PreferencesUtil
                        .createPreferenceDialogOn(shell,
                                "org.summer.sdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                        .open();
            fComputerRegistry.reload();
            return true;
        }
    }
    return false;
}

From source file:org.talend.librariesmanager.ui.dialogs.ExternalModulesInstallDialogWithProgress.java

License:Open Source License

@Override
protected Button getButton(int id) {
    if (id == IDialogConstants.CLOSE_ID) {
        return closeButton;
    }// w w  w.ja  v a2  s  .  c  o  m
    return super.getButton(id);
}

From source file:org.talend.librariesmanager.ui.dialogs.ExternalModulesInstallDialogWithProgress.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (IDialogConstants.CLOSE_ID == buttonId) {
        closePressed();//from   ww w .java  2s.  c  o m
    } // else cancel button has a listener already
}

From source file:org.talend.librariesmanager.ui.dialogs.ExternalModulesInstallDialogWithProgress.java

License:Open Source License

/**
 * Creates the Cancel button for this wizard dialog. Creates a standard (<code>SWT.PUSH</code>) button and registers
 * for its selection events. Note that the number of columns in the button bar composite is incremented. The Cancel
 * button is created specially to give it a removeable listener.
 * //from   ww  w .ja  va 2s .c  o  m
 * @param parent the parent button bar
 * @return the new Cancel button
 */
private Button createCloseButton(Composite parent) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(IDialogConstants.CLOSE_LABEL);
    setButtonLayoutData(button);
    button.setFont(parent.getFont());
    button.setData(new Integer(IDialogConstants.CLOSE_ID));
    button.addSelectionListener(closeListener);
    return button;
}

From source file:org.testeditor.ui.reporting.TestExecutionProgressDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    // adding new button for closing the dialog on demand
    closeButton = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
    closeButton.setEnabled(false);/* ww  w . j a v  a 2s.  c o m*/

    closeButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            close();
            dispose();
        }
    });

    // adding new button for closing the dialog on demand
    detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL,
            true);

    detailsButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {

            if (logViewerComposite.getVisible()) {
                logViewerComposite.setVisible(false);
                detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
                TestExecutionProgressDialog.this.parent.getShell().setSize(DEFAULT_DIALOG_SIZE);
            } else {
                logViewerComposite.setVisible(true);
                detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
                TestExecutionProgressDialog.this.parent.getShell().setSize(ENLARGED_DIALOG_SIZE);
            }

            TestExecutionProgressDialog.this.parent.getShell().layout();
        }
    });

    super.createButtonsForButtonBar(parent);
}

From source file:org.whole.lang.e4.ui.dialogs.E4FindReplaceDialog.java

License:Open Source License

protected Control createStatusPanel(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    composite.setLayout(layout);/*from   w ww  . jav a 2  s. com*/
    statusLabel = new Label(composite, SWT.LEFT);
    statusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    Button button = createButton(composite, IDialogConstants.CLOSE_ID, "Close", false);
    GridData gridData = (GridData) button.getLayoutData();
    gridData.horizontalAlignment = SWT.RIGHT;
    gridData.verticalAlignment = SWT.BOTTOM;
    gridData.grabExcessHorizontalSpace = gridData.grabExcessVerticalSpace = false;
    composite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
    return composite;
}

From source file:org.whole.lang.e4.ui.dialogs.E4FindReplaceDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);

    clearFreshTemplate();/*from w  w w  .  java  2  s  .c  o  m*/

    boolean state = enableSelectionTracking(false);
    try {
        switch (buttonId) {
        case FIND_ID:
            doFind();
            break;

        case REPLACE_ID:
            doReplace(true);
            break;

        case REPLACE_FIND_ID:
            doReplace(false);
            doFind();
            break;

        case REPLACE_ALL_ID:
            doReplaceAll();
            break;

        case IDialogConstants.CLOSE_ID:
        default:
            okPressed();
            break;
        }
    } finally {
        enableSelectionTracking(state);
    }
}

From source file:org.xmind.ui.browser.BrowserDialog.java

License:Open Source License

protected boolean performSkip() {
    setReturnCode(IDialogConstants.CLOSE_ID);
    return super.close();
}

From source file:org.xmind.ui.internal.editor.DecryptionDialogPane.java

License:Open Source License

@Override
protected void escapeKeyPressed() {
    triggerButton(IDialogConstants.CLOSE_ID);
}

From source file:org.xmind.ui.internal.editor.ErrorDialogPane.java

License:Open Source License

protected void createButtonsForButtonBar(Composite buttonBar) {
    createButton(buttonBar, IDialogConstants.OK_ID, MindMapMessages.EncryptDialogPane_detailsButton_label,
            false);/*from w  w  w.ja  v  a  2  s  .  co m*/
    createButton(buttonBar, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false);
    getButton(IDialogConstants.OK_ID).setEnabled(error != null);
}