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:org.eclipse.php.formatter.ui.preferences.ModifyDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { fApplyButton = createButton(parent, IDialogConstants.CLIENT_ID, FormatterMessages.ModifyDialog_apply_button, false);//w w w.j a v a 2 s. c om fApplyButton.setEnabled(false); 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.plugin.kpax.beaninspector.gui.BindingDialog.java
License:Apache License
@Override protected void createButtonsForButtonBar(Composite parent) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); okButton.setToolTipText(Messages.BindingDialog_tooltip_ok); applyButton = createButton(parent, IDialogConstants.CLIENT_ID, Messages.BindingDialog_label_apply, false); applyButton.setToolTipText(Messages.BindingDialog_tooltip_apply); applyButton.addSelectionListener(new ApplySelectionListener()); applyButton.setEnabled(false);//from ww w. j a va 2s . c o m resetButton = createButton(parent, IDialogConstants.CLIENT_ID, Messages.BindingDialog_label_reset, false); resetButton.addSelectionListener(new ResetSelectionListener()); resetButton.setToolTipText(Messages.BindingDialog_tooltip_reset); resetButton.setEnabled(!Settings.getSettings().isDefault() || getBeanType() != null); }
From source file:org.eclipse.tracecompass.internal.lttng2.control.ui.views.dialogs.LoadDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); Button manageButton = createButton(parent, IDialogConstants.CLIENT_ID + 1, Messages.TraceControl_ManageButtonText, false); manageButton.addSelectionListener(new SelectionAdapter() { @Override// w w w. j a v a 2 s . c o m public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(parent.getShell(), ControlRemoteProfilesPreferencePage.ID, new String[] { ControlRemoteProfilesPreferencePage.ID }, null); dialog.open(); if (fLocalComposite != null) { fFolderViewer.setInput(LTTngProfileViewer.getViewerInput()); enableLocalButtons(); } } }); Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false); button.setEnabled(false); }
From source file:org.eclipse.tracecompass.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 ww w . j av a2 s. co 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(0)); fMaxText.getParent().layout(true); } @Override public void widgetDefaultSelected(SelectionEvent e) { // nothing to do } }); }
From source file:org.eclipse.wst.jsdt.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. * //from www . j av a 2 s . c o m * */ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = JavaScriptPlugin.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.wst.jsdt.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); // 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); } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = JavaScriptPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.wst.jsdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor.java
License:Open Source License
/** * <p>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.</p> * * @return <code>true</code> if the default should be restored *//*from ww w . j av a2 s. c o m*/ private boolean informUserAboutEmptyDefaultCategory() { /*If warn about empty default category and there are associated properties for this * processors content type and those properties have an associated properties page then * display warning message to user. */ ICompletionProposalCategoriesConfigurationReader properties = CompletionProposoalCatigoriesConfigurationRegistry .getDefault().getReadableConfiguration(this.fContentTypeID); if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY) && properties instanceof ICompletionProposalCategoriesConfigurationWriter && ((ICompletionProposalCategoriesConfigurationWriter) properties).hasAssociatedPropertiesPage()) { ICompletionProposalCategoriesConfigurationWriter propertiesExtension = (ICompletionProposalCategoriesConfigurationWriter) properties; final Shell shell = SSEUIPlugin.getActiveWorkbenchShell(); String title = SSEUIMessages.ContentAssist_all_disabled_title; String message = SSEUIMessages.ContentAssist_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = NLS.bind(SSEUIMessages.ContentAssist_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) */ 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); // 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); } }; int returnValue = dialog.open(); //based on user actions either reset defaults or open preference dialog if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { propertiesExtension.loadDefaults(); propertiesExtension.saveConfiguration(); } if (settingsId == returnValue) { PreferencesUtil .createPreferenceDialogOn(shell, propertiesExtension.getPropertiesPageID(), null, null) .open(); } return true; } } return false; }
From source file:org.eclipse.xtend.ide.formatting.preferences.FormatterModifyDialog.java
License:Open Source License
@Override @SuppressWarnings("rawtypes") protected Control createDialogArea(Composite parent) { if (isOldAPIVersion()) { return super.createDialogArea(parent); }/* w w w.j ava 2 s. c o m*/ try { // copied from Eclipse Oxygen to support old dialog in Eclipse Photon final Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); Composite nameComposite = new Composite(composite, SWT.NONE); nameComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); nameComposite.setLayout(new GridLayout(3, false)); // use reflection to not break API Field fProfileNameField = ModifyDialog.class.getDeclaredField("fProfileNameField"); fProfileNameField.setAccessible(true); StringDialogField f = new StringDialogField(); fProfileNameField.set(this, f); f.setLabelText("&Profile name:"); f.setText(fProfile.getName()); f.getLabelControl(nameComposite).setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); f.getTextControl(nameComposite).setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); f.setDialogFieldListener(new IDialogFieldListener() { @Override public void dialogFieldChanged(DialogField field) { try { Method doValidate = ModifyDialog.class.getDeclaredMethod("doValidate"); doValidate.setAccessible(true); doValidate.invoke(FormatterModifyDialog.this); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { XtendActivator.getInstance().getLog() .log(new Status(IStatus.ERROR, XtendActivator.PLUGIN_ID, e.getMessage(), e)); } } }); // use reflection to not break API Field fSaveButton = ModifyDialog.class.getDeclaredField("fSaveButton"); fSaveButton.setAccessible(true); fSaveButton.set(this, createButton(nameComposite, IDialogConstants.CLIENT_ID + 1, "E&xport...", false)); fTabFolder = new TabFolder(composite, SWT.NONE); fTabFolder.setFont(composite.getFont()); fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // use reflection to not break API Field fWorkingValues = ModifyDialog.class.getDeclaredField("fWorkingValues"); fWorkingValues.setAccessible(true); addPages((Map) fWorkingValues.get(this)); applyDialogFont(composite); fTabFolder.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { } @Override public void widgetSelected(SelectionEvent e) { final TabItem tabItem = (TabItem) e.item; final IModifyDialogTabPage page = (IModifyDialogTabPage) tabItem.getData(); fDialogSettings.put(fKeyLastFocus, fTabPages.indexOf(page)); page.makeVisible(); } }); // use reflection to not break API Method doValidate = ModifyDialog.class.getDeclaredMethod("doValidate"); doValidate.setAccessible(true); doValidate.invoke(this); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getHelpContextId()); return composite; } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException | NoSuchFieldException e) { XtendActivator.getInstance().getLog() .log(new Status(IStatus.ERROR, XtendActivator.PLUGIN_ID, e.getMessage(), e)); return null; } }
From source file:org.fornax.cartridges.sculptor.framework.richclient.login.LoginDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { Button removeCurrentUser = createButton(parent, IDialogConstants.CLIENT_ID, Messages.LoginDialog_delete, false);// ww w .j a va 2s . c o m removeCurrentUser.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { savedDetails.remove(userIdText.getText()); initializeUsers(""); //$NON-NLS-1$ } }); createButton(parent, IDialogConstants.OK_ID, Messages.LoginDialog_ok, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.cpu.actions.FindDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { findButton = createButton(parent, IDialogConstants.CLIENT_ID, Messages.findButtonLabel, true); findButton.addSelectionListener(new SelectionAdapter() { @Override/*from w ww . j a v a 2 s . c om*/ public void widgetSelected(SelectionEvent e) { doFind(); } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false); }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.mbean.InvokeDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { Button invokeButton = createButton(parent, IDialogConstants.CLIENT_ID, Messages.invokeButtonLabel, true); invokeButton.addSelectionListener(new SelectionAdapter() { @Override//from w w w. ja va2 s . c o m public void widgetSelected(SelectionEvent e) { invoke(); } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false); }