List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_TO_ALL_LABEL
String NO_TO_ALL_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_TO_ALL_LABEL.
Click Source Link
From source file:org.jboss.tools.runtime.ui.internal.wizard.DownloadRuntimeOperationUtility.java
License:Open Source License
private static IOverwrite createOverwriteFileQuery() { IOverwrite overwriteQuery = new IOverwrite() { public int overwrite(File file) { final String msg = NLS.bind(Messages.DownloadRuntimesSecondPage_The_file_already_exists, file.getAbsolutePath()); final String[] options = { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }; final int[] retVal = new int[1]; Display.getDefault().syncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(); MessageDialog dialog = new MessageDialog(shell, Messages.DownloadRuntimesSecondPage_Question, null, msg, MessageDialog.QUESTION, options, 0) { protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; }//from w w w .ja v a2 s . c o m }; dialog.open(); retVal[0] = dialog.getReturnCode(); } }); return retVal[0]; } }; return overwriteQuery; }
From source file:org.jboss.tools.windup.ui.internal.wizards.WindupReportExportWizardPage1.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. * //from w w w . j a v a 2s . c o m * @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(Messages.WindupReportExport_question_fileExists, pathString); } else { messageString = NLS.bind(Messages.WindupReportExport_question_overwriteNameAndPath, path.lastSegment(), path.removeLastSegments(1).toOSString()); } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), Messages.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:org.symbian.tools.wrttools.wizards.projectimport.WrtProjectLocationWizardPage.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. * * @param pathString/*from www. j a va 2 s. c o m*/ * @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); if (path.segmentCount() > 1 && ".settings".equals(path.segment(1))) { return NO; } 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:spritey.ui.wizards.SpriteSheetWizard.java
License:Open Source License
@Override public boolean performFinish() { isOverwrite = saveAsPage.isOverwrite(); OverwriteQuery callback = new OverwriteQuery() { @Override//from ww w .java 2s.co m 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:uk.ac.gda.ui.dialog.MessageDialogHelper.java
License:Open Source License
/** * Convenience method to open a simple Yes/YesToAll/No/NoToAll question dialog. * /*from w ww . 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; } }