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

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

Introduction

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

Prototype

int CLIENT_ID

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

Click Source Link

Document

Starting button id reserved for use by clients of JFace (value 1024).

Usage

From source file:org.eclipse.edt.ide.ui.internal.contentassist.EGLContentAssistProcessor.java

License:Open Source License

private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = EDTUIPlugin.getActiveWorkbenchShell();
        String title = EGLTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = EGLTextMessages.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(
                EGLTextMessages.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) {
            /*//from w  ww  .ja  v a 2s. co m
             * @see org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            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() {
                    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);

                super.createCustomArea(parent);

                return parent;
            }

            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 = EDTUIPlugin.getDefault().getPreferenceStore();
                store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_CATEGORY_ORDER);
                store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            }
            if (settingsId == returnValue)
                PreferencesUtil
                        .createPreferenceDialogOn(shell,
                                "org.eclipse.edt.ide.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                        .open();
            fComputerRegistry.reload();
            return true;
        }
    }
    return false;
}

From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.ModifyDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.CLIENT_ID) {
        applyPressed();//from  w ww  .j  av  a2 s .  c  o  m
    } else {
        super.buttonPressed(buttonId);
    }
}

From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.ModifyDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    fApplyButton = createButton(parent, IDialogConstants.CLIENT_ID, NewWizardMessages.Apply, false);
    fApplyButton.setEnabled(false);//from   w ww  .ja v a2s .c  o m

    GridLayout layout = (GridLayout) parent.getLayout();
    layout.numColumns++;
    layout.makeColumnsEqualWidth = false;
    Label label = new Label(parent, SWT.NONE);
    GridData data = new GridData();
    data.widthHint = layout.horizontalSpacing;
    label.setLayoutData(data);
    super.createButtonsForButtonBar(parent);
}

From source file:org.eclipse.epf.richtext.dialogs.FindReplaceDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CLIENT_ID + 1, RichTextResources.findButton_text, true);
    findButton = super.getButton(IDialogConstants.CLIENT_ID + 1);
    findButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent event) {
            findReplaceAction.run(FindReplaceAction.FIND_TEXT, getFindText(), getReplaceText(),
                    getMatchDirection(), getMatchOptions());
            if (!findOnly) {
                replaceButton.setEnabled(findReplaceAction.getFoundMatch());
                replaceFindButton.setEnabled(findReplaceAction.getFoundMatch());
            }//w  w  w. ja va  2s .  c o  m
            if (findReplaceAction.getFoundMatch()) {
                statusLabel.setText(""); //$NON-NLS-1$
            } else {
                statusLabel.setText(RichTextResources.FindReplace_Status_noMatch_label);
            }
            findButton.setFocus();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    createButton(parent, IDialogConstants.CLIENT_ID + 2, RichTextResources.replaceButton_text, false);
    replaceButton = super.getButton(IDialogConstants.CLIENT_ID + 2);
    if (!findOnly) {
        replaceButton.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent event) {
                findReplaceAction.run(FindReplaceAction.REPLACE_TEXT, getFindText(), getReplaceText(),
                        getMatchDirection(), getMatchOptions());
                replaceButton.setFocus();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
    }

    createButton(parent, IDialogConstants.CLIENT_ID + 3, RichTextResources.replaceFindButton_text, false);
    replaceFindButton = super.getButton(IDialogConstants.CLIENT_ID + 3);
    if (!findOnly) {
        replaceFindButton.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent event) {
                findReplaceAction.run(FindReplaceAction.REPLACE_FIND_TEXT, getFindText(), getReplaceText(),
                        getMatchDirection(), getMatchOptions());
                replaceButton.setEnabled(findReplaceAction.getFoundMatch());
                replaceFindButton.setEnabled(findReplaceAction.getFoundMatch());
                replaceFindButton.setFocus();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
    }

    createButton(parent, IDialogConstants.CLIENT_ID + 4, RichTextResources.replaceallButton_text, false);
    replaceAllButton = super.getButton(IDialogConstants.CLIENT_ID + 4);
    if (!findOnly) {
        replaceAllButton.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent event) {
                findReplaceAction.run(FindReplaceAction.REPLACE_ALL_TEXT, getFindText(), getReplaceText(),
                        getMatchDirection(), getMatchOptions());
                replaceButton.setEnabled(false);
                replaceFindButton.setEnabled(false);
                replaceAllButton.setFocus();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
    }

    // Create the Cancel button.
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    cancelButton = super.getButton(IDialogConstants.CANCEL_ID);

    findButton.setEnabled(false);
    replaceButton.setEnabled(false);
    replaceFindButton.setEnabled(false);
    replaceAllButton.setEnabled(false);
}

From source file:org.eclipse.help.ui.internal.preferences.ICDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {

    testButton = this.createButton(parent, IDialogConstants.CLIENT_ID,
            Messages.HelpContentBlock_testConnectionTitle, true);
    testButton.addSelectionListener(this);
    super.createButtonsForButtonBar(parent);

    //Initialize validity
    updateValidity();/* w w w .  j ava  2 s . c  om*/

    if (testConnect)
        testConnection();
}

From source file:org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.MinMaxDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    createButton(parent, IDialogConstants.CLIENT_ID, SDMessages._126, false);
    getButton(IDialogConstants.CLIENT_ID).addSelectionListener(new SelectionListener() {

        @Override/*from   w ww .j  ava2s  .c  o  m*/
        public void widgetSelected(SelectionEvent e) {
            sdWidget.getFrame().resetCustomMinMax();
            minText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getValue()));
            maxText.setText(String.valueOf(sdWidget.getFrame().getMaxTime().getValue()));
            scaleText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getScale()));
            precisionText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getPrecision()));
            maxText.getParent().layout(true);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {

        }

    });
}

From source file:org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDPrintDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    super.createButtonsForButtonBar(parent);
    createButton(parent, IDialogConstants.CLIENT_ID, SDMessages._115, false);

    getButton(IDialogConstants.CLIENT_ID).addSelectionListener(new SelectionListener() {

        @Override/*  w w w. ja v a2  s  . c  o  m*/
        public void widgetSelected(SelectionEvent e) {

            dialogUI.printButtonSelected();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }

    });

    updateButtons();
}

From source file:org.eclipse.mylyn.commons.workbench.forms.DateSelectionDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    super.buttonPressed(buttonId);
    if (buttonId == IDialogConstants.CLIENT_ID + 1) {
        selectedDate = null;/*from   w  ww.  j av  a 2s.co  m*/
        okPressed();
    }
}

From source file:org.eclipse.nebula.widgets.nattable.group.gui.CreateColumnGroupDialog.java

License:Open Source License

private Composite createButtonSection(Composite composite) {

    Composite panel = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    panel.setLayout(layout);//from  w  ww  . j  a va2  s  . c  o  m

    Label spacer = new Label(panel, SWT.LEFT);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(spacer);

    createButton = createButton(panel, IDialogConstants.CLIENT_ID,
            Messages.getString("ColumnGroups.createButtonLabel"), false); //$NON-NLS-1$
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT)
            .applyTo(createButton);

    createButton.setEnabled(false);
    getShell().setDefaultButton(createButton);

    createButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            doColumnGrouping();
        }
    });

    Button closeButton = createButton(panel, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT)
            .applyTo(closeButton);

    return panel;
}

From source file:org.eclipse.nebula.widgets.nattable.search.gui.SearchDialog.java

License:Open Source License

private Composite createButtonSection(Composite composite) {

    Composite panel = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    panel.setLayout(layout);/*  ww  w  .  j  a v  a 2  s  .c  om*/

    statusLabel = new Label(panel, SWT.LEFT);
    statusLabel.setForeground(statusLabel.getDisplay().getSystemColor(SWT.COLOR_RED));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(statusLabel);

    findButton = createButton(panel, IDialogConstants.CLIENT_ID, Messages.getString("Search.findButtonLabel"), //$NON-NLS-1$
            false);
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT)
            .applyTo(findButton);

    findButton.setEnabled(false);
    getShell().setDefaultButton(findButton);

    findButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            doFind();
        }
    });

    Button closeButton = createButton(panel, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT)
            .applyTo(closeButton);

    return panel;
}