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.jboss.tools.openshift.internal.ui.handler.ScaleDeploymentHandler.java
License:Open Source License
private boolean showStopDeploymentWarning(String name, Shell shell) { MessageDialog dialog = new MessageDialog(shell, "Stop all deployments?", OpenShiftCommonImages.OPENSHIFT_LOGO_WHITE_ICON_IMG, NLS.bind(//from w w w .ja v a2s .c o m "Are you sure you want to scale {0} to 0 replicas?\nThis will stop all pods for the deployment.", name), MessageDialog.WARNING, 1, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }); return dialog.open() == Dialog.OK; }
From source file:org.jcryptool.crypto.xml.ui.dialogs.MissingPreferenceDialog.java
License:Open Source License
/** * Constructor for the PreferenceDialog. * * @param shell The parent shell/* ww w . ja v a 2 s. com*/ * @param title The dialog title * @param text The dialog info text * @param linkTarget The preference page to open */ public MissingPreferenceDialog(Shell shell, String title, String text, String linkTarget) { super(shell, title, null, text, MessageDialog.WARNING, new String[] { "Continue", "Cancel" }, 0); target = linkTarget; }
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 ava2 s . c o m*/ return MessageDialog.NONE; } }
From source file:org.kalypso.gml.ui.internal.shape.ShapeFileNewWizard.java
License:Open Source License
static boolean askForAndDeleteExistingFiles(final Shell shell, final String title, final IFile baseFile) throws CoreException { final IFile[] shapeFileExists = ShapeUtilities.getExistingShapeFiles(baseFile); if (shapeFileExists.length > 0) { final MessageDialog dialog = new MessageDialog(shell, title, null, Messages.getString("ShapeFileNewWizard_3"), MessageDialog.WARNING, new String[] { //$NON-NLS-1$ IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);/*w w w . j av a 2 s. c o m*/ if (dialog.open() != IDialogConstants.OK_ID) return false; } deleteExitingShapeFiles(shapeFileExists); return true; }
From source file:org.kalypso.ui.editor.actions.TableFeatureControlUtils.java
License:Open Source License
private static boolean askForDeletionWithReferences(final Shell shell, final EasyFeatureWrapper[] allFeatures, final Map<Feature, Set<IRelationType>> linkedFeatures) { final String msg = getAskWithReferencesMessage(allFeatures); final MessageDialog dialog = new MessageDialog(shell, Messages.getString("org.kalypso.ui.editor.actions.TableFeatureControlUtils.2"), null, msg, //$NON-NLS-1$ MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { @Override//from ww w . j a va 2 s . c o m protected Control createCustomArea(final Composite dialogParent) { final TableViewer viewer = new TableViewer(dialogParent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.HIDE_SELECTION); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new GMLLabelProvider() { @Override public String getText(final Object element) { if (element instanceof Feature) return getFeatureDeleteLabel((Feature) element); return super.getText(element); } }); viewer.setInput(linkedFeatures.keySet()); viewer.getTable(); final Control control = viewer.getControl(); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.minimumHeight = 200; gridData.widthHint = 200; gridData.heightHint = 200; control.setLayoutData(gridData); return control; } }; final int open = dialog.open(); // REMARK: this is not the same as != Window.CANCEL return open == Window.OK; }
From source file:org.kalypso.ui.editor.styleeditor.colorMapEntryTable.GenerateColorRangeDialog.java
License:Open Source License
@Override protected void okPressed() { if (m_entries.length > 50) { final String dialogMessage = String.format(Messages.getString("GenerateColorRangeDialog_1"), 50); //$NON-NLS-1$ final MessageDialog dialog = new MessageDialog(getShell(), getShell().getText(), null, dialogMessage, MessageDialog.WARNING, new String[] { Messages.getString("GenerateColorRangeDialog_2"), //$NON-NLS-1$ Messages.getString("GenerateColorRangeDialog_3") }, //$NON-NLS-1$ 1);//w w w .ja v a2 s. c o m if (dialog.open() == Window.CANCEL) return; } super.okPressed(); }
From source file:org.kalypso.ui.rrm.internal.scenarios.MergeScenariosWizard.java
License:Open Source License
@Override public boolean performFinish() { /* Were all selected scenarios verified? */ final boolean scenariosVerified = wereSelectedScenariosVerified(); /* Determine the properties of the message dialog. */ int kind = MessageDialog.INFORMATION; String message = Messages.getString("MergeScenariosWizard_2"); //$NON-NLS-1$ if (!scenariosVerified) { kind = MessageDialog.WARNING; message = Messages.getString("MergeScenariosWizard_3"); //$NON-NLS-1$ }/* www . j av a 2 s . c o m*/ /* Open the message dialog. */ // FIXME: use, confirm dialog! final MessageDialog dialog = new MessageDialog(getShell(), getWindowTitle(), null, message, kind, new String[] { Messages.getString("MergeScenariosWizard_4"), //$NON-NLS-1$ Messages.getString("MergeScenariosWizard_5") }, //$NON-NLS-1$ 1); if (dialog.open() != 0) return false; /* Create the operation. */ final MergeScenariosOperation operation = new MergeScenariosOperation(m_scenariosData); /* Execute the operation. */ final IStatus status = RunnableContextHelper.execute(getContainer(), true, false, operation); if (!status.isOK()) { /* Log the error message. */ KalypsoUIRRMPlugin.getDefault().getLog().log(status); /* Show a status dialog. */ final StatusDialog statusDialog = new StatusDialog(getShell(), status, getWindowTitle()); statusDialog.open(); return false; } return true; }
From source file:org.larz.dom4.dm.ui.editor.DmXtextEditor.java
License:Open Source License
@Override protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell();//w w w . j a va2 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(AUTOLINK_PROJECT_NAME)) { final IEditorInput newInput; IDocumentProvider provider = getDocumentProvider(); FileDialog dialog = new FileDialog(shell, SWT.SAVE); IPath oldPath = URIUtil.toPath(((IURIEditorInput) input).getURI()); if (oldPath != null) { dialog.setFileName(oldPath.lastSegment()); dialog.setFilterPath(oldPath.toOSString()); } dialog.setFilterExtensions(new String[] { "*.dm", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$ 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, "File Exists", null, path + " already exists. Do you wish to overwrite? ", 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) { MessageDialog.openError(shell, "Error", "Couldn't write file. " + ex.getMessage()); 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 = obtainLink(uri); newInput = new FileEditorInput(linkedFile); } if (provider == null) { // editor has programmatically 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) { MessageDialog.openError(shell, "Error", "Couldn't write file. " + x.getMessage()); } } finally { provider.changed(newInput); if (success) setInput(newInput); } if (progressMonitor != null) progressMonitor.setCanceled(!success); return; } super.performSaveAs(progressMonitor); }
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 www . java 2s . c o m 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.mailster.gui.dialogs.TrustDialog.java
License:Open Source License
/** * Creates a new <code>TrustDialog</code> instance. * /*from ww w . ja v a 2s .co m*/ * @param shell the parent shell */ public TrustDialog(Shell shell, Certificate[] chain) { super(shell, Messages.getString("MailsterSWT.dialog.trust.title"), //$NON-NLS-1$ null, buildMessage(chain), MessageDialog.WARNING, new String[] { Messages.getString("MailsterSWT.dialog.about.ok.label"), //$NON-NLS-1$ Messages.getString("MailsterSWT.dialog.about.cancel.label") }, //$NON-NLS-1$ 1); setShellStyle(getShellStyle() & ~SWT.MENU); if (Security.getProvider("BC") == null) Security.addProvider(new BouncyCastleProvider()); this.chain = chain; }