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:au.gov.ga.earthsci.bookmark.part.editor.BookmarkEditorDialog.java
License:Apache License
private void updateValidityIndicators(IBookmarkEditor editor, boolean valid, IBookmarkEditorMessage[] messages) { if (editor == null) { return;// www. ja v a 2 s . com } if (valid || !currentEditorIncludedInBookmark()) { messageArea.restoreTitle(); if (getButton(IDialogConstants.OK_ID) != null) { getButton(IDialogConstants.OK_ID).setEnabled(true); } } else if (!valid) { if (messages != null && messages.length > 0) { messageArea.updateText(messages[0].getMessage(), messages[0].getLevel() == Level.ERROR ? IMessageProvider.ERROR : messages[0].getLevel() == Level.WARNING ? IMessageProvider.WARNING : IMessageProvider.INFORMATION); } if (getButton(IDialogConstants.OK_ID) != null) { getButton(IDialogConstants.OK_ID).setEnabled(false); } } }
From source file:au.gov.ga.earthsci.eclipse.extras.ide.ChooseWorkspaceDialog.java
License:Open Source License
/** * Creates and returns the contents of the upper part of this dialog (above * the button bar)./*from ww w .j a va2s .co m*/ * <p> * The <code>Dialog</code> implementation of this framework method creates * and returns a new <code>Composite</code> with no margins and spacing. * </p> * * @param parent the parent composite to contain the dialog area * @return the dialog area control */ protected Control createDialogArea(Composite parent) { String productName = getWindowTitle(); Composite composite = (Composite) super.createDialogArea(parent); setTitle(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogTitle); setMessage(NLS.bind(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogMessage, productName)); // bug 59934: load title image for sizing, but set it non-visible so the // white background is displayed if (getTitleImageLabel() != null) { getTitleImageLabel().setVisible(false); } createWorkspaceBrowseRow(composite); if (!suppressAskAgain) { createShowDialogButton(composite); } // look for the eclipse.gcj property. // If true, then we dont need any warning messages. // someone is asserting that we're okay on GCJ boolean gcj = Boolean.getBoolean("eclipse.gcj"); //$NON-NLS-1$ String vmName = System.getProperty("java.vm.name");//$NON-NLS-1$ if (!gcj && vmName != null && vmName.indexOf("libgcj") != -1) { //$NON-NLS-1$ composite.getDisplay().asyncExec(new Runnable() { public void run() { // set this via an async - if we set it directly the dialog // will // be huge. See bug 223532 setMessage(IDEWorkbenchMessages.UnsupportedVM_message, IMessageProvider.WARNING); } }); } Dialog.applyDialogFont(composite); return composite; }
From source file:bndtools.editor.BndEditor.java
License:Open Source License
@Override protected void addPages() { updateIncludedPages();// w w w .j a v a 2 s . c o m showHighestPriorityPage(); if (!Central.isWorkspaceInited()) { IFormPage activePage = getActivePageInstance(); if (activePage != null && activePage.getManagedForm() != null) { ScrolledForm form = activePage.getManagedForm().getForm(); if (form.getMessage() == null) { form.setMessage(SYNC_MESSAGE, IMessageProvider.WARNING); } } } }
From source file:bndtools.editor.components.ComponentListPart.java
License:Open Source License
void checkComponentPackagesIncluded() { IMessageManager msgs = getManagedForm().getMessageManager(); msgs.setDecorationPosition(SWT.TOP | SWT.RIGHT); msgs.removeMessages();/* ww w .j a v a 2 s . c om*/ int index = 0; if (componentMap != null) { for (Entry<String, ServiceComponent> entry : componentMap.entrySet()) { ServiceComponent component = entry.getValue(); if (component.getName().length() > 0 && !component.isPath()) { String classOrWildcard = entry.getKey(); if (classOrWildcard != null && classOrWildcard.length() > 0) { int dotIndex = classOrWildcard.lastIndexOf('.'); if (dotIndex == -1) { msgs.addMessage("_comp_default_pkg" + index, //$NON-NLS-1$ Messages.ComponentListPart_warningDefaultPkg, null, IMessageProvider.WARNING); } else { final String packageName = classOrWildcard.substring(0, dotIndex); final BndEditModel model = (BndEditModel) getManagedForm().getInput(); if (!model.isIncludedPackage(packageName)) { String message = MessageFormat .format(Messages.ComponentListPart_warningPkgNotIncluded, packageName); IAction[] fixes = new Action[] { new Action(MessageFormat .format(Messages.ComponentListPart_fixAddToPrivatePkgs, packageName)) { @Override public void run() { model.addPrivatePackage(packageName); markDirty(); } }, new Action(MessageFormat.format(Messages.ComponentListPart_fixAddToExportedPkgs, packageName)) { @Override public void run() { model.addExportedPackage(new ExportedPackage(packageName, null)); markDirty(); } } }; msgs.addMessage("_comp_nonincluded_pkg" + index, message, fixes, //$NON-NLS-1$ IMessageProvider.WARNING); } } } } index++; } } }
From source file:bndtools.editor.components.ComponentSvcRefWizardPage.java
License:Open Source License
void validate() { String error = null;//from w w w . j a v a2s . c om String warning = null; // Interface must not be null if (serviceReference.getServiceClass() == null) error = "A service interface name must be specified."; // Name must not already be used else if (existingNames.contains(serviceReference.getName())) { error = String.format("A reference with the name \"%s\" already exists for this component.", serviceReference.getName()); } // Multiple/optional references SHOULD be dynamic if ((serviceReference.isMultiple() || serviceReference.isOptional()) && !serviceReference.isDynamic()) { warning = "It is recommended to make optional or multiple references dynamic."; } // Unbind without bind is pointless else if (serviceReference.getBind() == null && serviceReference.getUnbind() != null) { warning = "Unbind cannot be set when bind is not set."; } setErrorMessage(error); setMessage(warning, IMessageProvider.WARNING); setPageComplete(error == null); getContainer().updateButtons(); }
From source file:bndtools.editor.imports.ImportPatternsListPart.java
License:Open Source License
@Override public void validate() { IMessageManager msgs = getManagedForm().getMessageManager(); msgs.setDecorationPosition(SWT.TOP | SWT.RIGHT); String noStarWarning = null;/*from w ww . j a va 2 s . com*/ String actionMessage = null; List<ImportPattern> patterns = getClauses(); if (!patterns.isEmpty()) { for (Iterator<ImportPattern> iter = patterns.iterator(); iter.hasNext();) { ImportPattern pattern = iter.next(); if (pattern.getName().equals("*") && iter.hasNext()) { noStarWarning = "The catch-all pattern \"*\" should be in the last position."; actionMessage = "Move \"*\" pattern to the last position."; break; } } if (noStarWarning == null) { ImportPattern last = patterns.get(patterns.size() - 1); if (!last.getName().equals("*")) { noStarWarning = "The catch-all pattern \"*\" should be present and in the last position."; actionMessage = "Add missing \"*\" pattern."; } } } if (noStarWarning != null) { msgs.addMessage("_warning_no_star", noStarWarning, new FixMissingStarsAction(actionMessage), IMessageProvider.WARNING); } else { msgs.removeMessage("_warning_no_star"); } }
From source file:bndtools.utils.MessagesPopupDialog.java
License:Open Source License
static Image getMessageImage(int messageType) { switch (messageType) { case IMessageProvider.INFORMATION: return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); case IMessageProvider.WARNING: return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); case IMessageProvider.ERROR: return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); default://from w ww. ja v a2 s.c o m return null; } }
From source file:bndtools.wizards.bndfile.JarListWizardPage.java
License:Open Source License
private void checkExistingBundles() { List<IPath> alreadyBundles = new LinkedList<IPath>(); for (IPath path : paths) { Jar jar = null;/*from w w w . j a v a 2 s . c om*/ try { if (path.isAbsolute()) { jar = new Jar(path.toFile()); } else { path = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(path); jar = new Jar(path.toFile()); } Manifest manifest = jar.getManifest(); if (manifest != null) { String bsn = manifest.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME); if (bsn != null) { alreadyBundles.add(path); } } } catch (Exception e) { logger.logError("Error inspecting JAR file: " + path.toString(), e); } finally { if (jar != null) jar.close(); } } String warning = null; if (!alreadyBundles.isEmpty()) { StringBuilder builder = new StringBuilder(); builder.append("The following JAR files are already bundles: "); for (Iterator<IPath> iterator = alreadyBundles.iterator(); iterator.hasNext();) { IPath path = iterator.next(); builder.append(path.toString()); if (iterator.hasNext()) builder.append("; "); } warning = builder.toString(); } setMessage(warning, IMessageProvider.WARNING); }
From source file:bndtools.wizards.bndfile.NewBndFileWizardPage.java
License:Open Source License
@Override protected boolean validatePage() { boolean valid = super.validatePage(); if (!valid)//from w w w. j ava 2 s . c o m return valid; String warning = null; String error = null; String fileName = getFileName(); IPath containerPath = getContainerFullPath(); IResource container = ResourcesPlugin.getWorkspace().getRoot().findMember(containerPath); IProject project = container.getProject(); try { if (project.hasNature(BndtoolsConstants.NATURE_ID)) { if (Project.BNDFILE.equalsIgnoreCase(fileName)) { error = Messages.NewBndFileWizardPage_errorReservedFilename; } } } catch (CoreException e) { ErrorDialog.openError(getShell(), Messages.NewBndFileWizardPage_titleError, null, new Status( IStatus.ERROR, Plugin.PLUGIN_ID, 0, Messages.NewBndFileWizardPage_errorCheckingBndNature, e)); } if (container.getType() != IResource.PROJECT) { warning = Messages.NewBndFileWizardPage_warningNotTopLevel; } try { if (!project.hasNature(BndtoolsConstants.NATURE_ID)) { warning = Messages.NewBndFileWizardPage_warningNonBndProject; } } catch (CoreException e) { ErrorDialog.openError(getShell(), Messages.NewBndFileWizardPage_titleError, null, new Status( IStatus.ERROR, Plugin.PLUGIN_ID, 0, Messages.NewBndFileWizardPage_errorCheckingBndNature, e)); } setMessage(warning, IMessageProvider.WARNING); setErrorMessage(error); return error == null; }
From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.CodeChooserDialog.java
License:Open Source License
/** * Listens for changes in the text and validates the data entered. Displays a creation * warning if the code doesn't exist./*from w w w .ja v a 2 s . com*/ * @return */ private ModifyListener createModifyListener() { return new ModifyListener() { @Override public void modifyText(ModifyEvent e) { CodeChooserValidator validator = new CodeChooserValidator(fCodeName.getText().trim(), fProject, fFragment); if (!validator.isValid()) { if (validator.getErrorMessage() .equals(Messages.getString("dialogs.CodeChooserDialog.nameTaken"))) //$NON-NLS-1$ { setErrorMessage(null); setMessage(Messages.getString("dialogs.CodeChooserDialog.enterName")); //$NON-NLS-1$ for (Code code : fProject.getCodes()) { if (code.getCodeName().equals(fCodeName.getText().trim())) { fDescription.setText(code.getDescription()); } } getButton(IDialogConstants.OK_ID).setEnabled(true); } else { setErrorMessage(validator.getErrorMessage()); getButton(IDialogConstants.OK_ID).setEnabled(false); } } else { setErrorMessage(null); setMessage(Messages.getString("dialogs.CodeChooserDialog.doesNotExist"), //$NON-NLS-1$ IMessageProvider.WARNING); getButton(IDialogConstants.OK_ID).setEnabled(true); } } }; }