List of usage examples for org.eclipse.jface.dialogs IDialogConstants CLOSE_ID
int CLOSE_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants CLOSE_ID.
Click Source Link
From source file:com.centurylink.mdw.plugin.designer.dialogs.ArchivedProcessSaveDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, respondingToClose ? "Save" : "OK", false); if (respondingToClose) { Button dontSaveButton = createButton(parent, IDialogConstants.CLOSE_ID, "Don't Save", true); dontSaveButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { dontSavePressed();// w w w .j av a 2 s . com } }); dontSaveButton.forceFocus(); } Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, !respondingToClose); if (!respondingToClose) cancelButton.forceFocus(); }
From source file:com.centurylink.mdw.plugin.designer.dialogs.ProcessSaveDialog.java
License:Apache License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, respondingToClose ? "Save" : "OK", true); if (respondingToClose) { Button dontSaveButton = createButton(parent, IDialogConstants.CLOSE_ID, "Don't Save", false); dontSaveButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { dontSavePressed();/*from w ww .j a v a 2 s. c om*/ } }); } createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:com.google.dart.tools.ui.internal.text.dart.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 ava 2 s . c om*/ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = DartToolsPlugin.getActiveWorkbenchShell(); String title = DartTextMessages.ContentAssistProcessor_all_disabled_title; String message = DartTextMessages.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( DartTextMessages.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.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); } /* * @see com.google.dart.tools.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; } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = DartToolsPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) { PreferencesUtil.createPreferenceDialogOn(shell, "com.google.dart.tools.ui.internal.preferences.CodeAssistPreferenceAdvanced", null, //$NON-NLS-1$ null).open(); } CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:com.google.gapid.views.WelcomeDialog.java
License:Apache License
public static void showWelcomeDialog(Shell shell, Models models, Widgets widgets) { new DialogBase(shell, widgets.theme) { private Button showWelcome; @Override//from w w w . j av a 2 s . com public String getTitle() { return Messages.WELCOME_TITLE; } @Override protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = createComposite(area, new GridLayout(1, false)); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createLabel(container, "", widgets.theme.dialogLogo()) .setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false)); Label title = createLabel(container, Messages.WELCOME_TEXT); title.setFont(widgets.theme.bigBoldFont()); title.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false)); Label version = createLabel(container, "Version " + GAPID_VERSION.toFriendlyString()); version.setForeground(widgets.theme.welcomeVersionColor()); version.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false)); createLink(container, "<a>Open Trace...</a>", e -> { close(true); showOpenTraceDialog(shell, models); }); String[] files = models.settings.getRecent(); if (files.length > 0) { createLink(container, "<a>Open Recent...</a>", e -> { Menu popup = new Menu(container); for (String file : models.settings.recentFiles) { createMenuItem(popup, file, 0, ev -> { close(true); models.capture.loadCapture(new File(file)); }); } popup.addListener(SWT.Hide, ev -> scheduleIfNotDisposed(popup, popup::dispose)); popup.setLocation(container.toDisplay(bottomLeft(((Link) e.widget).getBounds()))); popup.setVisible(true); }); } createLink(container, "<a>Capture Trace...</a>", e -> { close(true); showTracingDialog(shell, models, widgets); }); createLink(container, "<a>Help...</a>", e -> showHelp()); showWelcome = Widgets.createCheckbox(container, "Show on startup", !models.settings.skipWelcomeScreen); return area; } @Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); } @Override protected void buttonPressed(int buttonId) { close(buttonId == IDialogConstants.CLOSE_ID); } private void close(boolean saveState) { if (saveState) { models.settings.skipWelcomeScreen = !showWelcome.getSelection(); } close(); } }.open(); }
From source file:com.microsoft.tfs.client.common.ui.dialogs.workspaces.WorkspacesDialog.java
License:Open Source License
@Override protected void buttonPressed(final int buttonId) { if (IDialogConstants.CLOSE_ID == buttonId) { setReturnCode(buttonId);/*from www. j a va 2 s . c om*/ close(); } else { super.buttonPressed(buttonId); } }
From source file:com.microsoft.tfs.client.common.ui.dialogs.workspaces.WorkspacesDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(final Composite parent) { if (workspaceRequired) { final Button okButton = createButton(parent, IDialogConstants.OK_ID, Messages.getString("WorkspacesDialog.UseWorkspaceButtonText"), //$NON-NLS-1$ true);/* w w w. j av a 2 s . c o m*/ createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false); new ButtonValidatorBinding(okButton).bind(control); } else { createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); } }
From source file:com.nokia.tools.s60.editor.ui.dialogs.LayerPropertiesDialog.java
License:Open Source License
@Override protected void buttonPressed(int buttonId) { if (IDialogConstants.CLOSE_ID == buttonId) { closePressed();/*from w w w. java 2s .com*/ } else if (IDialogConstants.OK_ID == buttonId) { try { String oldName = layer.getName(); layer.setName(layerName.getText()); if (project != null) { if (ColorGroupsStore.isEnabled) { ColorGroupsStore.changeLayerNameIfPresent(project, layer.getParent().getId(), oldName, layerName.getText()); } } } catch (Exception e) { } super.buttonPressed(buttonId); } else { super.buttonPressed(buttonId); } }
From source file:com.nokia.tools.theme.s60.ui.dialogs.KeyPairsDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false); }
From source file:com.nokia.tools.theme.s60.ui.dialogs.KeyPairsDialog.java
License:Open Source License
protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.CLOSE_ID) { setMessage(null);//from w w w . ja v a 2s. c om this.close(); } super.buttonPressed(buttonId); }
From source file:com.nokia.traceviewer.dialog.TraceActivationDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // Create load button Button loadButton = createButton(parent, LOAD_BUTTON_ID, Messages.getString("TraceActivationDialog.LoadButtonText"), false); //$NON-NLS-1$ loadButton.setToolTipText(Messages.getString("TraceActivationDialog.LoadButtonToolTip")); //$NON-NLS-1$ // Create save button Button saveButton = createButton(parent, SAVE_BUTTON_ID, Messages.getString("TraceActivationDialog.SaveButtonText"), false); //$NON-NLS-1$ saveButton.setToolTipText(Messages.getString("TraceActivationDialog.SaveButtonToolTip")); //$NON-NLS-1$ // Activate button Button activateButton = createButton(parent, ACTIVATE_BUTTON_ID, Messages.getString("TraceActivationDialog.ActivateButtonText"), true); //$NON-NLS-1$ activateButton.setToolTipText(Messages.getString("TraceActivationDialog.ActivateButtonToolTip")); //$NON-NLS-1$ // Close button createButton(parent, IDialogConstants.CLOSE_ID, Messages.getString("TraceActivationDialog.CloseButton"), //$NON-NLS-1$ false);/*from w w w . j a v a 2 s . co m*/ }