List of usage examples for org.eclipse.jface.dialogs MessageDialog ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs MessageDialog ERROR.
Click Source Link
From source file:org.eclipse.jst.j2ee.internal.actions.J2EEDeployAction.java
License:Open Source License
private void displayMessageDialog(String message, Shell shell) { String title = J2EEUIMessages.getResourceString("DEPLOY_DIALOG_TITLE"); //$NON-NLS-1$ MessageDialog dialog = new MessageDialog(shell, title, null /* default image */, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open();/* w ww . j a v a2s. c om*/ }
From source file:org.eclipse.linuxtools.rpm.speceditor.rcp.DelayedEventsProcessor.java
License:Open Source License
private void openFile(Display display, final String path) { display.asyncExec(new Runnable() { public void run() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return; File f = new File(path); if (!f.isDirectory()) { try { IWorkbenchPage page = window.getActivePage(); IDE.openEditor(page, f.toURI(), "org.eclipse.linuxtools.rpm.rcp.editor1", true); // $NON-NLS-1$ } catch (PartInitException e) { }/*from w w w . ja va2 s . c o m*/ } else { String msg = RPMMessages.CannotOpen + path.toString(); MessageDialog.open(MessageDialog.ERROR, window.getShell(), RPMMessages.InitialOpen, msg, SWT.SHEET); } } }); }
From source file:org.eclipse.m2e.core.ui.internal.util.M2EUIUtils.java
License:Open Source License
/** * @param shell//www. j ava 2s . c o m * @param string * @param string2 * @param updateErrors */ public static void showErrorsForProjectsDialog(final Shell shell, final String title, final String message, final Map<String, Throwable> errorMap) { // TODO Auto-generated method showErrorsForProjectsDialog Display.getDefault().asyncExec(new Runnable() { public void run() { String[] buttons = { IDialogConstants.OK_LABEL }; int ok_button = 0; M2EErrorDialog errDialog = new M2EErrorDialog(shell, title, Dialog.getImage(Dialog.DLG_IMG_MESSAGE_ERROR), message, MessageDialog.ERROR, buttons, ok_button, errorMap); errDialog.create(); errDialog.open(); } }); }
From source file:org.eclipse.m2e.editor.pom.FormUtils.java
License:Open Source License
private static FormHoverProvider.Execute createDefaultPerformer(final ScrolledForm form, final String message, final String ttip, final int severity) { if (ttip != null && ttip.length() > 0 && message != null) { return new FormHoverProvider.Execute() { public void run(Point point) { int dialogSev = IMessageProvider.ERROR == severity ? MessageDialog.ERROR : MessageDialog.WARNING; MavenMessageDialog.openWithSeverity(form.getShell(), Messages.FormUtils_error_info, Messages.FormUtils_pom_error, ttip, dialogSev); }//from www . j a v a 2 s . c om }; } return null; }
From source file:org.eclipse.m2e.refactoring.internal.SaveDirtyFilesDialog.java
License:Open Source License
public static boolean saveDirtyFiles(String mask) { boolean result = true; // TODO (cs) add support for save automatically Shell shell = Display.getCurrent().getActiveShell(); IEditorPart[] dirtyEditors = getDirtyEditors(mask); if (dirtyEditors.length > 0) { result = false;/*from w w w. ja v a 2 s. c om*/ SaveDirtyFilesDialog saveDirtyFilesDialog = new SaveDirtyFilesDialog(shell); saveDirtyFilesDialog.setInput(Arrays.asList(dirtyEditors)); // Save all open editors. if (saveDirtyFilesDialog.open() == Window.OK) { result = true; int numDirtyEditors = dirtyEditors.length; for (int i = 0; i < numDirtyEditors; i++) { dirtyEditors[i].doSave(null); } } else { MessageDialog dlg = new MessageDialog(shell, Messages.SaveDirtyFilesDialog_title_error, null, ALL_MODIFIED_RESOURCES_MUST_BE_SAVED_BEFORE_THIS_OPERATION, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dlg.open(); } } return result; }
From source file:org.eclipse.mylyn.internal.reviews.ui.dialogs.CommentInputDialog.java
License:Open Source License
private void processServerError(final String message) { Display.getDefault().syncExec(new Runnable() { public void run() { final MessageDialog dialog = new MessageDialog(null, Messages.CommentInputDialog_ServerError, null, message, MessageDialog.ERROR, new String[] { IDialogConstants.CANCEL_LABEL }, 0); dialog.open();/*from w ww. j av a2 s.c o m*/ } }); }
From source file:org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal.java
License:Open Source License
private static void displayStatus(Shell shell, final String title, final IStatus status, boolean showLinkToErrorLog) { // avoid blocking ui when in test mode if (CoreUtil.TEST_MODE) { StatusHandler.log(status);//from w ww . j a v a 2 s . co m return; } if (status instanceof RepositoryStatus && ((RepositoryStatus) status).isHtmlMessage()) { WebBrowserDialog.openAcceptAgreement(shell, title, status.getMessage(), ((RepositoryStatus) status).getHtmlMessage()); } else { String message = status.getMessage(); if (message == null || message.trim().length() == 0) { message = Messages.TasksUiInternal_An_unknown_error_occurred; } if (message.length() > 256) { message = message.substring(0, 256) + "..."; //$NON-NLS-1$ } if (showLinkToErrorLog) { message += "\n\n" + Messages.TasksUiInternal_See_error_log_for_details; //$NON-NLS-1$ } switch (status.getSeverity()) { case IStatus.CANCEL: case IStatus.INFO: createDialog(shell, title, message, MessageDialog.INFORMATION).open(); break; case IStatus.WARNING: createDialog(shell, title, message, MessageDialog.WARNING).open(); break; case IStatus.ERROR: default: createDialog(shell, title, message, MessageDialog.ERROR).open(); break; } } }
From source file:org.eclipse.ocl.examples.xtext.base.ui.wizards.AbstractFileNewWizardPage.java
License:Open Source License
/** * Creates a new complete OCL file resource in the selected container and * with the selected name. Creates any missing resource containers along the * path; does nothing if the container resources already exist. * <p>//from ww w . j av a 2 s . c o m * In normal usage, this method is invoked after the user has pressed Finish * on the wizard; the enablement of the Finish button implies that all * controls on on this page currently contain valid values. * </p> * <p> * Note that this page caches the new complete OCL file once it has been * successfully created; subsequent invocations of this method will answer * the same file resource without attempting to create it again. * </p> * <p> * This method should be called within a workspace modify operation since it * creates resources. * </p> * * @return the created file resource, or <code>null</code> if the file was * not created */ public IFile createNewFile() { if (newFile != null) { return newFile; } // create the new complete OCL file and cache it if successful newFile = dialog.getNewFile(); final InputStream initialContents = getInitialContents(); IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { CreateFileOperation op = new CreateFileOperation(newFile, null, initialContents, wizard.getNewFileLabel()); try { op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell())); } catch (final ExecutionException e) { getContainer().getShell().getDisplay().syncExec(new Runnable() { public void run() { if (e.getCause() instanceof CoreException) { ErrorDialog.openError(getContainer().getShell(), BaseUIMessages.NewWizardPage_errorTitle, null, // no special // message ((CoreException) e.getCause()).getStatus()); } else { Activator.log(getClass(), "createNewFile()", e.getCause()); //$NON-NLS-1$ MessageDialog.openError(getContainer().getShell(), BaseUIMessages.NewWizardPage_internalErrorTitle, NLS.bind(BaseUIMessages.NewWizardPage_internalErrorTitle, e.getCause().getMessage())); } } }); } } }; try { getContainer().run(true, true, op); } catch (InterruptedException e) { return null; } catch (InvocationTargetException e) { // Execution Exceptions are handled above but we may still get // unexpected runtime errors. Activator.log(getClass(), "createNewFile()", e.getTargetException()); //$NON-NLS-1$ MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), BaseUIMessages.NewWizardPage_internalErrorTitle, NLS.bind(BaseUIMessages.NewWizardPage_internalErrorMessage, e.getTargetException().getMessage()), SWT.SHEET); return null; } return newFile; }
From source file:org.eclipse.ocl.xtext.base.ui.wizards.AbstractFileNewWizardPage.java
License:Open Source License
/** * Creates a new complete OCL file resource in the selected container and * with the selected name. Creates any missing resource containers along the * path; does nothing if the container resources already exist. * <p>/*from w w w . ja v a 2s .com*/ * In normal usage, this method is invoked after the user has pressed Finish * on the wizard; the enablement of the Finish button implies that all * controls on on this page currently contain valid values. * </p> * <p> * Note that this page caches the new complete OCL file once it has been * successfully created; subsequent invocations of this method will answer * the same file resource without attempting to create it again. * </p> * <p> * This method should be called within a workspace modify operation since it * creates resources. * </p> * * @return the created file resource, or <code>null</code> if the file was * not created */ public IFile createNewFile() { if (newFile != null) { return newFile; } // create the new complete OCL file and cache it if successful newFile = dialog.getNewFile(); final InputStream initialContents = getInitialContents(); IRunnableWithProgress op = new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) { CreateFileOperation op = new CreateFileOperation(newFile, null, initialContents, wizard.getNewFileLabel()); try { op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell())); } catch (final ExecutionException e) { getContainer().getShell().getDisplay().syncExec(new Runnable() { @Override public void run() { if (e.getCause() instanceof CoreException) { ErrorDialog.openError(getContainer().getShell(), BaseUIMessages.NewWizardPage_errorTitle, null, // no special // message ((CoreException) e.getCause()).getStatus()); } else { BaseUiPluginHelper.log(getClass(), "createNewFile()", e.getCause()); //$NON-NLS-1$ MessageDialog.openError(getContainer().getShell(), BaseUIMessages.NewWizardPage_internalErrorTitle, NLS.bind(BaseUIMessages.NewWizardPage_internalErrorTitle, e.getCause().getMessage())); } } }); } } }; try { getContainer().run(true, true, op); } catch (InterruptedException e) { return null; } catch (InvocationTargetException e) { // Execution Exceptions are handled above but we may still get // unexpected runtime errors. BaseUiPluginHelper.log(getClass(), "createNewFile()", e.getTargetException()); //$NON-NLS-1$ MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), BaseUIMessages.NewWizardPage_internalErrorTitle, NLS.bind(BaseUIMessages.NewWizardPage_internalErrorMessage, e.getTargetException().getMessage()), SWT.SHEET); return null; } return newFile; }
From source file:org.eclipse.oomph.setup.internal.installer.Installer.java
License:Open Source License
public boolean handleMissingIndex(Shell shell) { int answer = new MessageDialog(shell, "Network Problem", null, "The catalog could not be loaded. Please ensure that you have network access and, if needed, have configured your network proxy.", MessageDialog.ERROR, new String[] { "Retry", "Configure Network Proxy...", "Exit" }, 0).open(); switch (answer) { case 1: {/*from w w w . ja va 2 s . co m*/ new NetworkConnectionsDialog(shell).open(); } //$FALL-THROUGH$ case 0: { ResourceSet resourceSet = getResourceSet(); URI currentIndexLocation = resourceSet.getURIConverter().normalize(SetupContext.INDEX_SETUP_URI); ECFURIHandlerImpl.clearExpectedETags(); reloadIndex(currentIndexLocation); return true; } default: { return false; } } }