List of usage examples for org.eclipse.jface.dialogs IDialogConstants YES_LABEL
String YES_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants YES_LABEL.
Click Source Link
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; }//w w w. j a va 2 s . co m 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; }// www . j a v a 2 s .co 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. * //from www . j a v a 2 s. c o 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; } }
From source file:ummisco.gama.ui.commands.RefreshHandler.java
void checkLocationDeleted(final IProject project) throws CoreException { if (!project.exists()) { return;/*from w ww .ja v a2s. c om*/ } final IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI()); if (!location.exists()) { final String message = NLS.bind(IDEWorkbenchMessages.RefreshAction_locationDeletedMessage, project.getName(), location.toString()); final MessageDialog dialog = new MessageDialog(WorkbenchHelper.getShell(), IDEWorkbenchMessages.RefreshAction_dialogTitle, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) { @Override protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; WorkbenchHelper.run(() -> dialog.open()); // Do the deletion back in the operation thread if (dialog.getReturnCode() == 0) { // yes was chosen project.delete(true, true, null); } } }
From source file:ummisco.gama.ui.navigator.actions.RefreshAction.java
License:Open Source License
/** * Checks whether the given project's location has been deleted. If so, prompts the user with whether to delete the * project or not.// ww w . j av a 2 s.c o m */ void checkLocationDeleted(final IProject project) throws CoreException { if (!project.exists()) { return; } final IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI()); if (!location.exists()) { final String message = NLS.bind(IDEWorkbenchMessages.RefreshAction_locationDeletedMessage, project.getName(), location.toString()); final MessageDialog dialog = new MessageDialog(WorkbenchHelper.getShell(), IDEWorkbenchMessages.RefreshAction_dialogTitle, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) { @Override protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; WorkbenchHelper.run(() -> dialog.open()); // Do the deletion back in the operation thread if (dialog.getReturnCode() == 0) { // yes was chosen project.delete(true, true, null); } } }
From source file:zigen.plugin.db.ui.dialogs.MessageDialogWithToggle2.java
License:Open Source License
public static MessageDialogWithToggle2 open(Shell parent, String title, String message, String toggleMessage, boolean toggleState, String toggleMessage2, boolean toggleState2) { MessageDialogWithToggle2 dialog = new MessageDialogWithToggle2(parent, title, null, // accept the default window icon message, QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, // yes is the default toggleMessage, toggleState); dialog.toggleMessage2 = toggleMessage2; dialog.toggleState2 = toggleState2;/*from w w w . java 2 s .com*/ dialog.open(); return dialog; }