List of usage examples for org.eclipse.jface.dialogs IMessageProvider ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs IMessageProvider ERROR.
Click Source Link
From source file:org.eclipse.acceleo.ui.interpreter.view.InterpreterView.java
License:Open Source License
/** * Clears all compilation messages out of the interpreter view. *//* w w w.ja v a2s. c om*/ protected void clearCompilationMessages() { /* * add a dummy message to ensure there is always one while we clear the rest (we'll need to reset the * color without having _all_ messages removed, lest the color stays at its previous state : bug * 357906 in FormHeading.MessageRegion#showMessage(). */ final String dummyMessageKey = "none"; //$NON-NLS-1$ getMessageManager().addMessage(dummyMessageKey, "", IMessageProvider.ERROR); //$NON-NLS-1$ // Remove all actual messages getMessageManager().removeMessage(COMPILATION_MESSAGE_PREFIX); getMessageManager().removeMessages(expressionSection); // Now, reset the color by modifying our (existing) dummy message to a lesser severity getMessageManager().addMessage(dummyMessageKey, "", IMessageProvider.NONE); //$NON-NLS-1$ // Finally, remove our dummy getMessageManager().removeMessage(dummyMessageKey); }
From source file:org.eclipse.acceleo.ui.interpreter.view.InterpreterView.java
License:Open Source License
/** * Clears all evaluation messages out of the interpreter view. *///from w w w. ja va2 s . co m protected void clearEvaluationMessages() { /* * add a dummy message to ensure there is always one while we clear the rest (we'll need to reset the * color without having _all_ messages removed, lest the color stays at its previous state : bug * 357906 in FormHeading.MessageRegion#showMessage(). */ final String dummyMessageKey = "none"; //$NON-NLS-1$ getMessageManager().addMessage(dummyMessageKey, "", IMessageProvider.ERROR); //$NON-NLS-1$ // Remove all actual messages getMessageManager().removeMessage(EVALUATION_INFO_MESSAGE_KEY); getMessageManager().removeMessages(resultSection); // Now, reset the color by modifying our (existing) dummy message to a lesser severity getMessageManager().addMessage(dummyMessageKey, "", IMessageProvider.NONE); //$NON-NLS-1$ // Finally, remove our dummy getMessageManager().removeMessage(dummyMessageKey); }
From source file:org.eclipse.acceleo.ui.interpreter.view.InterpreterView.java
License:Open Source License
/** * Converts an IStatus severity to a IMessageProviderSeverity. * // w ww. jav a 2 s. c om * @param statusSeverity * The status severity to be converted. * @return The corresponding IMessageProvider severity. */ private int convertStatusToMessageSeverity(int statusSeverity) { int severity = IMessageProvider.NONE; switch (statusSeverity) { case IStatus.INFO: severity = IMessageProvider.INFORMATION; break; case IStatus.WARNING: severity = IMessageProvider.WARNING; break; case IStatus.ERROR: severity = IMessageProvider.ERROR; break; default: severity = IMessageProvider.NONE; } return severity; }
From source file:org.eclipse.andmore.android.common.utilities.ui.PasswordInputDialog.java
License:Apache License
public void updateStatus() { String errorMessage = null;//from ww w . j a v a2 s .com int severity = IMessageProvider.NONE; if (oldPasswordText.getText().length() > 0) { oldPassword = oldPasswordText.getText(); } else { errorMessage = ""; oldPassword = null; } if ((errorMessage == null) && changePassword) { if (newPasswordText.getText().length() < passwordMinimumSize) { errorMessage = NLS.bind(UtilitiesNLS.Passwordinput_Error_PasswordMinimumSize, passwordMinimumSize); severity = IMessageProvider.ERROR; } else { if (!newPasswordText.getText().equals(newPasswordConfirmText.getText())) { errorMessage = UtilitiesNLS.Passwordinput_Error_Passwordnotmatch; severity = IMessageProvider.ERROR; } else { newPassword = newPasswordText.getText(); } } } setErrorMessage(errorMessage, severity); }
From source file:org.eclipse.andmore.android.generateviewbylayout.ui.ChooseLayoutItemsDialog.java
License:Apache License
/** * Handles the enablement of the Ok button. It will only be enabled when at * least one table item is checked.// w w w . j av a2s.com */ @Override protected void validate() { super.validate(); if ((getViewer() != null) && (getErrorMessage() == null)) { // set the appropriate message String message = ""; //$NON-NLS-1$ int messageType = IMessageProvider.NONE; // check if at least one table item was selected for (TableItem item : getViewer().getTable().getItems()) { LayoutNode node = (LayoutNode) item.getData(); if (item.getChecked() && (getCodeGeneratorData() != null) && getCodeGeneratorData() .getJavaLayoutData().getVisitor().checkIfAttributeAlreadyDeclared(node, true)) { message = NLS.bind(CodeUtilsNLS.ChooseLayoutItemsDialog_VariableNameInUse_Error, node.getNodeId()); messageType = IMessageProvider.ERROR; break; } } if (messageType == IMessageProvider.NONE) { if (getViewer().getTable().getItemCount() == 0) { message = CodeUtilsNLS.UI_ChooseLayoutItemsDialog_No_Gui_Items_Available; messageType = IMessageProvider.INFORMATION; } else if (hasGuiItemsWithoutId) { message = CodeUtilsNLS.ChooseLayoutItemsDialog_Gui_Items_Available_No_Id; messageType = IMessageProvider.INFORMATION; } else { message = CodeUtilsNLS.ChooseLayoutItemsDialog_DefaultMessage; } } this.setMessage(message, messageType); } }
From source file:org.eclipse.andmore.android.packaging.ui.export.PackageExportWizardArea.java
License:Apache License
/** * This method is responsible to add all the existent descriptor files of * the current workspace in the tree shown in the wizard. */// ww w . j av a2s . c om private void populateTree() { tree.removeAll(); IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); try { for (IProject project : projects) { if (project.isOpen() && (project.getNature(AndroidPlugin.Android_Nature) != null) && !SdkUtils.isLibraryProject(project)) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setData(project); item.setText(project.getName()); item.setImage(projectSeverity.get(project) == IMessageProvider.ERROR ? icon_nok : icon_ok); if (selection.toList().contains(project)) { item.setChecked(true); } } } } catch (CoreException e) { AndmoreLogger.error(PackageExportWizardArea.class, "Error populating tree: " + e.getMessage()); //$NON-NLS-1$ } }
From source file:org.eclipse.andmore.android.packaging.ui.export.PackageExportWizardArea.java
License:Apache License
/** * Get all projects severities to avoid user selects erroneous projects *//*from w ww. java2 s .c om*/ private void validateProjects() { try { for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { if (project.isOpen()) { int sev = project.findMaxProblemSeverity(null, true, IResource.DEPTH_INFINITE); int projectSev; switch (sev) { case IMarker.SEVERITY_ERROR: projectSev = IMessageProvider.ERROR; break; case IMarker.SEVERITY_INFO: projectSev = IMessageProvider.INFORMATION; break; case IMarker.SEVERITY_WARNING: projectSev = IMessageProvider.WARNING; break; default: projectSev = IMessageProvider.NONE; break; } projectSeverity.put(project, new Integer(projectSev)); } } } catch (CoreException e) { AndmoreLogger.error(PackageExportWizardArea.class, "Impossible to get project severity"); //$NON-NLS-1$ } }
From source file:org.eclipse.andmore.internal.welcome.WelcomeWizardPage.java
License:Open Source License
private void validatePage() { String error = null;/*from w w w.java 2 s . c om*/ String warning = null; if (isCreateNew()) { // Make sure that the target installation directory is empty or doesn't exist // (and that it can be created) String path = mNewDirText.getText().trim(); if (path.length() == 0) { error = "Please enter a new directory to install the SDK into"; } else { File file = new File(path); if (file.exists()) { if (file.isDirectory()) { if (!file.canWrite()) { error = "Missing write permission in target directory"; } File[] children = file.listFiles(); if (children != null && children.length > 0) { warning = "The directory is not empty"; } } else { error = "The target must be a directory"; } } else { File parent = file.getParentFile(); if (parent == null || !parent.exists()) { error = "The parent directory does not exist"; } else if (!parent.canWrite()) { error = "No write permission in parent directory"; } } } if (error == null && !mInstallLatestCheckbox.getSelection() && !mInstallCommonCheckbox.getSelection()) { error = "You must choose at least one Android version to install"; } } else { // Make sure that the existing installation directory exists and is valid String path = mExistingDirText.getText().trim(); if (path.length() == 0) { error = "Please enter an existing SDK installation directory"; } else { File file = new File(path); if (!file.exists()) { error = "The chosen installation directory does not exist"; } else { final AtomicReference<String> errorReference = new AtomicReference<String>(); final AtomicReference<String> warningReference = new AtomicReference<String>(); AndmoreAndroidPlugin.getDefault().checkSdkLocationAndId(path, new AndmoreAndroidPlugin.CheckSdkErrorHandler() { @Override public boolean handleError(CheckSdkErrorHandler.Solution solution, String message) { message = message.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$ errorReference.set(message); return false; // Apply/OK must be disabled } @Override public boolean handleWarning(CheckSdkErrorHandler.Solution solution, String message) { message = message.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$ warningReference.set(message); return true; // Apply/OK must be enabled } }); error = errorReference.get(); if (warning == null) { warning = warningReference.get(); } } } } setPageComplete(error == null); if (error != null) { setMessage(error, IMessageProvider.ERROR); } else if (warning != null) { setMessage(warning, IMessageProvider.WARNING); } else { setErrorMessage(null); setMessage(null); } }
From source file:org.eclipse.andmore.internal.wizards.newproject.ApplicationInfoPage.java
License:Open Source License
private void validatePage() { IStatus status = validatePackage(mValues.packageName); if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validActivity = validateActivity(); if (validActivity != null) { status = validActivity;// ww w .ja va 2s . c om } } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validMinSdk = validateMinSdk(); if (validMinSdk != null) { status = validMinSdk; } } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validSourceFolder = validateSourceFolder(); if (validSourceFolder != null) { status = validSourceFolder; } } // If creating a test project to go along with the main project, also validate // the additional test project parameters if (status == null || status.getSeverity() != IStatus.ERROR) { if (mValues.createPairProject) { IStatus validTestProject = ProjectNamePage.validateProjectName(mValues.testProjectName); if (validTestProject != null) { status = validTestProject; } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validTestLocation = validateTestProjectLocation(); if (validTestLocation != null) { status = validTestLocation; } } if (status == null || status.getSeverity() != IStatus.ERROR) { IStatus validTestPackage = validatePackage(mValues.testPackageName); if (validTestPackage != null) { status = new Status(validTestPackage.getSeverity(), AndmoreAndroidPlugin.PLUGIN_ID, validTestPackage.getMessage() + " (in test package)"); } } if (status == null || status.getSeverity() != IStatus.ERROR) { if (mValues.projectName.equals(mValues.testProjectName)) { status = new Status(IStatus.ERROR, AndmoreAndroidPlugin.PLUGIN_ID, "The main project name and the test project name must be different."); } } } } // -- update UI & enable finish if there's no error setPageComplete(status == null || status.getSeverity() != IStatus.ERROR); if (status != null) { setMessage(status.getMessage(), status.getSeverity() == IStatus.ERROR ? IMessageProvider.ERROR : IMessageProvider.WARNING); } else { setErrorMessage(null); setMessage(null); } }
From source file:org.eclipse.andmore.internal.wizards.newproject.ImportPage.java
License:Open Source License
private void validatePage() { IStatus status = null;//from ww w. j av a 2 s.co m // Validate project name -- unless we're creating a sample, in which case // the user will get a chance to pick the name on the Sample page if (mProjectPaths == null || mProjectPaths.isEmpty()) { status = new Status(IStatus.ERROR, AndmoreAndroidPlugin.PLUGIN_ID, "Select a directory to search for existing Android projects"); } else if (mValues.importProjects == null || mValues.importProjects.isEmpty()) { status = new Status(IStatus.ERROR, AndmoreAndroidPlugin.PLUGIN_ID, "Select at least one project"); } else { for (ImportedProject project : mValues.importProjects) { if (mCheckboxTableViewer.getGrayed(project)) { status = new Status(IStatus.ERROR, AndmoreAndroidPlugin.PLUGIN_ID, String.format( "Cannot import %1$s because the project name is in use", project.getProjectName())); break; } else { status = ProjectNamePage.validateProjectName(project.getProjectName()); if (status != null && !status.isOK()) { // Need to insert project name to make it clear which project name // is in violation if (mValues.importProjects.size() > 1) { String message = String.format("%1$s: %2$s", project.getProjectName(), status.getMessage()); status = new Status(status.getSeverity(), AndmoreAndroidPlugin.PLUGIN_ID, message); } break; } else { status = null; // Don't leave non null status with isOK() == true } } } } // -- update UI & enable finish if there's no error setPageComplete(status == null || status.getSeverity() != IStatus.ERROR); if (status != null) { setMessage(status.getMessage(), status.getSeverity() == IStatus.ERROR ? IMessageProvider.ERROR : IMessageProvider.WARNING); } else { setErrorMessage(null); setMessage(null); } }