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.jboss.tools.windup.ui.internal.wizards.WindupReportExportWizardPage1.java
License:Open Source License
/** * Display an error dialog with the specified message. * //from ww w.j a v a2 s.c om * @param message the error message */ private void displayErrorDialog(String message) { MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), Messages.WindupReportExport_errorDialogTitle, message, SWT.SHEET); }
From source file:org.jcryptool.games.divide.dialogs.SaveRecordConfirmation.java
License:Open Source License
public int open() { String dialog;//from ww w . j a v a 2 s . c om int dialogImageType; if (success) { dialog = Messages.SaveRecordConfirmation_0; dialogImageType = MessageDialog.INFORMATION; } else { dialog = Messages.SaveRecordConfirmation_1 + System.lineSeparator() + error; dialogImageType = MessageDialog.ERROR; } String[] labels = new String[] { "OK" }; MessageDialog dialogWindow = new MessageDialog(parent, null, null, dialog, dialogImageType, labels, -1); return dialogWindow.open(); }
From source file:org.kalypso.core.status.AbstractStatusDialog.java
License:Open Source License
private static int toMessageType(final int severity) { switch (severity) { case IStatus.OK: return MessageDialog.NONE; case IStatus.INFO: return MessageDialog.INFORMATION; case IStatus.WARNING: return MessageDialog.WARNING; case IStatus.ERROR: return MessageDialog.ERROR; case IStatus.CANCEL: // hm, better cancel icon? return MessageDialog.NONE; default:// w w w . j a v a2 s . co m return MessageDialog.NONE; } }
From source file:org.kelvinst.psfimport.ui.importWizards.PsfImportWizardFilesSelectionPage.java
License:Open Source License
/** * Display an error dialog with the specified message. * // ww w . ja v a 2 s. co m * @param message * the error message */ protected void displayErrorDialog(String message) { MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), "Import Problems", message, SWT.SHEET); }
From source file:org.key_project.sed.key.ui.command.AddWatchpointHandler.java
License:Open Source License
/** * Opens an error dialog if no condition has been entered (is this needed?) * /*from w ww . ja v a 2 s .com*/ * @param initialType the initial type for the following dialog * @return false if cancel was pressed true otherwise * @throws CoreException */ private boolean openErrorNoCondition(String initialType) throws CoreException { MessageDialog errorNoCondition = new MessageDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), "Enter a condition!", null, "Please enter a condition to watch for!", MessageDialog.ERROR, new String[] { "Edit Condition", "Cancel" }, 0); if (errorNoCondition.open() == Window.OK) { return safelyOpenDialog(initialType); } else { return false; } }
From source file:org.larz.dom4.editor.NewDialog.java
License:Open Source License
@Override protected void okPressed() { final String name = modName.getText(); final String description = descText.getText(); final String version = versionText.getText(); super.okPressed(); FileDialog dialog = new FileDialog(getParentShell(), SWT.SAVE); dialog.setFilterExtensions(new String[] { "*.dm" }); dialog.open();//from ww w.j a v a2s .com String[] names = dialog.getFileNames(); String filterPath = System.getProperty("user.home"); //$NON-NLS-1$ if (names != null) { filterPath = dialog.getFilterPath(); for (int i = 0; i < names.length; i++) { IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filterPath)); if (!names[i].endsWith(".dm")) { names[i] += ".dm"; } fileStore = fileStore.getChild(names[i]); IFileInfo fetchInfo = fileStore.fetchInfo(); if (fetchInfo.exists()) { MessageDialog overwriteDialog = new MessageDialog(getParentShell(), Messages.getString("NewDialog.save.fileExists.title"), null, Messages.format("NewDialog.save.fileExists.fmt", fetchInfo.getName()), MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); // 'No' is the default if (overwriteDialog.open() != Window.OK) { return; } } if (!fetchInfo.isDirectory()) { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { File newFile = fileStore.toLocalFile(0, null); newFile.createNewFile(); FileWriter out = new FileWriter(newFile); out.write("#modname \"" + name + "\"\n"); out.write("#description \"" + description + "\"\n"); out.write("#version " + version + "\n"); out.flush(); out.close(); IDE.openEditorOnFileStore(page, fileStore); } catch (PartInitException e) { MessageDialog.open(MessageDialog.ERROR, getParentShell(), Messages.getString("NewDialog.save.openError.title"), Messages.format("NewDialog.save.openError.fmt", fileStore.getName()), SWT.SHEET); } catch (IOException e) { e.printStackTrace(); } catch (CoreException e) { e.printStackTrace(); } } } } }
From source file:org.larz.dom4.Open.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override// w w w.j av a 2 s.c o m public void run() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); FileDialog dialog = new FileDialog(window.getShell(), SWT.OPEN); dialog.setFilterExtensions(new String[] { "*.dm" }); dialog.open(); String[] names = dialog.getFileNames(); String filterPath = System.getProperty("user.home"); //$NON-NLS-1$ if (names != null) { filterPath = dialog.getFilterPath(); for (int i = 0; i < names.length; i++) { IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filterPath)); if (!names[i].endsWith(".dm")) { names[i] += ".dm"; } fileStore = fileStore.getChild(names[i]); try { // open the editor on the file window.getActivePage().openEditor(getEditorInput(fileStore), getEditorId(fileStore)); } catch (PartInitException e) { MessageDialog.open(MessageDialog.ERROR, window.getShell(), Messages.getString("OpenFileError.title"), Messages.format("OpenFileError.message", fileStore.getName()), SWT.SHEET); } } } } }); return null; }
From source file:org.libreoffice.ide.eclipse.core.internal.model.SDK.java
License:LGPL
/** * {@inheritDoc}/* w w w.j a v a2s . c o m*/ */ @Override public Process runToolWithEnv(IProject pProject, IOOo pOOo, String pShellCommand, String[] pEnv, IProgressMonitor pMonitor) { Process process = null; try { if (null != pOOo) { // Get the environment variables and copy them. Needs Java 1.5 String[] sysEnv = SystemHelper.getSystemEnvironement(); String[] vars = mergeVariables(sysEnv, pEnv); vars = updateEnvironment(vars, pOOo); // Run only if the OS and ARCH are valid for the SDK if (null != vars) { File projectFile = pProject.getLocation().toFile(); process = SystemHelper.runTool(pShellCommand, vars, projectFile); } } } catch (IOException e) { // Error while launching the process MessageDialog dialog = new MessageDialog( OOEclipsePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.getString("SDK.PluginError"), //$NON-NLS-1$ null, Messages.getString("SDK.ProcessError"), //$NON-NLS-1$ MessageDialog.ERROR, new String[] { Messages.getString("SDK.Ok") }, 0); //$NON-NLS-1$ dialog.setBlockOnOpen(true); dialog.create(); dialog.open(); } catch (SecurityException e) { // SubProcess creation unauthorized MessageDialog dialog = new MessageDialog( OOEclipsePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.getString("SDK.PluginError"), //$NON-NLS-1$ null, Messages.getString("SDK.ProcessError"), //$NON-NLS-1$ MessageDialog.ERROR, new String[] { Messages.getString("SDK.Ok") }, 0); //$NON-NLS-1$ dialog.setBlockOnOpen(true); dialog.create(); dialog.open(); } catch (Exception e) { PluginLogger.error(e.getMessage(), null); } return process; }
From source file:org.locationtech.udig.printing.ui.internal.PrintAction.java
License:Open Source License
public void run() { Page page = null;/*from w w w .ja va 2 s .c om*/ IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); UDIGEditorInput editorInput = (UDIGEditorInput) workbenchWindow.getActivePage().getActiveEditor() .getEditorInput(); if (editorInput instanceof PageEditorInput) { page = (Page) ((PageEditorInput) editorInput).getProjectElement(); } if (page == null) { throw new RuntimeException(Messages.PrintAction_pageError); } FileDialog fileDialog = new FileDialog(workbenchWindow.getShell(), SWT.SAVE); fileDialog.setOverwrite(true); String path = fileDialog.open(); File outFile = null; if (path == null || path.length() < 1) { return; } else { if (!path.endsWith(".pdf") && !path.endsWith(".PDF")) { path = path + ".pdf"; } outFile = new File(path); } // Workaround for Windows systems to check, if there is a lock boolean fileIsLocked = !outFile.renameTo(outFile); if (fileIsLocked) { MessageDialog.open(MessageDialog.ERROR, workbenchWindow.getShell(), Messages.PrintAction_errorDialogTitle, MessageFormat.format(Messages.PrintAction_errorDialogLockMessage, outFile.getAbsolutePath()), SWT.NONE); return; } // copy the page before modifying it final Page copy = (Page) EcoreUtil.copy((EObject) page); final PdfPrintingEngine engine = new PdfPrintingEngine(copy, outFile); Job job = new Job(Messages.PrintAction_jobTitle) { protected IStatus run(IProgressMonitor monitor) { engine.setMonitor(monitor); boolean printToPdf = engine.printToPdf(); if (printToPdf) { return Status.OK_STATUS; } else { return Status.CANCEL_STATUS; } } }; if (job.isSystem()) job.setSystem(false); job.schedule(); }
From source file:org.melanee.textdsl.grammarimport.importWizards.ImportGrammar.java
License:Open Source License
public boolean performFinish() { try {//from ww w. j a v a2s .c o m IFile file = mainPage.createNewFile(); if (file == null) return false; GrammarTransformer.transform(selectionPage.getFileName(), file.getFullPath().toString(), selectionPage.getGrammarImporter(), selectionPage.getGrammarTransformer(), selectionPage.isOptimizationDisabled()); return true; } catch (InvalidRegistryObjectException e) { e.printStackTrace(); MessageDialog dialog = new MessageDialog(getShell(), "Error", null, e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0); dialog.open(); } catch (CoreException e) { e.printStackTrace(); MessageDialog dialog = new MessageDialog(getShell(), "Error", null, e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0); dialog.open(); } catch (Exception e) { e.printStackTrace(); MessageDialog dialog = new MessageDialog(getShell(), "Error", null, e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0); dialog.open(); } return false; }