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.wesnoth.ui.editor.WMLEditor.java
License:Open Source License
@Override protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell();/*from ww w . j a va 2 s .c o m*/ final IEditorInput input = getEditorInput(); // Customize save as if the file is linked, and it is in the special // external link project // if (input instanceof IFileEditorInput && ((IFileEditorInput) input).getFile().isLinked() && ((IFileEditorInput) input).getFile().getProject().getName().equals(AUTOLINK_PROJECT_NAME)) { final IEditorInput newInput; IDocumentProvider provider = getDocumentProvider(); FileDialog dialog = new FileDialog(shell, SWT.SAVE); IPath oldPath = URIUtil.toPath(((IURIEditorInput) input).getURI()); if (oldPath != null) { dialog.setFileName(oldPath.lastSegment()); dialog.setFilterPath(oldPath.toOSString()); } dialog.setFilterExtensions(new String[] { "*.b3", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$ String path = dialog.open(); if (path == null) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } // Check whether file exists and if so, confirm overwrite final File localFile = new File(path); if (localFile.exists()) { MessageDialog overwriteDialog = new MessageDialog(shell, Messages.WMLEditor_0, null, path + Messages.WMLEditor_1, MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); // 'No' is the // default if (overwriteDialog.open() != Window.OK) { if (progressMonitor != null) { progressMonitor.setCanceled(true); return; } } } IFileStore fileStore; try { fileStore = EFS.getStore(localFile.toURI()); } catch (CoreException ex) { Logger.getInstance().logException(ex); String title = Messages.WMLEditor_2; String msg = Messages.WMLEditor_3 + ex.getMessage(); MessageDialog.openError(shell, title, msg); return; } IFile file = getWorkspaceFile(fileStore); if (file != null) { newInput = new FileEditorInput(file); } else { IURIEditorInput uriInput = new FileStoreEditorInput(fileStore); java.net.URI uri = uriInput.getURI(); IFile linkedFile = obtainLink(uri); newInput = new FileEditorInput(linkedFile); } if (provider == null) { // editor has programmatically been closed while the dialog was // open return; } boolean success = false; try { provider.aboutToChange(newInput); provider.saveDocument(progressMonitor, newInput, provider.getDocument(input), true); success = true; } catch (CoreException x) { Logger.getInstance().logException(x); final IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { String title = Messages.WMLEditor_4; String msg = Messages.WMLEditor_5 + x.getMessage(); MessageDialog.openError(shell, title, msg); } } finally { provider.changed(newInput); if (success) { setInput(newInput); } } if (progressMonitor != null) { progressMonitor.setCanceled(!success); } return; } super.performSaveAs(progressMonitor); }
From source file:org.wso2.developerstudio.eclipse.platform.ui.dialogs.TrustCertificateDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); createButton(parent, TEMP_ALLOW_ID, "Allow this once", false); }
From source file:org.xmind.cathy.internal.CathyWorkbenchAdvisor.java
License:Open Source License
private int promptToSaveOnClose(IWorkbenchWindow window, IWorkbenchPage page, IEditorPart editor) { if (editor instanceof ISaveablePart2) { int answer = ((ISaveablePart2) editor).promptToSaveOnClose(); if (answer != ISaveablePart2.DEFAULT) return answer; }/*from w w w .j a v a 2 s.co m*/ page.activate(editor); MessageDialog dialog = new MessageDialog(window.getShell(), DialogMessages.Save_title, null, NLS.bind(WorkbenchMessages.PromptSaveEditorOnClosing_message, editor.getTitle()), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); int answerIndex = dialog.open(); switch (answerIndex) { case 0: return ISaveablePart2.YES; case 1: return ISaveablePart2.NO; default: return ISaveablePart2.CANCEL; } }
From source file:org.xwalk.ide.eclipse.xdt.wizards.export.ExportProjectWizard.java
License:Apache License
private void showDialog() { MessageDialog dialog = new MessageDialog(getShell(), "Export Error", null, "Android SDK or Crosswalk path have not been set correctly. Go on setting it now?", 1, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); switch (dialog.open()) { case 0:/*from w ww . j a va 2 s . co m*/ showQuickPreferenceDialog(); break; case 1: break; } }
From source file:org2.eclipse.php.internal.debug.core.launching.PHPLaunchUtilities.java
License:Open Source License
/** * Returns true in case a first line breakpoint should hit on a JIT remote sessions that have no reference in the * launch view. This method will prompt the user in case the option is set in the Debug preferences. * /*ww w .j a va2s . c o m*/ * @param remoteIP * A remote IP to display when displaying the message. * @return True, if a JIT first line breakpoint should be set; False, otherwise. * @since Aptana PHP 1.1 */ public static boolean shouldBreakOnJitFirstLine(final String remoteIP) { final IPreferenceStore store = PHPDebugEPLPlugin.getDefault().getPreferenceStore(); String option = store.getString(IPHPDebugCorePreferenceKeys.BREAK_ON_FIRST_LINE_FOR_UNKNOWN_JIT); if (MessageDialogWithToggle.ALWAYS.equals(option)) { return true; } else if (MessageDialogWithToggle.PROMPT.equals(option)) { final DialogResultHolder resultHolder = new DialogResultHolder(); Display.getDefault().syncExec(new Runnable() { public void run() { Shell shell = getActiveShell(); MessageDialogWithToggle dialog = new PHPLaunchUtilities.BlinkingMessageDialogWithToggle(shell, PHPDebugCoreMessages.Debugger_incomingDebuggerJitRequestTitle, null, NLS.bind(PHPDebugCoreMessages.Debugger_incomingDebuggerJitRequest, new Object[] { remoteIP }), MessageDialogWithToggle.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, PHPDebugCoreMessages.PHPLaunchUtilities_rememberDecision, false); dialog.setPrefStore(store); dialog.setPrefKey(IPHPDebugCorePreferenceKeys.BREAK_ON_FIRST_LINE_FOR_UNKNOWN_JIT); dialog.open(); resultHolder.setReturnCode(dialog.getReturnCode()); } }); if (resultHolder.getReturnCode() == IDialogConstants.YES_ID) { return true; } } return false; }
From source file:sernet.verinice.rcp.InfoDialogWithShowToggle.java
License:Open Source License
public static InfoDialogWithShowToggle openYesNoCancelQuestion(Shell parent, String title, String message, String toggleMessage, IPreferenceStore store, String key) { InfoDialogWithShowToggle dialog = new InfoDialogWithShowToggle(parent, title, null, // accept the default window icon message, QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0, // YES_LABEL is the default (first entry of array) toggleMessage, false);//from ww w .jav a 2 s. co m dialog.setPrefStore(store); dialog.setPrefKey(key); boolean open = true; if (dialog.getPrefStore() != null && dialog.getPrefKey() != null && dialog.getPrefStore().contains(dialog.getPrefKey())) { open = !dialog.getPrefStore().getBoolean(dialog.getPrefKey()); } if (open) { dialog.open(); } else { dialog.setReturnCode(IDialogConstants.YES_ID); } return dialog; }
From source file:spritey.ui.wizards.SpriteSheetWizard.java
License:Open Source License
@Override public boolean performFinish() { isOverwrite = saveAsPage.isOverwrite(); OverwriteQuery callback = new OverwriteQuery() { @Override// w ww .j ava2 s. c om public int queryOverwrite(String path) { if (isOverwrite) { return OverwriteQuery.ALL; } String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }; File file = new File(path); String message = NLS.bind(Messages.SAVE_AS_OVERWRITE_FILE, file.getName(), file.getParent()); final MessageDialog dialog = new MessageDialog(getShell(), Messages.SPRITE_SHEET_WIZARD_TITLE, null, message, MessageDialog.QUESTION, buttons, 0) { @Override protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; // This method is called from a non-UI thread, therefore, // opening dialog has to be wrapped into runnable and executed // in the UI thread. getShell().getDisplay().syncExec(new Runnable() { @Override public void run() { dialog.open(); } }); return dialog.getReturnCode(); } }; try { SaveSheetOperation op = new SaveSheetOperation(newSheetPage.getConstraints(), newSheetPage.getSheet(), saveAsPage.getImageFile(), saveAsPage.getMetadataFile(), callback); getContainer().run(true, true, op); Shell parent = getContainer().getShell(); IStatus status = op.getStatus(); if (!status.isOK()) { // To make dialogs consistent throughout the application, // display a custom error dialog with details button only when // there are multiple problems. Otherwise display an OS native // dialog. if (status.isMultiStatus()) { ErrorDialog.openError(parent, Messages.SPRITE_SHEET_WIZARD_TITLE, null, status); } else { MessageDialog.open(MessageDialog.ERROR, parent, Messages.SPRITE_SHEET_WIZARD_TITLE, status.getMessage(), SWT.SHEET); } } else { MessageDialog.open(MessageDialog.INFORMATION, parent, Messages.SPRITE_SHEET_WIZARD_TITLE, Messages.SPRITE_SHEET_WIZARD_BUILT_SUCCESSFULLY, SWT.SHEET); } } catch (InterruptedException e) { return false; } catch (InvocationTargetException e) { throw new InternalError("Error occurred during save operation.", e); } return false; }
From source file:tinyos.dlrc.jobs.InvokeMakeJob.java
License:Open Source License
public void execShouldContinue() { Display.getDefault().syncExec(new Runnable() { public void run() { IStatus ready = target.ready(); if (ready != null) { int type = -1; String title = null; String message = null; switch (ready.getSeverity()) { case IStatus.ERROR: title = "Error"; message = "an error"; type = MessageDialog.ERROR; break; case IStatus.WARNING: title = "Warning"; message = "a warning"; type = MessageDialog.WARNING; break; case IStatus.INFO: title = "Info"; message = "a message"; type = MessageDialog.INFORMATION; break; }/*from w w w .j a v a 2 s . c om*/ if (type >= 0) { message = "There is " + message + " associated with this make-option:\n\n" + "'" + ready.getMessage() + "'\n\n" + "Would you like to continue anyway?"; MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), title, null, message, type, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); if (dialog.open() != 0) { shouldContinue = false; } } } } }); }
From source file:ts.eclipse.ide.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 w w w . j a va2 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) { 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) { // JavaScriptPlugin.log(e); return false; } if (doBuild) { // CoreUtility.getBuildJob(fProject).schedule(); } } return true; }
From source file:uk.ac.gda.ui.dialog.MessageDialogHelper.java
License:Open Source License
/** * Convenience method to open a simple Yes/YesToAll/No/NoToAll question dialog. * /* w ww .j ava 2 s . co m*/ * @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>Answer.YES</code>, <code>Answer.YES_TO_ALL</code>, <code>Answer.NO</code>, * <code>Answer.NO_TO_ALL</code> corresponding to the pressed button. Or <code>Answer.DEFAULT</code> * if dialog.open() returns <code>SWT.DEFAULT</code> */ public static Answer openYesNoToAll(Shell parent, String title, String message) { String[] buttonlabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL }; MessageDialog dialog = new MessageDialog(parent, title, null, message, MessageDialog.QUESTION, buttonlabels, 0); switch (dialog.open()) { case 0: return Answer.YES; case 1: return Answer.YES_TO_ALL; case 2: return Answer.NO; case 3: return Answer.NO_TO_ALL; default: return Answer.DEFAULT; } }