List of usage examples for org.eclipse.jface.dialogs IMessageProvider NONE
int NONE
To view the source code for org.eclipse.jface.dialogs IMessageProvider NONE.
Click Source Link
From source file:org.eclipse.ui.internal.ide.dialogs.PathVariableDialog.java
License:Open Source License
/** * Validates the current variable value, and updates this dialog's message. * //from w w w .j a v a 2 s . c om * @return true if the value is valid, false otherwise */ private boolean validateVariableValue() { boolean allowFinish = false; // if the current validationStatus is ERROR, no additional validation applies if (validationStatus == IMessageProvider.ERROR) { return false; } // assumes everything will be ok String message = standardMessage; int newValidationStatus = IMessageProvider.NONE; if (variableValue.length() == 0) { // the variable value is empty if (locationEntered) { // a location value was entered before and is now empty newValidationStatus = IMessageProvider.ERROR; message = IDEWorkbenchMessages.PathVariableDialog_variableValueEmptyMessage; } } if (currentResource != null) { // While editing project path variables, the variable value can // contain macros such as "${foo}\etc" allowFinish = true; String resolvedValue = getVariableResolvedValue(); IPath resolvedPath = Path.fromOSString(resolvedValue); if (!IDEResourceInfoUtils.exists(resolvedPath.toOSString())) { // the path does not exist (warning) message = IDEWorkbenchMessages.PathVariableDialog_pathDoesNotExistMessage; newValidationStatus = IMessageProvider.WARNING; } else { IFileInfo info = IDEResourceInfoUtils.getFileInfo(resolvedPath.toOSString()); if ((info.isDirectory() && ((variableType & IResource.FOLDER) == 0)) || (!info.isDirectory() && ((variableType & IResource.FILE) == 0))) { allowFinish = false; newValidationStatus = IMessageProvider.ERROR; if (((variableType & IResource.FOLDER) != 0)) message = IDEWorkbenchMessages.PathVariableDialog_variableValueIsWrongTypeFolder; else message = IDEWorkbenchMessages.PathVariableDialog_variableValueIsWrongTypeFile; } } } else if (!Path.EMPTY.isValidPath(variableValue)) { // the variable value is an invalid path message = IDEWorkbenchMessages.PathVariableDialog_variableValueInvalidMessage; newValidationStatus = IMessageProvider.ERROR; } else if (!new Path(variableValue).isAbsolute()) { // the variable value is a relative path message = IDEWorkbenchMessages.PathVariableDialog_pathIsRelativeMessage; newValidationStatus = IMessageProvider.ERROR; } else if (!IDEResourceInfoUtils.exists(variableValue)) { // the path does not exist (warning) message = IDEWorkbenchMessages.PathVariableDialog_pathDoesNotExistMessage; newValidationStatus = IMessageProvider.WARNING; allowFinish = true; } else { allowFinish = true; } // overwrite the current validation status / message only if everything is ok (clearing them) // or if we have a more serious problem than the current one if (validationStatus == IMessageProvider.NONE || newValidationStatus > validationStatus) { validationStatus = newValidationStatus; validationMessage = message; } setMessage(validationMessage, validationStatus); return allowFinish; }
From source file:org.eclipse.ui.preferences.WizardPropertyPage.java
License:Open Source License
private void setDescription(IWizardPage page, Label messageLabel) { String description = null;/*from w w w . java 2 s .c o m*/ if (page.getDescription() != null) { description = page.getDescription(); } else if (page instanceof IMessageProvider) { IMessageProvider messageProvider = (IMessageProvider) page; if (messageProvider.getMessageType() == IMessageProvider.NONE) { description = messageProvider.getMessage(); } } if (description != null) { messageLabel.setText(description); } else { messageLabel.setVisible(false); } }
From source file:org.eclipse.ui.texteditor.MessageRegion.java
License:Open Source License
/** * Show the new message in the message text and update the image. Base the background color on * whether or not there are errors.//from w w w.j a v a 2 s.c o m * * @param newMessage The new value for the message * @param newType One of the IMessageProvider constants. If newType is IMessageProvider.NONE * show the title. * @see IMessageProvider */ public void updateText(String newMessage, int newType) { Image newImage = null; boolean showingError = false; switch (newType) { case IMessageProvider.NONE: hideRegion(); return; case IMessageProvider.INFORMATION: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; case IMessageProvider.WARNING: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IMessageProvider.ERROR: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); showingError = true; break; } if (newMessage == null) {//No message so clear the area hideRegion(); return; } showRegion(); // Any more updates required if (newMessage.equals(messageText.getText()) && newImage == messageImageLabel.getImage()) return; messageImageLabel.setImage(newImage); messageText.setText(newMessage); if (showingError) setMessageColors(JFaceColors.getErrorBackground(messageComposite.getDisplay())); else { lastMessageText = newMessage; setMessageColors(JFaceColors.getBannerBackground(messageComposite.getDisplay())); } }
From source file:org.eclipse.virgo.ide.runtime.internal.ui.ServerRuntimeComposite.java
License:Open Source License
protected void validate() { if (this.runtime == null) { this.wizard.setMessage("", IMessageProvider.ERROR); return;//from w w w .jav a 2s . c o m } IStatus status = this.runtimeWC.validate(null); if (status == null) { this.wizard.setMessage(null, IMessageProvider.NONE); } else if (status.isOK()) { this.wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION); } else if (status.getSeverity() == IStatus.WARNING) { this.wizard.setMessage(status.getMessage(), IMessageProvider.WARNING); } else { this.wizard.setMessage(status.getMessage(), IMessageProvider.ERROR); } this.wizard.update(); // updateConfiguration(); }
From source file:org.eclipse.wst.common.componentcore.ui.internal.propertypage.FolderMappingWizardFragment.java
License:Open Source License
protected ISelectionChangedListener getListener() { return new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection sel = (IStructuredSelection) viewer.getSelection(); Object first = sel.getFirstElement(); if (first instanceof IContainer) { selected = (IContainer) first; String errorMessage = validateFolder(); if (errorMessage != null) handle.setMessage(errorMessage, IMessageProvider.ERROR); else handle.setMessage(Messages.AddFolderMappings, IMessageProvider.NONE); handle.update();//from w w w.jav a2 s . co m } } }; }
From source file:org.eclipse.wst.jsdt.internal.ui.preferences.AbstractRuntimeInstallPage.java
License:Open Source License
/** * Updates the status message on the page, based on the status of the VM and other * status provided by the page./*from w w w . j av a2s. c o m*/ */ protected void updatePageStatus() { IStatus max = Status.OK_STATUS; IStatus[] vmStatus = getRuntimeStatus(); for (int i = 0; i < vmStatus.length; i++) { IStatus status = vmStatus[i]; if (status.getSeverity() > max.getSeverity()) { max = status; } } if (fNameStatus.getSeverity() > max.getSeverity()) { max = fNameStatus; } if (max.isOK()) { setMessage(null, IMessageProvider.NONE); } else { setStatusMessage(max); } setPageComplete(max.isOK() || max.getSeverity() == IStatus.INFO); }
From source file:org.eclipse.wst.jsdt.internal.ui.refactoring.ExtractConstantWizard.java
License:Open Source License
protected void addUserInputPages() { String message = null;/* w w w . j av a 2 s . c om*/ int messageType = IMessageProvider.NONE; if (!getExtractConstantRefactoring().selectionAllStaticFinal()) { message = RefactoringMessages.ExtractConstantInputPage_selection_refers_to_nonfinal_fields; messageType = IMessageProvider.INFORMATION; } else { message = MESSAGE; messageType = IMessageProvider.NONE; } String[] guessedNames = getExtractConstantRefactoring().guessConstantNames(); String initialValue = guessedNames.length == 0 ? "" : guessedNames[0]; //$NON-NLS-1$ addPage(new ExtractConstantInputPage(message, messageType, initialValue, guessedNames)); }
From source file:org.eclipse.wst.jsdt.internal.ui.refactoring.InlineConstantWizard.java
License:Open Source License
protected void addUserInputPages() { String message = null;/*w w w .ja v a2 s. c om*/ int messageType = IMessageProvider.NONE; if (!getInlineConstantRefactoring().isInitializerAllStaticFinal()) { message = RefactoringMessages.InlineConstantWizard_initializer_refers_to_fields; messageType = IMessageProvider.INFORMATION; } else { message = MESSAGE; messageType = IMessageProvider.NONE; } addPage(new InlineConstantInputPage(message, messageType)); }
From source file:org.eclipse.wst.server.http.ui.internal.HttpRuntimeComposite.java
License:Open Source License
protected void validate() { if (runtime == null) { wizard.setMessage("", IMessageProvider.ERROR); return;//from w ww .j a v a 2s .c o m } wizard.setMessage(null, IMessageProvider.NONE); if (runtimeWC != null) { String name2 = runtimeWC.getName(); if (name2 == null || name2.trim().equals("")) { wizard.setMessage(Messages.wizardMissingRuntimeName, IMessageProvider.ERROR); } else { boolean ok = checkRuntimeName(name2); if (!ok) { wizard.setMessage(Messages.wizardDuplicateName, IMessageProvider.ERROR); } } } wizard.update(); }
From source file:org.eclipse.wst.server.http.ui.internal.HttpServerComposite.java
License:Open Source License
protected void validate() { wizard.setMessage(null, IMessageProvider.NONE); if (server != null && server.isPublishing()) { IPath path = serverWC.getRuntime().getLocation(); if (path == null || !path.toFile().exists()) wizard.setMessage(Messages.wizardMissingPublishInfo, IMessageProvider.ERROR); }/*from w w w . j av a2s . c o m*/ wizard.update(); }