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:com.technophobia.substeps.editor.preferences.page.SubstepsPropertyPage.java
License:Open Source License
private ConfirmationStatus getConfirmationStatus(final IPath previousPath, final IPath newPath, final SubstepsFolderChangedListener folderChangeListener) { final MessageDialog messageDialog = new MessageDialog(getShell(), "Confirm", null, folderChangeListener.confirmationMessage(previousPath, newPath), MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);//www .j a v a2s . c o m final int status = messageDialog.open(); return ConfirmationStatus.values()[status]; }
From source file:com.toedter.e4.demo.contacts.swt.views.DetailsView.java
License:Open Source License
@Inject public void setSelection(@Optional Contact contact) { if (contact != null) { if (dirtyable.isDirty()) { MessageDialog dialog = new MessageDialog(detailComposite.getShell(), "Save vCard", null, "The current vCard has been modified. Save changes?", MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); dialog.create();//from w w w .j av a2 s . c om if (engine != null) { ThemeUtil.applyDialogStyles(engine, dialog.getShell()); } if (dialog.open() == Window.OK) { ParameterizedCommand saveCommand = commandService.createCommand("contacts.save", Collections.EMPTY_MAP); handlerService.executeHandler(saveCommand); } } updatePartTitle(contact); } else { uiItem.setLabel("Details"); } dirtyable.setDirty(false); detailComposite.update(contact); }
From source file:com.trivadis.loganalysis.ui.internal.dialog.DeleteFileDialog.java
License:Open Source License
public DeleteFileDialog(IFileDescriptor file, Shell shell) { super(shell, getTitle(file), null, getMessage(file), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); setShellStyle(getShellStyle() | SWT.SHEET); }
From source file:com.twinsoft.convertigo.eclipse.dialogs.MultipleDeletionDialog.java
License:Open Source License
public MultipleDeletionDialog(Shell shell, String title, boolean hasMultiple) { this.title = title; this.shell = shell; this.hasMultiple = hasMultiple; if (hasMultiple) { buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; } else {//w w w.java 2 s. co m buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; } }
From source file:com.vectrace.MercurialEclipse.wizards.ProjectsImportPage.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 w ww . j a v a2s . c om * @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 = "'" + pathString + "' already exists. Would you like to overwrite it?"; } else { messageString = "Overwrite '" + path.lastSegment() + "' in folder '" + path.removeLastSegments(1).toOSString() + "'?"; } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), "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) { @Override protected int getShellStyle() { // TODO add "| SWT.SHEET" flag as soon as we drop Eclipse 3.4 support 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:com.windowtester.eclipse.ui.target.NewTargetProvisionerPage.java
License:Open Source License
protected boolean queryYesNoQuestion(String message) { MessageDialog dialog = new MessageDialog(getContainer().getShell(), "Question", (Image) null, message, MessageDialog.NONE, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); // ensure yes is the default return dialog.open() == 0; }
From source file:de.fhg.igd.swingrcp.ComponentMessageDialog.java
License:Open Source License
/** * @see MessageDialog#getButtonLabels(int) *//*from ww w . j av a2 s .c o m*/ static String[] getButtonLabels(int kind) { String[] dialogButtonLabels; switch (kind) { case ERROR: case INFORMATION: case WARNING: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; break; } case CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; break; } case QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ } } return dialogButtonLabels; }
From source file:de.fraunhofer.esk.ernest.core.cdt.wizards.GenerateSimulationWizard.java
License:Open Source License
@Override public boolean performFinish() { /* Initializing */ final String projName = this.page.getProjName(); final String projPath = this.page.getLocation() + "/" + this.page.getProjName(); final String projTool = "MinGW GCC"; /* If Project/Folder with this name already exists in path, ask override question (message dialog) */ if (new java.io.File(projPath).exists()) { final MessageDialog dg = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), UI_USERMSG_TITLE, null, UI_USERMSG_EXISTQST, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); /* override dialog returns * in case "yes" 0/*from w w w . j a v a 2 s . co m*/ * in case "no" 1 */ if (dg.open() == 1) { return false; } } /* * ProgressMonitor, work parted in * 70% GenerateSimulationProject * 30% runGenerator */ try { this.getContainer().run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(UI_MONITOR_MAINTASKNAME, 100000); /* Generate Project */ if (!new GenerateSimulationProject().createSimulationProj(projName, projPath, monitor, 70000, projTool)) { return; } if (monitor.isCanceled()) { return; } /* Execute Generator */ try { GenerateSimulationWizard.this.runGenerator(GenerateSimulationWizard.this.file, projPath, monitor, 30000); } catch (CoreException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } /* End Monitor */ monitor.done(); } }); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return true; }
From source file:de.ovgu.featureide.examples.wizards.ExampleNewWizardPage.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 va 2 s .com*/ * @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 = pathString + " already exists. Would you like to overwrite it?"; } else { messageString = "Overwrite " + path.lastSegment() + " in folder " + path.removeLastSegments(1).toOSString() + " ?"; } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), "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); // 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:de.sebastianbenz.task.ui.editor.ExtLinkedXtextEditor.java
License:Open Source License
@Override protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell();//from ww w .ja 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(ExtLinkedFileHelper.AUTOLINK_PROJECT_NAME)) { final IEditorInput newInput; IDocumentProvider provider = getDocumentProvider(); // 1. If file is "untitled" suggest last save location // 2. ...otherwise use the file's location (i.e. likely to be a rename in same folder) // 3. If a "last save location" is unknown, use user's home // String suggestedName = null; String suggestedPath = null; { // is it "untitled" java.net.URI uri = ((IURIEditorInput) input).getURI(); String tmpProperty = null; try { tmpProperty = ((IFileEditorInput) input).getFile() .getPersistentProperty(TmpFileStoreEditorInput.UNTITLED_PROPERTY); } catch (CoreException e) { // ignore - tmpProperty will be null } boolean isUntitled = tmpProperty != null && "true".equals(tmpProperty); // suggested name IPath oldPath = URIUtil.toPath(uri); // TODO: input.getName() is probably always correct suggestedName = isUntitled ? input.getName() : oldPath.lastSegment(); // suggested path try { suggestedPath = isUntitled ? ((IFileEditorInput) input).getFile().getWorkspace().getRoot() .getPersistentProperty(LAST_SAVEAS_LOCATION) : oldPath.toOSString(); } catch (CoreException e) { // ignore, suggestedPath will be null } if (suggestedPath == null) { // get user.home suggestedPath = System.getProperty("user.home"); } } FileDialog dialog = new FileDialog(shell, SWT.SAVE); if (suggestedName != null) dialog.setFileName(suggestedName); if (suggestedPath != null) dialog.setFilterPath(suggestedPath); dialog.setFilterExtensions(new String[] { "*.todo", "*.taskpaper", "*.*" }); 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, "Save As", null, path + " already exists.\nDo you want to replace it?", 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) { String title = "Problems During Save As..."; String msg = "Save could not be completed. " + 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 = linkedFileHelper.obtainLink(uri, false); newInput = new FileEditorInput(linkedFile); } if (provider == null) { // editor has 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) { final IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { String title = "Problems During Save As..."; String msg = "Save could not be completed. " + x.getMessage(); MessageDialog.openError(shell, title, msg); } } finally { provider.changed(newInput); if (success) setInput(newInput); // the linked file must be removed (esp. if it is an "untitled" link). linkedFileHelper.unlinkInput(((IFileEditorInput) input)); // remember last saveAs location String lastLocation = URIUtil.toPath(((FileEditorInput) newInput).getURI()).toOSString(); try { ((FileEditorInput) newInput).getFile().getWorkspace().getRoot() .setPersistentProperty(LAST_SAVEAS_LOCATION, lastLocation); } catch (CoreException e) { // ignore } } if (progressMonitor != null) progressMonitor.setCanceled(!success); return; } super.performSaveAs(progressMonitor); }