List of usage examples for org.eclipse.jface.dialogs MessageDialog WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs MessageDialog WARNING.
Click Source Link
From source file:org.eclipse.emf.compare.ide.ui.internal.actions.save.SaveComparisonModelAction.java
License:Open Source License
/** * {@inheritDoc}/*from w w w .j a va 2 s . c o m*/ * * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { Shell parent = configuration.getContainer().getWorkbenchPart().getSite().getShell(); FileDialog fileDialog = new FileDialog(parent, SWT.SAVE); File file = new File(fileDialog.open()); if (file.exists()) { MessageDialog messageDialog = new MessageDialog(parent, "File already exists", null, "File \"" + file.toString() + "\" already exists. Do you want to replace the existing one?", MessageDialog.WARNING, DIALOG_BUTTON_LABELS.toArray(new String[0]), 1); int open = messageDialog.open(); if (open == DIALOG_BUTTON_LABELS.indexOf("Replace")) { saveComparison(file); } // else do nothing } else { saveComparison(file); } super.run(); }
From source file:org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.SaveComparisonModelAction.java
License:Open Source License
/** * {@inheritDoc}// w w w.jav a 2 s .c om * * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { Shell parent = getShell(); FileDialog fileDialog = new FileDialog(parent, SWT.SAVE); String filePath = fileDialog.open(); if (filePath != null) { File file = new File(filePath); if (file.exists()) { MessageDialog messageDialog = new MessageDialog(parent, "File already exists", null, "File \"" + file.toString() + "\" already exists. Do you want to replace the existing one?", MessageDialog.WARNING, DIALOG_BUTTON_LABELS.toArray(new String[DIALOG_BUTTON_LABELS.size()]), 1); int open = messageDialog.open(); if (open == DIALOG_BUTTON_LABELS.indexOf("Replace")) { saveComparison(file); refreshLocation(filePath); } // else do nothing } else { saveComparison(file); refreshLocation(filePath); } } super.run(); }
From source file:org.eclipse.emf.compare.mpatch.extension.MPatchApplicationResult.java
License:Open Source License
/** * Show a dialog with some user friendly version of the application results. * /*from www. ja v a2 s.com*/ * @param shell * The shell. * @param adapterFactory * An adapter factory for some formatting ;-) */ public void showDialog(Shell shell, AdapterFactory adapterFactory) { final String msg = getMessage(adapterFactory); final int messageDialogType; // overall result if (ApplicationStatus.SUCCESSFUL.equals(status)) { messageDialogType = MessageDialog.INFORMATION; } else if (ApplicationStatus.REFERENCES.equals(status)) { messageDialogType = MessageDialog.WARNING; } else if (ApplicationStatus.FAILURE.equals(status)) { messageDialogType = MessageDialog.ERROR; } else { throw new IllegalStateException("Unknown result status!"); } // show the actual dialog MessageDialog.open(messageDialogType, shell, MPatchConstants.MPATCH_SHORT_NAME + " Application results", msg, SWT.NONE); }
From source file:org.eclipse.emf.diffmerge.ui.util.InconsistencyDialog.java
License:Open Source License
/** * Constructor// ww w . j a va 2 s .com * @param shell_p a non-null shell * @param comparison_p a non-null comparison */ public InconsistencyDialog(Shell shell_p, IComparison comparison_p) { super(shell_p, EMFDiffMergeUIPlugin.LABEL, null, Messages.InconsistencyDialog_DuplicateIDs, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0); _comparison = comparison_p; setShellStyle(getShellStyle() | SWT.RESIZE); }
From source file:org.eclipse.emf.ecp.edit.spi.swt.reference.AddReferenceAction.java
License:Open Source License
private MessageDialog getContainmentWarningDialog() { return new MessageDialog(null, LocalizationServiceHelper/* ww w . j a v a 2s . c om*/ .getString(AddReferenceAction.class, ReferenceMessageKeys.AddReferenceAction_Confirmation), null, LocalizationServiceHelper .getString(AddReferenceAction.class, ReferenceMessageKeys.AddReferenceAction_Warning), MessageDialog.WARNING, new String[] { LocalizationServiceHelper.getString(AddReferenceAction.class, ReferenceMessageKeys.AddReferenceAction_Yes), LocalizationServiceHelper.getString(AddReferenceAction.class, ReferenceMessageKeys.AddReferenceAction_No) }, 0); }
From source file:org.eclipse.emf.ecp.edit.spi.swt.reference.NewReferenceAction.java
License:Open Source License
private MessageDialog getContainmentWarningDialog() { return new MessageDialog(null, LocalizationServiceHelper/*from www . j a v a 2s . c om*/ .getString(NewReferenceAction.class, ReferenceMessageKeys.NewReferenceAction_Confirmation), null, LocalizationServiceHelper .getString(NewReferenceAction.class, ReferenceMessageKeys.NewReferenceAction_Warning), MessageDialog.WARNING, new String[] { LocalizationServiceHelper.getString(NewReferenceAction.class, ReferenceMessageKeys.NewReferenceAction_Yes), LocalizationServiceHelper.getString(NewReferenceAction.class, ReferenceMessageKeys.NewReferenceAction_No) }, 0); }
From source file:org.eclipse.epf.library.ui.LibraryUIManager.java
License:Open Source License
private boolean postOpenLibrary(List<Exception> errors, String libPath) { try {//from ww w . j av a 2 s. c o m if (errors.isEmpty()) { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbenchWindow != null) { IWorkbenchPage activePage = workbenchWindow.getActivePage(); if (activePage != null) { activePage.closeAllEditors(false); } } return true; } else { Iterator<Exception> iter = errors.iterator(); while (iter.hasNext()) { Exception e = iter.next(); if (e instanceof IOException) { String message = e.getMessage(); if (message.startsWith("###")) { //$NON-NLS-1$ String projectFileName = message.substring(3); String prompt = LibraryUIResources.bind(LibraryUIResources.readOnlyProjectFile_text, projectFileName); String[] buttonLabels = { LibraryUIResources.retryButton_text, LibraryUIResources.cancelButton_text }; MessageDialog msgBox = new MessageDialog(Display.getCurrent().getActiveShell(), LibraryUIResources.openLibraryWizard_title, null, prompt, MessageDialog.WARNING, buttonLabels, 0); if (msgBox.open() == 0) { return openLibrary(libPath); } else { return true; } } } else { Throwable ex = e; for (ex = e; ex != null && !(ex instanceof MessageException); ex = ex.getCause()) ; String msg = ex != null && ex.getMessage() != null ? ex.getMessage() : e.getMessage() != null ? e.getMessage() : e.toString(); LibraryUIPlugin.getDefault().getMsgDialog() .displayError(LibraryUIResources.openLibraryWizard_title, msg, e); } } } } catch (Exception e) { LibraryUIPlugin.getDefault().getLogger().logError(e); } return false; }
From source file:org.eclipse.epp.internal.logging.aeri.ui.ReportDialog.java
License:Open Source License
public ReportDialog(Shell parentShell, Settings settings, ServerConfiguration configuration, IObservableList errors, EventBus bus) { super(parentShell, "An Error Was Logged", null, "We noticed a new error event was logged. Such error events may reveal issues in the Eclipse codebase, and thus we kindly ask you to report them to eclipse.org.", MessageDialog.WARNING, new String[] { "Send", "Don't Send" }, 0); setShellStyle(SWT.MODELESS | SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX); setBlockOnOpen(false);//from www. j av a 2s .c o m this.settings = settings; this.configuration = configuration; this.errors = errors; }
From source file:org.eclipse.equinox.internal.p2.ui.dialogs.InstallWizard.java
License:Open Source License
public IStatus getCurrentStatus() { IStatus originalStatus = super.getCurrentStatus(); int sev = originalStatus.getSeverity(); // Use the previously computed status if the user cancelled or if we were already in error. // If we don't have an operation or a plan, we can't check this condition either, so just // use the normal status. if (sev == IStatus.CANCEL || sev == IStatus.ERROR || operation == null || operation.getProvisioningPlan() == null) { return originalStatus; }//from ww w. jav a2 s. c om // Does the plan require install handler support? installHandlerStatus = UpdateManagerCompatibility.getInstallHandlerStatus(operation.getProvisioningPlan()); if (!installHandlerStatus.isOK()) { // Set the status into the wizard. This ensures future calls to this method won't // repeat the work (and prompting). couldNotResolveStatus = installHandlerStatus; // Is the update manager installer present? If so, offer to open it. // In either case, the failure will be reported in this wizard. if (ProvUI.isUpdateManagerInstallerPresent()) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { Shell shell = ProvUI.getDefaultParentShell(); MessageDialog dialog = new MessageDialog(shell, ProvUIMessages.Policy_RequiresUpdateManagerTitle, null, ProvUIMessages.Policy_RequiresUpdateManagerMessage, MessageDialog.WARNING, new String[] { ProvUIMessages.LaunchUpdateManagerButton, IDialogConstants.CANCEL_LABEL }, 0); if (dialog.open() == 0) BusyIndicator.showWhile(shell.getDisplay(), new Runnable() { public void run() { UpdateManagerCompatibility.openInstaller(); } }); } }); } return installHandlerStatus; } return originalStatus; }
From source file:org.eclipse.gyrex.admin.ui.internal.widgets.NonBlockingMessageDialogs.java
License:Open Source License
private static String[] getButtonLabels(final int kind) { String[] dialogButtonLabels;//from w w w.j av a 2s. c o m switch (kind) { case MessageDialog.ERROR: case MessageDialog.INFORMATION: case MessageDialog.WARNING: { dialogButtonLabels = new String[] { IDialogConstants.get().OK_LABEL }; break; } case MessageDialog.CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.get().OK_LABEL, IDialogConstants.get().CANCEL_LABEL }; break; } case MessageDialog.QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.get().YES_LABEL, IDialogConstants.get().NO_LABEL }; break; } case MessageDialog.QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.get().YES_LABEL, IDialogConstants.get().NO_LABEL, IDialogConstants.get().CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); } } return dialogButtonLabels; }