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:com.siteview.ecc.rcp.cnf.ui.SecureLoginDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    Button removeCurrentUser = createButton(parent, IDialogConstants.CLIENT_ID, "&Delete User", false);
    removeCurrentUser.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            savedDetails.remove(userIdText.getText());
            initializeUsers("");
            //            ISecurePreferences preferences = SecurePreferencesFactory.getDefault();
            //            ISecurePreferences connections = preferences.node(SAVED);
            //            connections.remove(userIdText.getText());
            //            preferences.removeNode();
            //            try {
            //               preferences.flush();
            //            } catch (IOException e1) {
            //               // TODO Auto-generated catch block
            //               e1.printStackTrace();
            //            }
        }//from www .  j a  v  a2 s.c  o m
    });
    createButton(parent, IDialogConstants.OK_ID, "&Login", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

}

From source file:descent.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.
 * /*w ww  .ja  va  2  s . c  o  m*/
 * @since 3.3
 */
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 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 descent.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) {
                        close();
                        PreferencesUtil
                                .createPreferenceDialogOn(shell,
                                        "descent.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                                .open();
                    }
                });
                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)
             */
            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);
            }
        };
        if (restoreId == dialog.open()) {
            IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
            store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
            store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault();
            registry.reload();
            return true;
        }
    }
    return false;
}

From source file:dynamicrefactoring.interfaz.SelectDynamicRefactoringWindow.java

License:Open Source License

/**
 * Crea el contenido de la ventana de dilogo.
 * //  w ww  .j a v a 2s. co  m
 * @param parent el componente padre del dilogo.
 * 
 * @return el control del rea de dilogo.
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    final GridLayout gridLayout = new GridLayout();
    container.setLayout(gridLayout);

    final Composite composite = new Composite(container, SWT.NONE);
    composite.setLayoutData(new GridData(694, 410));
    final GridLayout gridLayout_1 = new GridLayout();
    gridLayout_1.numColumns = 2;
    composite.setLayout(gridLayout_1);

    final Group gr_RefList = new Group(composite, SWT.NONE);
    gr_RefList.setLayout(new GridLayout());
    gr_RefList.setText(Messages.SelectDynamicRefactoringWindow_AvailableRefactorings);
    GridData gd = new GridData();
    gd.verticalAlignment = GridData.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gr_RefList.setLayoutData(gd);

    Object[] messageArgs = { getOperation() };
    MessageFormat formatter = new MessageFormat(""); //$NON-NLS-1$
    formatter.applyPattern(Messages.SelectDynamicRefactoringWindow_SelectRefactoring);
    availableRefListViewer = new TableViewer(gr_RefList, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    availableRefListViewer.setLabelProvider(new RefactoringListLabelProvider());
    availableRefListViewer.setContentProvider(new ArrayContentProvider());
    availableRefListViewer.setSorter(new RefactoringListSorter());
    availableRefListViewer.getTable().setToolTipText(formatter.format(messageArgs));
    availableRefListViewer.getTable().addSelectionListener(new RefactoringSelectionListener());
    availableRefListViewer.getControl().setLayoutData(gd);

    filter = new RefactoringListFilter();

    if (getOperation() == Messages.SelectForEditingWindow_EditLower) {
        filterButton = new Button(gr_RefList, SWT.CHECK);
        filterButton.setText(Messages.SelectDynamicRefactoringWindow_Filter);
        filterButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                if (((Button) event.widget).getSelection()) {
                    availableRefListViewer.addFilter(filter);
                    //si al aplicar el filtro no hay ningun elemento seleccionado en la lista
                    //deshabilitamos el boton de Copy
                    if (availableRefListViewer.getTable().getSelectionIndex() < 0) {
                        getButton(IDialogConstants.CLIENT_ID).setEnabled(false);
                    }
                } else {
                    availableRefListViewer.removeFilter(filter);
                }
            }
        });
    } else {
        availableRefListViewer.addFilter(filter);
    }

    final Group refactoringSummaryGroup = new Group(composite, SWT.NONE);
    refactoringSummaryGroup.setText(Messages.SelectDynamicRefactoringWindow_Summary);
    final GridData gd_refactoringSummaryGroup = new GridData(475, 390);
    refactoringSummaryGroup.setLayoutData(gd_refactoringSummaryGroup);
    refactoringSummaryGroup.setLayout(new GridLayout());

    final Label lb_Description = new Label(refactoringSummaryGroup, SWT.CENTER);
    final GridData gd_lb_Description = new GridData(464, SWT.DEFAULT);
    lb_Description.setLayoutData(gd_lb_Description);
    lb_Description.setText(Messages.SelectDynamicRefactoringWindow_Description);

    t_Description = new Text(refactoringSummaryGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    t_Description.setEditable(false);
    final GridData gd_t_Description = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd_t_Description.heightHint = 32;
    t_Description.setLayoutData(gd_t_Description);

    final Label lb_Motivation = new Label(refactoringSummaryGroup, SWT.CENTER);
    final GridData gd_lb_Motivation = new GridData(465, SWT.DEFAULT);
    lb_Motivation.setLayoutData(gd_lb_Motivation);
    lb_Motivation.setText(Messages.SelectDynamicRefactoringWindow_Motivation);

    t_Motivation = new Text(refactoringSummaryGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    t_Motivation.setEditable(false);
    final GridData gd_t_Motivation = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd_t_Motivation.heightHint = 32;
    t_Motivation.setLayoutData(gd_t_Motivation);

    final Group gr_Image = new Group(refactoringSummaryGroup, SWT.NONE);
    gr_Image.setLayoutData(new GridData(SWT.DEFAULT, 248));
    gr_Image.setText(Messages.SelectDynamicRefactoringWindow_Image);
    gr_Image.setLocation(0, 0);

    cv_Image = new Canvas(gr_Image, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    cv_Image.setRedraw(true);
    cv_Image.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    cv_Image.setBounds(10, 21, 442, 233);
    gr_Image.setSize(462, 254);

    fillInRefactoringList();

    return container;
}

From source file:dynamicrefactoring.interfaz.SelectForEditingWindow.java

License:Open Source License

/**
 * Crea el resto de botones necesarios en el dialogo que permiten lanzar las
 * distintas funcionalidades del dialogo. Entre ellos se encuentra el botn
 * OK.//from w  w w .  jav  a 2  s  .com
 * 
 * @param parent
 *            el componente padre del botn.
 */
protected void createOtherButtons(Composite parent) {
    createButton(parent, IDialogConstants.CLIENT_ID, Messages.SelectForEditingWindow_CreateFrom, true);
    getButton(IDialogConstants.CLIENT_ID).setEnabled(false);
    super.createOtherButtons(parent);
}

From source file:dynamicrefactoring.interfaz.SelectForEditingWindow.java

License:Open Source License

/**
 * Notifica que el botn de este dilogo con el identificador especificado
 * ha sido pulsado./*  ww  w  . j  av a 2 s . c o m*/
 * 
 * @param buttonId
 *            el identificador del botn que ha sido pulsado (vanse las
 *            constantes <code>IDialogConstants.*ID</code>).
 * 
 * @see Dialog#buttonPressed
 * @see IDialogConstants
 */
@Override
protected void buttonPressed(int buttonId) {

    if (buttonId != IDialogConstants.CANCEL_ID) {
        Table availableList = availableRefListViewer.getTable();
        if (availableList.getSelectionCount() == 1) {
            Object obj = availableList.getSelection()[0].getData();
            if (obj instanceof DynamicRefactoringDefinition) {

                this.close();

                DynamicRefactoringDefinition refactoring = (buttonId == IDialogConstants.CLIENT_ID)
                        ? getRefactoringCopy(obj)
                        : (DynamicRefactoringDefinition) obj;
                RefactoringWizard wizard = new RefactoringWizard(refactoring, refactCatalog);
                wizard.init(PlatformUI.getWorkbench(), null);

                WizardDialog dialog = new WizardDialog(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
                dialog.create();
                dialog.setPageSize(200, 200);
                dialog.updateSize();
                dialog.open();
            }
        }
    }

    super.buttonPressed(buttonId);
}

From source file:eu.geclipse.ui.internal.dialogs.ProblemReportDialog.java

License:Open Source License

@Override
protected void buttonPressed(final int buttonId) {
    if (buttonId == IDialogConstants.CLIENT_ID + SEND_ID) {
        sendPressed();//from   ww w  . j  a  v  a2 s  . c o  m
    } else if (buttonId == IDialogConstants.CLIENT_ID + SAVE_ID) {
        savePressed();
    } else if (buttonId == IDialogConstants.CLIENT_ID + COPY_ID) {
        copyPressed();
    } else if (buttonId == IDialogConstants.CLOSE_ID) {
        closePressed();
    } else {
        super.buttonPressed(buttonId);
    }
}

From source file:eu.geclipse.ui.internal.dialogs.ProblemReportDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    createButton(parent, IDialogConstants.CLIENT_ID + SEND_ID, "Send", true);
    createButton(parent, IDialogConstants.CLIENT_ID + SAVE_ID, "Save", false);
    createButton(parent, IDialogConstants.CLIENT_ID + COPY_ID, "Copy", false);
    createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false);
    updateUI();/*from www  .  ja v a  2s .  co m*/
}

From source file:eu.geclipse.ui.internal.dialogs.ProblemReportDialog.java

License:Open Source License

protected void updateUI() {
    Button sendButton = getButton(IDialogConstants.CLIENT_ID + SEND_ID);
    if (sendButton != null) {
        String mailto = this.mailtoText.getText();
        sendButton.setEnabled((mailto != null) && (mailto.length() > 0));
    }/*w  w w.j  a  va 2 s  .  c om*/
}

From source file:ext.org.eclipse.jdt.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   w  ww  .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.eclipse.jdt.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.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                        .open();
            fComputerRegistry.reload();
            return true;
        }
    }
    return false;
}

From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.dialogs.MinMaxDialog.java

License:Open Source License

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

        @Override/*from  w  w  w  . j  a v a2 s  .c  o  m*/
        public void widgetSelected(SelectionEvent e) {
            fSdWidget.getFrame().resetCustomMinMax();
            fMinText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getValue()));
            fMaxText.setText(String.valueOf(fSdWidget.getFrame().getMaxTime().getValue()));
            fScaleText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getScale()));
            fPrecisionText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getPrecision()));
            fMaxText.getParent().layout(true);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            // nothing to do
        }
    });
}