List of usage examples for org.eclipse.jface.dialogs IDialogConstants CLIENT_ID
int CLIENT_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants CLIENT_ID.
Click Source Link
From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.dialogs.SDPrintDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); createButton(parent, IDialogConstants.CLIENT_ID, Messages.SequenceDiagram_Printer, false); getButton(IDialogConstants.CLIENT_ID).addSelectionListener(new SelectionListener() { @Override/*from ww w . jav a 2s . co m*/ public void widgetSelected(SelectionEvent e) { fDialogUI.printButtonSelected(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); updateButtons(); }
From source file:net.tourbook.map3.ui.DialogMap3ColorEditor.java
License:Open Source License
private void createUI_99_ButtonsForButtonBar(final Composite parent) { // parent.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)); {/*from w w w .j a va 2 s .co m*/ /* * Button: Apply */ _btnApply = createButton(parent, IDialogConstants.CLIENT_ID + 6, Messages.Map3Color_Dialog_Button_Apply, false); _btnApply.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { onApply(true); } }); } // create default buttons (OK, Cancel) super.createButtonsForButtonBar(parent); { /* * Button: Save */ // set text for the OK button _btnSave = getButton(IDialogConstants.OK_ID); _btnSave.setText(Messages.Map3Color_Dialog_Button_Save); } }
From source file:net.tourbook.srtm.DialogSelectSRTMColors.java
License:Open Source License
@Override protected final void createButtonsForButtonBar(final Composite parent) { Button button;/*from w w w . j a v a2 s . co m*/ /* * button: add vertex */ button = createButton(parent, IDialogConstants.CLIENT_ID + 1, Messages.dialog_adjust_srtm_colors_button_add, false); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { onVertexAdd(); } }); /* * button: add multiple vertexes */ button = createButton(parent, IDialogConstants.CLIENT_ID + 2, Messages.dialog_adjust_srtm_colors_button_add_multiple, false); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { onVertexAddMultiple(); } }); /* * button: remove vertex */ _btnRemove = createButton(parent, IDialogConstants.CLIENT_ID + 4, Messages.dialog_adjust_srtm_colors_button_remove, false); _btnRemove.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { onVertexRemove(); } }); /* * button: sort vertexes */ button = createButton(parent, IDialogConstants.CLIENT_ID + 5, Messages.dialog_adjust_srtm_colors_button_sort, false); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { sortVertexsAndUpdateProfile(); } }); /* * button: apply */ _btnApply = createButton(parent, IDialogConstants.CLIENT_ID + 6, Messages.dialog_adjust_srtm_colors_button_apply, false); _btnApply.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { onApply(); } }); super.createButtonsForButtonBar(parent); // set text for the OK button _btnOK = getButton(IDialogConstants.OK_ID); _btnOK.setText(Messages.dialog_adjust_srtm_colors_button_update); }
From source file:org.brainwy.liclipsetext.editor.common.DialogNotifier.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default Button button = createButton(parent, IDialogConstants.OK_ID, " Show later ", true); button.addSelectionListener(new SelectionListener() { @Override/*from www .j av a2 s . c o m*/ public void widgetSelected(SelectionEvent e) { doClose(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); button = createButton(parent, IDialogConstants.CLIENT_ID, " Read it ", true); button.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { doClose(); IPreferenceStore preferenceStore = LiClipseTextEditorPlugin.getDefault().getPreferenceStore(); //Show it again only after a full year has elapsed. preferenceStore.setValue(LiClipseTextShowBrowserMessage.LICLIPSETEXT_FUNDING_SHOW_AT_TIME, System.currentTimeMillis() + (LiClipseTextShowBrowserMessage.ONE_DAY_IN_MILLIS * 365)); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); }
From source file:org.eclipse.cdt.internal.ui.text.contentassist.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 w w . ja v a 2 s. c om private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = CUIPlugin.getActiveWorkbenchShell(); String title = ContentAssistMessages.ContentAssistProcessor_all_disabled_title; String message = ContentAssistMessages.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( ContentAssistMessages.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.cdt.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 = CUIPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.cdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.cdt.internal.ui.wizards.indexwizards.TeamProjectIndexExportWizardPage.java
License:Open Source License
private void createDestinationGroup(Composite parent) { GridData gd;/* w w w. j a v a2 s.c o m*/ Font font = parent.getFont(); // destination specification group Composite destinationSelectionGroup = new Composite(parent, SWT.NONE); destinationSelectionGroup.setLayout(new GridLayout(2, false)); destinationSelectionGroup .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); destinationSelectionGroup.setFont(font); Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE); destinationLabel.setText(Messages.TeamProjectIndexExportWizardPage_destinationLabel); destinationLabel.setFont(font); destinationLabel.setLayoutData(gd = new GridData()); gd.horizontalSpan = 2; // destination name entry field fDestinationField = new Text(destinationSelectionGroup, SWT.BORDER); fDestinationField.addListener(SWT.Modify, this); fDestinationField.addListener(SWT.Selection, this); fDestinationField.setFont(font); fDestinationField.setLayoutData(gd = new GridData()); gd.grabExcessHorizontalSpace = true; gd.horizontalAlignment = GridData.FILL; gd.widthHint = SIZING_TEXT_FIELD_WIDTH; Button button = createButton(destinationSelectionGroup, IDialogConstants.CLIENT_ID, Messages.TeamProjectIndexExportWizardPage_variableButton, false); SelectionAdapter listener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onInsertVariable(); } }; button.addSelectionListener(listener); // resource snapshot destination group Composite resourceSnapshotDestinationGroup = new Composite(parent, SWT.NONE); resourceSnapshotDestinationGroup.setLayout(new GridLayout(1, false)); resourceSnapshotDestinationGroup .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); resourceSnapshotDestinationGroup.setFont(font); fResourceSnapshotButton = new Button(resourceSnapshotDestinationGroup, SWT.CHECK); fResourceSnapshotButton.setText(Messages.TeamProjectIndexExportWizardPage_resourceSnapshotButton); fResourceSnapshotButton.setFont(font); fResourceSnapshotButton.setLayoutData(gd = new GridData()); gd.grabExcessHorizontalSpace = true; gd.horizontalAlignment = GridData.FILL; }
From source file:org.eclipse.datatools.sqltools.internal.sqlscrapbook.connection.FilesConnectionInfoDialog.java
License:Open Source License
/** * Add the selection and deselection buttons to the dialog. * @param composite org.eclipse.swt.widgets.Composite */// ww w. j a va 2 s . c o m private void addSelectionButtons(Composite composite) { Composite buttonComposite = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 0; layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonComposite.setLayout(layout); buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false)); Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, Messages.SELECT_ALL_TITLE, false); SelectionListener listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fTableViewer.setAllChecked(true); checkOK(); } }; selectButton.addSelectionListener(listener); Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, Messages.DESELECT_ALL_TITLE, false); listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fTableViewer.setAllChecked(false); checkOK(); } }; deselectButton.addSelectionListener(listener); _upButton = createButton(buttonComposite, IDialogConstants.CLIENT_ID, Messages.UP_TITLE, false); _downButton = createButton(buttonComposite, IDialogConstants.CLIENT_ID, Messages.DOWN_TITLE, false); _upButton.setEnabled(false); _downButton.setEnabled(false); listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { moveButtonAction(true); checkOK(); checkUpDownStatus(); } }; _upButton.addSelectionListener(listener); listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { moveButtonAction(false); checkOK(); checkUpDownStatus(); } }; _downButton.addSelectionListener(listener); fTableViewer.getTable().addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { checkUpDownStatus(); } }); }
From source file:org.eclipse.dltk.mod.ui.text.completion.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. *//*from ww w .j av a2s . c o m*/ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = DLTKUIPlugin.getActiveWorkbenchShell(); String title = ScriptTextMessages.ContentAssistProcessor_all_disabled_title; String message = ScriptTextMessages.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( ScriptTextMessages.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 org.eclipse.dltk.mod.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, "org.eclipse.dltk.mod.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; } 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 = 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:org.eclipse.dltk.ui.text.completion.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. *///from www .ja v a 2 s .c o m private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = DLTKUIPlugin.getActiveWorkbenchShell(); String title = ScriptTextMessages.ContentAssistProcessor_all_disabled_title; String message = ScriptTextMessages.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( ScriptTextMessages.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 * org.eclipse.dltk.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, "org.eclipse.dltk.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; } 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()) { /* * FIXME Restore default settings in DLTKUIPlugin preferences, * since at the moment this is the only IPreferenceStore these * preferences are read from. */ IPreferenceStore store = DLTKUIPlugin.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:org.eclipse.eavp.viz.visit.VisitPythonDialog.java
License:Open Source License
/** * Create the buttons in the button bar area. Override the parent function * to add the 'Execute' and 'Load from File' buttons and remove the 'Ok' * button./* w ww .j a v a2 s . c o m*/ */ @Override public void createButtonsForButtonBar(Composite parent) { // Create the button to load a script from a file loadButton = createButton(parent, IDialogConstants.CLIENT_ID + 1, "Load from File", false); // Create the button to close the dialog createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); // Create the button to execute the last line in the text area execButton = createButton(parent, IDialogConstants.CLIENT_ID + 2, "Execute", true); // Add selection listeners to these buttons addButtonListeners(); return; }