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:de.anbos.eclipse.easyshell.plugin.preferences.MenuDataDialog.java
License:Open Source License
private boolean validateValues() { String title = Activator.getResourceString("easyshell.menu.editor.dialog.error.incompletedata.title"); // check type if ((commandCombo.getText() == null) || (commandCombo.getText().length() <= 0)) { MessageDialog.openError(getShell(), title, Activator.getResourceString("easyshell.menu.editor.dialog.error.type.text")); return false; }/* w ww . j a va 2 s. co m*/ boolean valid = true; // check name String text = Activator.getResourceString("easyshell.menu.editor.dialog.error.text.name"); if ((namePatternText.getText() == null) || (namePatternText.getText().length() <= 0)) { valid = false; } // show error message if (!valid) { MessageDialog.openError(getShell(), title, text); } else { int index = commandCombo.getSelectionIndex(); CommandData data = cmdList.get(index); List<MenuData> menus = MenuDataStore.instance().getRefencedBy(data.getId()); menus.remove(this.menuData); if (menus.size() > 0) { title = Activator.getResourceString("easyshell.menu.editor.dialog.title.duplicate"); String commandNames = commandCombo.getItem(index); String menuNames = ""; for (MenuData menu : menus) { menuNames += menu.getNameExpanded() + "\n"; } String question = MessageFormat.format( Activator.getResourceString("easyshell.menu.editor.dialog.question.duplicate"), commandNames, menuNames); MessageDialog dialog = new MessageDialog(null, title, null, question, MessageDialog.WARNING, new String[] { "Yes", "No" }, 1); // no is the default int result = dialog.open(); if (result != 0) { valid = false; } } } return valid; }
From source file:de.anbos.eclipse.easyshell.plugin.preferences.MenuPage.java
License:Open Source License
@Override public boolean performOk() { boolean save = true; if (!MenuDataStore.instance().isMigrated()) { String title = Activator.getResourceString("easyshell.menu.page.dialog.migration.title"); String question = Activator.getResourceString("easyshell.menu.page.dialog.migration.question"); MessageDialog dialog = new MessageDialog(null, title, null, question, MessageDialog.WARNING, new String[] { "Yes", "No" }, 1); // no is the default int result = dialog.open(); if (result == 0) { MenuDataStore.instance().setMigrated(true); } else {/* w w w .ja v a 2 s . c o m*/ save = false; } } if (save) { CommandDataStore.instance().save(); MenuDataStore.instance().save(); } return save; }
From source file:de.anbos.eclipse.easyshell.plugin.preferences.MenuPage.java
License:Open Source License
@Override protected void performDefaults() { String title = Activator.getResourceString("easyshell.menu.page.dialog.defaults.title"); String question = Activator.getResourceString("easyshell.menu.page.dialog.defaults.question"); MessageDialog dialog = new MessageDialog(null, title, null, question, MessageDialog.WARNING, new String[] { "Yes", "No" }, 1); // no is the default int result = dialog.open(); if (result == 0) { MenuDataStore.instance().loadDefaults(); refreshTableViewer();//w w w. java 2 s .c o m } }
From source file:de.loskutov.anyedit.actions.SaveToFileAction.java
License:Open Source License
/** * @param file//from w w w . j a va2 s. c o m * non null * @return OVERRIDE if file not exists or exists and may be overriden, APPEND if it * exists and should be reused, CANCEL if action should be cancelled */ private int checkForExisting(File file) { if (file.exists()) { MessageDialog md = new MessageDialog(AnyEditToolsPlugin.getShell(), Messages.SaveTo_ShouldOpen, null, Messages.SaveTo_FileExists, MessageDialog.WARNING, new String[] { Messages.SaveTo_Append, Messages.SaveTo_Override, "Cancel" }, 0); int result = md.open(); switch (result) { case APPEND: // Append btn index return APPEND; case OVERRIDE: // Override btn index return OVERRIDE; default: return CANCEL; } } return OVERRIDE; }
From source file:de.loskutov.eclipse.jdepend.views.SaveToFileAction.java
License:Open Source License
/** * @param file/*w w w . j a v a 2 s . com*/ * non null * @return OVERRIDE if file not exists or exists and may be overriden, APPEND if it * exists and should be reused, CANCEL if action should be cancelled */ private int checkForExisting(File file) { if (file.exists()) { MessageDialog md = new MessageDialog(getShell(), "Warning: file already exist", null, "Warning: file already exist", MessageDialog.WARNING, new String[] { "Append", "Override", "Cancel" }, 0); int result = md.open(); switch (result) { case APPEND: // Append btn index return APPEND; case OVERRIDE: // Override btn index return OVERRIDE; default: return CANCEL; } } return OVERRIDE; }
From source file:de.ovgu.featureide.ahead.actions.ChangeComposerAction.java
License:Open Source License
private boolean openDialog() { return MessageDialog.open(MessageDialog.WARNING, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Composer Conversion", "Source files will be changed automatically. FeatureHouse suppors Java 5 and AHEAD Java 4, this can cause problems during converion. You should have a copy of this project.", SWT.NONE);/*from w w w . ja v a 2s .c o m*/ }
From source file:de.ovgu.featureide.core.conversion.ahead_featurehouse.handlers.ChangeComposerHandler.java
License:Open Source License
@Override protected boolean startAction(IStructuredSelection selection) { return MessageDialog.open(MessageDialog.WARNING, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), COMPOSER_CONVERSION, SOURCE_FILES_WILL_BE_CHANGED_AUTOMATICALLY__FEATUREHOUSE_SUPPORS_JAVA_5_AND_AHEAD_JAVA_4_COMMA__THIS_CAN_CAUSE_PROBLEMS_DURING_CONVERION__YOU_SHOULD_HAVE_A_COPY_OF_THIS_PROJECT_, SWT.NONE);//from w w w .j av a 2 s.c o m }
From source file:de.plugins.eclipse.depclipse.handlers.SaveJDependOutput.java
License:Open Source License
/** * @param file//from ww w. j a v a 2 s.c o m * non null * @return OVERRIDE if file not exists or exists and may be overriden, * APPEND if it exists and should be reused, CANCEL if action should * be cancelled */ private int checkForExisting(File file) { if (file.exists()) { MessageDialog md = new MessageDialog(getShell(), Messages.SaveJDependOutput_Warning_File_already_exists, null, Messages.SaveJDependOutput_Warning_File_already_exists, MessageDialog.WARNING, new String[] { Messages.SaveJDependOutput_Append, Messages.SaveJDependOutput_Override, Messages.SaveJDependOutput_Cancel }, 0); int result = md.open(); switch (result) { case APPEND: // Append btn index return APPEND; case OVERRIDE: // Override btn index return OVERRIDE; default: return CANCEL; } } return OVERRIDE; }
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 w w w . ja v a 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); }
From source file:de.tub.tfs.henshin.tggeditor.commands.ResizableMessageDialog.java
License:Open Source License
public ResizableMessageDialog(String title, String errorString) { super(Display.getDefault().getActiveShell(), title, null, errorString, MessageDialog.WARNING, new String[] { "OK" }, 0); }