List of usage examples for org.eclipse.jface.dialogs IMessageProvider WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs IMessageProvider WARNING.
Click Source Link
From source file:org.eclipse.equinox.internal.security.ui.storage.StorageLoginDialog.java
License:Open Source License
protected boolean validatePassword() { String password1 = password.getText(); if ((password1 == null) || (password1.length() == 0)) { setMessage(SecUIMessages.messageEmptyPassword, IMessageProvider.ERROR); return false; }/*from www . j a v a 2s. c o m*/ if (confirm != null) { String password2 = confirm.getText(); if (!password1.equals(password2)) { setMessage(SecUIMessages.messageNoMatch, IMessageProvider.WARNING); return false; } } setMessage("", IMessageProvider.NONE); //$NON-NLS-1$ return true; }
From source file:org.eclipse.equinox.internal.security.ui.storage.view.ExportDialog.java
License:Open Source License
protected Control createContents(Composite parent) { Control contents = super.createContents(parent); setTitle(SecUIMessages.exportDialogTitle); setMessage(SecUIMessages.exportDialogMsg, IMessageProvider.WARNING); dlgTitleImage = dlgImageDescriptor.createImage(); setTitleImage(dlgTitleImage);//from w w w . j a va 2 s . c o m return contents; }
From source file:org.eclipse.equinox.internal.security.ui.storage.view.ExportDialog.java
License:Open Source License
protected boolean validFile() { if (fileText == null) return true; boolean valid; String tmp = fileText.getText(); if ((tmp != null) && (tmp.length() != 0)) { File check = new File(tmp); if (check.exists()) valid = check.canWrite();/*from w w w .java2 s . co m*/ else valid = true; } else valid = false; if (valid) setMessage(SecUIMessages.exportDialogMsg, IMessageProvider.WARNING); else setMessage(SecUIMessages.exportDialogInvalidMsg, IMessageProvider.ERROR); return valid; }
From source file:org.eclipse.equinox.p2.authoring.forms.EditAdapter.java
License:Open Source License
/** * Sets a single warning message keyed by this edit adapter. Replaces any earlier set message for the edit adapter. * /*from ww w . j a va 2s .co m*/ * @param message */ public void setWarningMessage(String message) { m_formPart.getManagedForm().getMessageManager().addMessage(this, message, null, IMessageProvider.WARNING, m_control); }
From source file:org.eclipse.equinox.p2.authoring.forms.RichFormPage.java
License:Open Source License
private void configureFormText(final Form form, FormText text) { text.addHyperlinkListener(new HyperlinkAdapter() { @Override/*from w ww . jav a 2 s. c o m*/ public void linkActivated(HyperlinkEvent e) { String is = (String) e.getHref(); try { int index = Integer.parseInt(is); IMessage[] messages = form.getChildrenMessages(); IMessage message = messages[index]; Control c = message.getControl(); ((FormText) e.widget).getShell().dispose(); if (c != null) c.setFocus(); } catch (ArrayIndexOutOfBoundsException ex) { // This can happens if message array changes while menu is up ((FormText) e.widget).getShell().dispose(); } catch (NumberFormatException ex) { } } }); text.setImage("error", getImage(IMessageProvider.ERROR)); //$NON-NLS-1$ text.setImage("warning", getImage(IMessageProvider.WARNING)); //$NON-NLS-1$ text.setImage("info", getImage(IMessageProvider.INFORMATION)); //$NON-NLS-1$ }
From source file:org.eclipse.equinox.p2.authoring.forms.RichFormPage.java
License:Open Source License
/** * Formats messages into a form string//from w w w . java 2 s. c om * * @param messages * - messages to format * @return a form string */ private String createFormTextContent(IMessage[] messages) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println("<form>"); //$NON-NLS-1$ for (int i = 0; i < messages.length; i++) { IMessage message = messages[i]; pw.print("<li vspace=\"false\" style=\"image\" indent=\"16\" value=\""); //$NON-NLS-1$ switch (message.getMessageType()) { case IMessageProvider.ERROR: pw.print("error"); //$NON-NLS-1$ break; case IMessageProvider.WARNING: pw.print("warning"); //$NON-NLS-1$ break; case IMessageProvider.INFORMATION: pw.print("info"); //$NON-NLS-1$ break; } pw.print("\"> <a href=\""); //$NON-NLS-1$ pw.print(i + ""); //$NON-NLS-1$ pw.print("\">");//$NON-NLS-1$ if (message.getPrefix() != null) pw.print(message.getPrefix()); pw.print(message.getMessage()); pw.println("</a></li>"); //$NON-NLS-1$ } pw.println("</form>"); //$NON-NLS-1$ pw.flush(); return sw.toString(); }
From source file:org.eclipse.equinox.p2.authoring.forms.RichFormPage.java
License:Open Source License
/** * Convenience method to pick up platform images for error and warning. * //from w ww. j a v a 2s.c om * @param type * @return */ private Image getImage(int type) { switch (type) { case IMessageProvider.ERROR: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); case IMessageProvider.WARNING: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK); case IMessageProvider.INFORMATION: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK); } return null; }
From source file:org.eclipse.flux.ui.integration.preferences.ConnectionPreferencePage.java
License:Open Source License
@Override public void init(IWorkbench workbench) { setDescription("Allows setting of various Flux server connection parameters."); setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID)); if (!editable) { setMessage(//from w ww.j av a 2 s . c om "Settings cannot be changed from UI. They are set via environment variable and/or command line arguments", IMessageProvider.WARNING); } }
From source file:org.eclipse.fx.ide.fxml.wizards.FXMLWizardPage.java
License:Open Source License
@Override protected void revalidate() { if (getClazz().getName() == null || getClazz().getName().trim().length() == 0) { setPageComplete(false);/*from w w w . j a v a 2 s .com*/ setMessage(Messages.FXMLWizardPage_2, IMessageProvider.ERROR); } else if (getClazz().getRootElement() == null) { setPageComplete(false); setMessage(Messages.FXMLWizardPage_10, IMessageProvider.ERROR); } else if (Character.isLowerCase(getClazz().getName().charAt(0))) { setPageComplete(true); setMessage(Messages.FXMLWizardPage_5, IMessageProvider.WARNING); } else { setPageComplete(true); setMessage(null); } }
From source file:org.eclipse.gmf.examples.design2d.part.DesignDiagramEditor.java
License:Open Source License
/** * @generated/* ww w . j av a 2 s .c o m*/ */ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); IEditorInput input = getEditorInput(); SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null; if (original != null) { dialog.setOriginalFile(original); } dialog.create(); IDocumentProvider provider = getDocumentProvider(); if (provider == null) { // editor has been programmatically closed while the dialog was open return; } if (provider.isDeleted(input) && original != null) { String message = NLS.bind(Messages.DesignDiagramEditor_SavingDeletedFile, original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IPath filePath = dialog.getResult(); if (filePath == null) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile file = workspaceRoot.getFile(filePath); final IEditorInput newInput = new FileEditorInput(file); // Check if the editor is already open IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy(); IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { if (matchingStrategy.matches(editorRefs[i], newInput)) { MessageDialog.openWarning(shell, Messages.DesignDiagramEditor_SaveAsErrorTitle, Messages.DesignDiagramEditor_SaveAsErrorMessage); return; } } boolean success = false; try { provider.aboutToChange(newInput); getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); success = true; } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { ErrorDialog.openError(shell, Messages.DesignDiagramEditor_SaveErrorTitle, Messages.DesignDiagramEditor_SaveErrorMessage, x.getStatus()); } } finally { provider.changed(newInput); if (success) { setInput(newInput); } } if (progressMonitor != null) { progressMonitor.setCanceled(!success); } }