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:gov.nasa.ensemble.core.plan.editor.MultiPagePlanEditor.java
License:Open Source License
/** * Check to see if this plan was upgraded to the current AD * /*w w w.ja v a 2s . c o m*/ * @param plan the plan being checked * @param workbenchWindow the parent for a warning message dialog * @return true if compatibility feedback is present, false otherwise */ private static boolean checkPlanCompatibility(EPlan plan, IWorkbenchWindow workbenchWindow) { String upgradeNotes = (String) WrapperUtils.getRegistered(plan) .getTransientProperty(EditorPlugin.ATTRIBUTE_UPGRADE_NOTES); if ((upgradeNotes != null) && upgradeNotes.trim().length() > 0) { Shell parent = workbenchWindow.getShell(); String title = "Plan Compatibility"; String message = "The plan has been upgraded to the latest AD."; String version_ad = ActivityDictionary.getInstance().getVersion(); if (version_ad != null) { message += "\nversion: " + version_ad; } URL url = null; if (upgradeNotes.startsWith("http:") || upgradeNotes.endsWith("html")) { try { url = new URL(upgradeNotes); } catch (MalformedURLException e) { // fall out with url = null } } if (url != null) { MessageDialog dialog = new MessageDialog(parent, title, null, message + "\n\nDo you wish to open the report?\n" + upgradeNotes, MessageDialog.INFORMATION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); int result = dialog.open(); if (result == 0) { IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); try { IWebBrowser browser = browserSupport.getExternalBrowser(); browser.openURL(url); } catch (PartInitException e) { MessageDialog.openError(parent, "Error", "Failed to open external browser on URL:\n" + url); } } } else { MessageDialog dialog = new MessageDialog(parent, title, null, message + "\n\n" + upgradeNotes, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); } return true; } return false; }
From source file:gov.redhawk.ide.spd.internal.ui.editor.wizard.OpenAssociatedPerspectiveJob.java
License:Open Source License
/** * Creates the dialog for changing perspectives. * /*www. j a v a 2 s .c o m*/ * @return the {@link MessageDialogWithToggle} to display */ private MessageDialogWithToggle createDialog() { final String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; return new MessageDialogWithToggle(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Open Associated Perspective?", null, "Do you want to open the perspective associated with the " + this.descriptor.getName() + "?", MessageDialog.QUESTION, buttons, 0, "Remember my decision", false); }
From source file:gov.redhawk.ide.ui.wizard.RedhawkImportWizardPage1.java
License:Open Source License
/** * The <code>WizardDataTransfer</code> implementation of this * <code>IOverwriteQuery</code> method asks the user whether the existing * resource at the given path should be overwritten. * //w w w. ja va2s .c om * @param pathString * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, * <code>"ALL"</code>, or <code>"CANCEL"</code> */ public String queryOverwrite(String pathString) { Path path = new Path(pathString); String messageString; // Break the message up if there is a file name and a directory // and there are at least 2 segments. if (path.getFileExtension() == null || path.segmentCount() < 2) { messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString); } else { messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion, path.lastSegment(), path.removeLastSegments(1).toOSString()); } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), IDEWorkbenchMessages.Question, null, messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL }; // run in syncExec because callback is from an operation, // which is probably not running in the UI thread. getControl().getDisplay().syncExec(new Runnable() { public void run() { dialog.open(); } }); return (dialog.getReturnCode() < 0) ? CANCEL : response[dialog.getReturnCode()]; }
From source file:gov.redhawk.ui.editor.SCAFormEditor.java
License:Open Source License
/** * @param monitor// w w w .j av a2 s . c o m */ protected void internalDoValidate(final IProgressMonitor monitor) { // result of the Validation final BasicDiagnostic diagnostic = new BasicDiagnostic(); final List<Resource> resources = new ArrayList<Resource>(); resources.addAll(getEditingDomain().getResourceSet().getResources()); for (final Resource resource : resources) { if (isPersisted(resource)) { for (final EObject obj : resource.getContents()) { this.validator.validate(obj, diagnostic); } } } if (diagnostic.getSeverity() == Diagnostic.ERROR) { final Dialog dialog = new DiagnosticDialog(getSite().getShell(), "Invalid Model", null, diagnostic, Diagnostic.ERROR | Diagnostic.WARNING) { @Override protected Control createMessageArea(final Composite composite) { this.message = "Errors have been detected. Do you want to save anyway?"; return super.createMessageArea(composite); } @Override protected void createButtonsForButtonBar(final Composite parent) { // create OK and Details buttons createButton(parent, IDialogConstants.OK_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.NO_LABEL, true); createDetailsButton(parent); } }; if (dialog.open() != Window.OK) { if (monitor != null) { monitor.setCanceled(true); } throw new OperationCanceledException(); } } }
From source file:gr.aueb.dmst.istlab.unixtools.views.preferences.PreferencesTableView.java
public String handleImportButton() { String filename = null;/* www. j a v a 2s .c o m*/ // ask the user if he/she wants to overwrite the existing table MessageDialog messageDialog = new MessageDialog(getShell(), "Import commands", null, PropertiesLoader.CUSTOM_COMMAND_PAGE_IMPORT_MESSAGE, MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); if (messageDialog.open() == MessageDialog.OK) { // User has selected to open a single file FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); filename = fileDialog.open(); } return filename; }
From source file:net.bioclipse.ui.dialogs.SaveAsDialog.java
License:Open Source License
protected void okPressed() { // Get new path. IPath path = resourceGroup.getContainerFullPath().append(resourceGroup.getResource()); //If the user does not supply a file extension and if the save //as dialog was provided a default file name append the extension //of the default filename to the new name if (path.getFileExtension() == null) { if (originalFile != null && originalFile.getFileExtension() != null) { path = path.addFileExtension(originalFile.getFileExtension()); } else if (originalName != null) { int pos = originalName.lastIndexOf('.'); if (++pos > 0 && pos < originalName.length()) { path = path.addFileExtension(originalName.substring(pos)); }/*from w ww. j a v a 2 s .c o m*/ } } // If the path already exists then confirm overwrite. IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (file.exists()) { String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; String question = NLS.bind(IDEWorkbenchMessages.SaveAsDialog_overwriteQuestion, path.toString()); MessageDialog d = new MessageDialog(getShell(), IDEWorkbenchMessages.Question, null, question, MessageDialog.QUESTION, buttons, 0); int overwrite = d.open(); switch (overwrite) { case 0: // Yes break; case 1: // No return; case 2: // Cancel default: cancelPressed(); return; } } // Store path and close. result = path; close(); }
From source file:net.bioclipse.ui.dialogs.UpdatesAvailableDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default createButton(parent, IDialogConstants.OK_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.NO_LABEL, false); }
From source file:net.refractions.udig.project.ui.internal.SaveDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); }
From source file:net.refractions.udig.ui.dialogs.WizardDataTransferPage.java
License:Open Source License
/** * Displays a Yes/No question to the user with the specified message and returns * the user's response.//w w w . ja va2 s .c om * * @param message the question to ask * @return <code>true</code> for Yes, and <code>false</code> for No */ protected boolean queryYesNoQuestion(String message) { MessageDialog dialog = new MessageDialog(getContainer().getShell(), Messages.WizardDataTransferPage_dialog_title, (Image) null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); // ensure yes is the default return dialog.open() == 0; }
From source file:net.refractions.udig.ui.ZoomingDialog.java
License:Open Source License
public static boolean openQuestionMessage(Rectangle start, Shell parentShell, String dialogTitle, String dialogMessage) {/*from w w w .j av a2 s . c om*/ int result = openMessageDialog(start, parentShell, dialogTitle, null, dialogMessage, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); return result == IDialogConstants.YES_ID; }