List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_LABEL
String NO_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_LABEL.
Click Source Link
From source file:org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock.java
License:Open Source License
protected boolean processChanges(IWorkbenchPreferenceContainer container) { IScopeContext currContext = fLookupOrder[0]; List<Key> changedOptions = new ArrayList<Key>(); boolean needsBuild = getChanges(currContext, changedOptions); if (changedOptions.isEmpty()) { return true; }//from ww w. j ava 2 s. c o m if (needsBuild) { int count = getRebuildCount(); if (count > fRebuildCount) { needsBuild = false; // build already requested fRebuildCount = count; } } boolean doBuild = false; if (needsBuild) { String[] strings = getFullBuildDialogStrings(fProject == null); if (strings != null) { if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length == 0) { doBuild = true; // don't bother the user } else { MessageDialog dialog = new MessageDialog(getShell(), strings[0], null, strings[1], MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); int res = dialog.open(); if (res == 0) { doBuild = true; } else if (res != 1) { return false; // cancel pressed } } } } if (container != null) { // no need to apply the changes to the original store: will be done by the page container if (doBuild) { // post build incrementRebuildCount(); container.registerUpdateJob(CoreUtility.getBuildJob(fProject)); } } else { // apply changes right away try { fManager.applyChanges(); } catch (BackingStoreException e) { JavaPlugin.log(e); return false; } if (doBuild) { CoreUtility.getBuildJob(fProject).schedule(); } } return true; }
From source file:org.eclipse.jdt.internal.ui.preferences.ProblemSeveritiesConfigurationBlock.java
License:Open Source License
@Override protected void validateSettings(Key changedKey, String oldValue, String newValue) { if (!areSettingsEnabled()) { return;/*from w w w . java 2s. c o m*/ } if (changedKey != null) { if (PREF_PB_UNUSED_PARAMETER.equals(changedKey) || PREF_PB_DEPRECATION.equals(changedKey) || PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) || PREF_15_PB_INCOMPLETE_ENUM_SWITCH.equals(changedKey) || PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey) || PREF_PB_SUPPRESS_WARNINGS.equals(changedKey) || PREF_ANNOTATION_NULL_ANALYSIS.equals(changedKey)) { updateEnableStates(); } if (checkValue(PREF_ANNOTATION_NULL_ANALYSIS, ENABLED) && (PREF_ANNOTATION_NULL_ANALYSIS.equals(changedKey) || PREF_PB_NULL_REFERENCE.equals(changedKey) || PREF_PB_POTENTIAL_NULL_REFERENCE.equals(changedKey) || PREF_PB_NULL_SPECIFICATION_VIOLATION.equals(changedKey) || PREF_PB_POTENTIAL_NULL_ANNOTATION_INFERENCE_CONFLICT.equals(changedKey))) { boolean badNullRef = lessSevere(getValue(PREF_PB_NULL_REFERENCE), getValue(PREF_PB_NULL_SPECIFICATION_VIOLATION)); boolean badPotNullRef = lessSevere(getValue(PREF_PB_POTENTIAL_NULL_REFERENCE), getValue(PREF_PB_POTENTIAL_NULL_ANNOTATION_INFERENCE_CONFLICT)); boolean ask = false; ask |= badNullRef && (PREF_PB_NULL_REFERENCE.equals(changedKey) || PREF_PB_NULL_SPECIFICATION_VIOLATION.equals(changedKey)); ask |= badPotNullRef && (PREF_PB_POTENTIAL_NULL_REFERENCE.equals(changedKey) || PREF_PB_POTENTIAL_NULL_ANNOTATION_INFERENCE_CONFLICT.equals(changedKey)); ask |= (badNullRef || badPotNullRef) && PREF_ANNOTATION_NULL_ANALYSIS.equals(changedKey); if (ask) { final Combo comboBoxNullRef = getComboBox(PREF_PB_NULL_REFERENCE); final Label labelNullRef = fLabels.get(comboBoxNullRef); int highlightNullRef = getHighlight(labelNullRef); final Combo comboBoxPotNullRef = getComboBox(PREF_PB_POTENTIAL_NULL_REFERENCE); final Label labelPotNullRef = fLabels.get(comboBoxPotNullRef); int highlightPotNullRef = getHighlight(labelPotNullRef); getShell().getDisplay().asyncExec(new Runnable() { public void run() { highlight(comboBoxNullRef.getParent(), labelNullRef, comboBoxNullRef, HIGHLIGHT_FOCUS); highlight(comboBoxPotNullRef.getParent(), labelPotNullRef, comboBoxPotNullRef, HIGHLIGHT_FOCUS); } }); MessageDialog messageDialog = new MessageDialog(getShell(), PreferencesMessages.ProblemSeveritiesConfigurationBlock_adapt_null_pointer_access_settings_dialog_title, null, PreferencesMessages.ProblemSeveritiesConfigurationBlock_adapt_null_pointer_access_settings_dialog_message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); messageDialog.create(); Shell messageShell = messageDialog.getShell(); messageShell.setLocation(messageShell.getLocation().x, getShell().getLocation().y + 40); if (messageDialog.open() == 0) { if (badNullRef) { setValue(PREF_PB_NULL_REFERENCE, getValue(PREF_PB_NULL_SPECIFICATION_VIOLATION)); updateCombo(getComboBox(PREF_PB_NULL_REFERENCE)); } if (badPotNullRef) { setValue(PREF_PB_POTENTIAL_NULL_REFERENCE, getValue(PREF_PB_POTENTIAL_NULL_ANNOTATION_INFERENCE_CONFLICT)); updateCombo(getComboBox(PREF_PB_POTENTIAL_NULL_REFERENCE)); } } highlight(comboBoxNullRef.getParent(), labelNullRef, comboBoxNullRef, highlightNullRef); highlight(comboBoxPotNullRef.getParent(), labelPotNullRef, comboBoxPotNullRef, highlightPotNullRef); } } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) { // merging the two options setValue(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, newValue); } else if (INTR_DEFAULT_NULL_ANNOTATIONS.equals(changedKey)) { if (ENABLED.equals(newValue)) { setValue(PREF_NULLABLE_ANNOTATION_NAME, NULL_ANNOTATIONS_DEFAULTS[0]); setValue(PREF_NONNULL_ANNOTATION_NAME, NULL_ANNOTATIONS_DEFAULTS[1]); setValue(PREF_NONNULL_BY_DEFAULT_ANNOTATION_NAME, NULL_ANNOTATIONS_DEFAULTS[2]); } else { openNullAnnotationsConfigurationDialog(); } } else { return; } } else { updateEnableStates(); updateNullAnnotationsSetting(); } }
From source file:org.eclipse.jsch.internal.ui.authenticator.WorkbenchUserAuthenticator.java
License:Open Source License
public int prompt(IJSchLocation location, final int promptType, final String title, final String message, final int[] promptResponses, final int defaultResponse) { final Display display = getStandardDisplay(); final int[] retval = new int[1]; final String[] buttons = new String[promptResponses.length]; for (int i = 0; i < promptResponses.length; i++) { int prompt = promptResponses[i]; switch (prompt) { case IUserAuthenticator.OK_ID: buttons[i] = IDialogConstants.OK_LABEL; break; case IUserAuthenticator.CANCEL_ID: buttons[i] = IDialogConstants.CANCEL_LABEL; break; case IUserAuthenticator.NO_ID: buttons[i] = IDialogConstants.NO_LABEL; break; case IUserAuthenticator.YES_ID: buttons[i] = IDialogConstants.YES_LABEL; break; }//from ww w . j a v a 2 s.c o m } display.syncExec(new Runnable() { public void run() { final MessageDialog dialog = new MessageDialog(new Shell(display), title, null, message, promptType, buttons, 1); retval[0] = dialog.open(); } }); return retval[0]; }
From source file:org.eclipse.jsch.ui.UserInfoPrompter.java
License:Open Source License
private int prompt(final int promptType, final String title, final String message, final int[] promptResponses, final int defaultResponse) { final Display display = getStandardDisplay(); final int[] retval = new int[1]; final String[] buttons = new String[promptResponses.length]; for (int i = 0; i < promptResponses.length; i++) { int prompt = promptResponses[i]; switch (prompt) { case IDialogConstants.OK_ID: buttons[i] = IDialogConstants.OK_LABEL; break; case IDialogConstants.CANCEL_ID: buttons[i] = IDialogConstants.CANCEL_LABEL; break; case IDialogConstants.NO_ID: buttons[i] = IDialogConstants.NO_LABEL; break; case IDialogConstants.YES_ID: buttons[i] = IDialogConstants.YES_LABEL; break; }/* w w w. jav a 2 s . c om*/ } display.syncExec(new Runnable() { public void run() { final MessageDialog dialog = new MessageDialog(new Shell(display), title, null /* title image */, message, promptType, buttons, defaultResponse); retval[0] = dialog.open(); } }); return retval[0]; }
From source file:org.eclipse.jst.j2ee.internal.dialogs.ListMessageDialog.java
License:Open Source License
/** * Convenience method to open a simple Yes/No question dialog. * //from www . j a va 2s . c om * @param parent * the parent shell of the dialog, or <code>null</code> if none * @param title * the dialog's title, or <code>null</code> if none * @param message * the message * @return <code>true</code> if the user presses the OK button, <code>false</code> otherwise */ public static boolean openQuestion(Shell parent, String title, String message, String[] items) { ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default // window icon message, QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, items); // yes // is // the // default return dialog.open() == 0; }
From source file:org.eclipse.jubula.client.ui.rcp.properties.ProjectGeneralPropertyPage.java
License:Open Source License
/** * creates and opens a dialog if a search for the deprecated Modules * should be done/*from w w w . j ava 2s . c o m*/ * @return the boolean if the search should be done */ private boolean openSearchForDeprecatedDialog() { MessageDialog mdiag = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.ProjectPropertyPageSearchForDeprProjModuleTitle, null, Messages.ProjectPropertyPageSearchForDeprProjModuleMsg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); mdiag.create(); Plugin.getHelpSystem().setHelp(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ContextHelpIds.SEARCH_FOR_DEPRECATED_MODULES_DIALOG); return (mdiag.open() == Window.OK); }
From source file:org.eclipse.jubula.client.ui.utils.OpenViewUtils.java
License:Open Source License
/** * /* w w w.j a v a 2 s. c o m*/ * @param preferenceKey * the key for the preference to save the remembered value to * @param activeWindow * the active {@link IWorkbenchWindow} * @param preferenceStore * the instance of the {@link IPreferenceStore} * @param viewName * the name of the view to activate * @return the return value of the dialog {@link IDialogConstants#NO_ID}, * {@link IDialogConstants#YES_ID} or <code>-1</code> if aborted */ private static int createQuestionDialog(final String preferenceKey, IWorkbenchWindow activeWindow, final IPreferenceStore preferenceStore, String viewName) { MessageDialogWithToggle dialog = new MessageDialogWithToggle(activeWindow.getShell(), Messages.UtilsOpenViewTitle, null, NLS.bind(Messages.UtilsViewQuestion, viewName), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, Messages.UtilsRemember, false) { /** * {@inheritDoc} */ protected void buttonPressed(int buttonId) { super.buttonPressed(buttonId); int val = Constants.UTILS_PROMPT; if (getToggleState() && getReturnCode() == IDialogConstants.NO_ID) { val = Constants.UTILS_NO; } else if (getToggleState() && getReturnCode() == IDialogConstants.YES_ID) { val = Constants.UTILS_YES; } preferenceStore.setValue(preferenceKey, val); } }; dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); int i = dialog.open(); return i; }
From source file:org.eclipse.linuxtools.internal.docker.ui.launch.BuildDockerImageShortcutSWTBotTest.java
License:Open Source License
@Test @RunWithProject("foo") public void shouldNotBuildDockerImageOnSecondCallWhenAllConnectionWereRemoved() throws InterruptedException, com.spotify.docker.client.DockerException, IOException { // given/*from w w w . ja v a 2 s.co m*/ final DockerClient client = MockDockerClientFactory.build(); final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client) .withDefaultTCPConnectionSettings(); DockerConnectionManagerUtils.configureConnectionManager(dockerConnection); // when SWTUtils.asyncExec(() -> getRunAsdockerImageBuildContextMenu("foo", "Dockerfile").click()); // then expect a dialog, fill the "repository" text field and click "Ok" assertThat(bot.shell(WizardMessages.getString("ImageBuildDialog.title"))).isNotNull(); bot.textWithLabel(WizardMessages.getString("ImageBuildDialog.repoNameLabel")).setText("foo/bar:latest"); // when launching the build SWTUtils.syncExec(() -> { bot.button("OK").click(); }); // then the 'DockerConnection#buildImage(...) method should have been // called within the specified timeout Mockito.verify(client, Mockito.timeout((int) TimeUnit.SECONDS.toMillis(30)).times(1)).build( Matchers.any(Path.class), Matchers.any(String.class), Matchers.any(ProgressHandler.class), Matchers.anyVararg()); // when trying to call again after connection was removed, there should // be an error dialog DockerConnectionManager.getInstance().removeConnection(dockerConnection); SWTUtils.asyncExec(() -> getRunAsdockerImageBuildContextMenu("foo", "Dockerfile").click(), false); final SWTBotShell shell = bot.shell("Edit Configuration"); assertThat(shell).isNotNull(); assertThat(shell.bot().button("Run").isEnabled()).isFalse(); // closing the wizard SWTUtils.asyncExec(() -> { shell.bot().button(IDialogConstants.CLOSE_LABEL).click(); }, false); // do not save the config while closing SWTUtils.syncExec(() -> { bot.button(IDialogConstants.NO_LABEL).click(); }); }
From source file:org.eclipse.lsp4e.ui.LanguageServerPreferencePage.java
License:Open Source License
private void createStaticServersTable(Composite res) { Link staticServersIntro = new Link(res, SWT.WRAP); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).span(2, 1).hint(400, SWT.DEFAULT) .applyTo(staticServersIntro); staticServersIntro.setText(Messages.PreferencesPage_staticServers); staticServersIntro.addSelectionListener(this.contentTypeLinkListener); checkboxViewer = CheckboxTableViewer.newCheckList(res, SWT.NONE); checkboxViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); checkboxViewer.setContentProvider(new ArrayContentProvider()); TableViewerColumn enablementColumn = new TableViewerColumn(checkboxViewer, SWT.NONE); enablementColumn.getColumn().setText(Messages.PreferencesPage_Enabled); enablementColumn.getColumn().setWidth(70); enablementColumn.setLabelProvider(new ColumnLabelProvider() { @Override// w w w . ja v a 2 s . co m public String getText(Object element) { return null; } }); TableViewerColumn contentTypeColumn = new TableViewerColumn(checkboxViewer, SWT.NONE); contentTypeColumn.getColumn().setText(Messages.PreferencesPage_contentType); contentTypeColumn.getColumn().setWidth(200); contentTypeColumn.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((ContentTypeToLanguageServerDefinition) element).getKey().getName(); } }); TableViewerColumn launchConfigColumn = new TableViewerColumn(checkboxViewer, SWT.NONE); launchConfigColumn.getColumn().setText(Messages.PreferencesPage_languageServer); launchConfigColumn.getColumn().setWidth(300); launchConfigColumn.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((ContentTypeToLanguageServerDefinition) element).getValue().label; } }); List<ContentTypeToLanguageServerDefinition> contentTypeToLanguageServerDefinitions = registry .getContentTypeToLSPExtensions(); if (contentTypeToLanguageServerDefinitions.stream() .anyMatch(definition -> definition.getEnablementCondition() != null)) { TableViewerColumn conditionColumn = new TableViewerColumn(checkboxViewer, SWT.NONE); conditionColumn.getColumn().setText(Messages.PreferencesPage_enablementCondition); conditionColumn.getColumn().setWidth(150); conditionColumn.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { EnablementTester tester = ((ContentTypeToLanguageServerDefinition) element) .getEnablementCondition(); if (tester == null) { // table does not support mnemonic return Action.removeMnemonics(IDialogConstants.NO_LABEL); } String extensionStatus = ((ContentTypeToLanguageServerDefinition) element).isExtensionEnabled() ? Messages.PreferencePage_enablementCondition_true : Messages.PreferencePage_enablementCondition_false; return tester.getDescription() + " (" + extensionStatus + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } @Override public Color getBackground(Object element) { EnablementTester tester = ((ContentTypeToLanguageServerDefinition) element) .getEnablementCondition(); if (tester == null) { return null; } Color red = Display.getDefault().getSystemColor(SWT.COLOR_RED); Color green = Display.getDefault().getSystemColor(SWT.COLOR_GREEN); return ((ContentTypeToLanguageServerDefinition) element).isExtensionEnabled() ? green : red; } }); } checkboxViewer.setInput(contentTypeToLanguageServerDefinitions); checkboxViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); checkboxViewer.getTable().setHeaderVisible(true); checkboxViewer.getTable().setLinesVisible(true); this.checkboxViewer.setCheckedElements(contentTypeToLanguageServerDefinitions.stream() .filter(definition -> definition.isUserEnabled()).toArray()); checkboxViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getElement() instanceof ContentTypeToLanguageServerDefinition) { ContentTypeToLanguageServerDefinition contentTypeToLanguageServerDefinition = (ContentTypeToLanguageServerDefinition) event .getElement(); contentTypeToLanguageServerDefinition.setUserEnabled(event.getChecked()); changedDefinitions.add(contentTypeToLanguageServerDefinition); } } }); }
From source file:org.eclipse.lsp4e.ui.LoggingPreferencePage.java
License:Open Source License
@Override public boolean performOk() { if (hasLoggingBeenChanged) { applyLoggingEnablment();// ww w . j a va 2 s .c o m MessageDialog dialog = new MessageDialog(getShell(), Messages.PreferencesPage_restartWarning_title, null, Messages.PreferencesPage_restartWarning_message, MessageDialog.WARNING, new String[] { IDialogConstants.NO_LABEL, Messages.PreferencesPage_restartWarning_restart }, 1); if (dialog.open() == 1) { PlatformUI.getWorkbench().restart(); } } return super.performOk(); }