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:com.motorolamobility.studio.android.certmanager.ui.wizards.RemoveExternalPackageSignaturePage.java
License:Apache License
/** * Validates if the source directory is valid one * //from w w w . j a v a2s. c o m * @return true if the source dir text is valid, false otherwise */ private boolean isSourceDirValid() { String messageAux = null; int severity = IMessageProvider.NONE; /* * Check if the selected location is valid, even if non existent. */ IPath path = new Path(this.sourceDirText.getText()); // Test if path is blank, to warn user instead of show an error message if (this.sourceDirText.getText().equals("")) //$NON-NLS-1$ { messageAux = CertificateManagerNLS.SIGN_EXTERNAL_PKG_WIZARD_SOURCE_DIR_EMPTY; severity = IMessageProvider.INFORMATION; } /* * Do Win32 Validation */ if ((messageAux == null) && Platform.getOS().equalsIgnoreCase(Platform.OS_WIN32)) { // test path size if (path.toString().length() > 255) { messageAux = CertificateManagerNLS.SELECTOR_MESSAGE_LOCATION_ERROR_PATH_TOO_LONG; severity = IMessageProvider.WARNING; } String device = path.getDevice(); File deviceFile = null; if (device != null) { deviceFile = new File(path.getDevice()); } if ((device != null) && !deviceFile.exists()) { messageAux = CertificateManagerNLS.SELECTOR_MESSAGE_LOCATION_ERROR_INVALID_DEVICE + " [" + device + "]"; severity = IMessageProvider.ERROR; } } // test if path is absolute if (messageAux == null) { if (!path.isAbsolute() || !path.toFile().exists()) { messageAux = CertificateManagerNLS.SIGN_EXTERNAL_PKG_WIZARD_SOURCE_DIR_INVALID; severity = IMessageProvider.ERROR; } } if (messageAux == null) { for (String folderName : path.segments()) { if (!ResourcesPlugin.getWorkspace().validateName(folderName, IResource.FOLDER).isOK()) { messageAux = CertificateManagerNLS.SIGN_EXTERNAL_PKG_WIZARD_SOURCE_DIR_INVALID; severity = IMessageProvider.ERROR; } } } if ((messageAux == null) && ((path.toFile().exists() && !path.toFile().isDirectory()))) { messageAux = CertificateManagerNLS.SIGN_EXTERNAL_PKG_WIZARD_SOURCE_DIR_NOT_DIRECTORY; severity = IMessageProvider.ERROR; } /* * Setting message */ if (messageAux == null) { messageAux = CertificateManagerNLS.SIGN_EXTERNAL_PKG_WIZARD_DESCRIPTION; severity = IMessageProvider.NONE; } setMessage(messageAux, severity); return severity == IMessageProvider.NONE; }
From source file:com.motorolamobility.studio.android.certmanager.ui.wizards.RemoveExternalPackageSignaturePage.java
License:Apache License
/** * Update the page status, validating each field of this page Subclasses * that overrides createExtendedArea method should override this method too * to validate the new fields//from w ww . j av a2s . com */ public void updatePageComplete() { String messageAux = null; int severity = IMessageProvider.NONE; /* * Check if there are available certificates and if selection isn't null */ if (isSourceDirValid()) { if (this.packagesTree.getItemCount() == 0) { messageAux = CertificateManagerNLS.SIGN_EXTERNAL_PKG_WIZARD_NO_AVAILABLE_PACKAGES; severity = IMessageProvider.ERROR; } } else { messageAux = getMessage(); severity = getMessageType(); } if ((messageAux == null) && (getSelectedPackages().size() == 0)) { messageAux = CertificateManagerNLS.UNSIGN_EXTERNAL_PKG_WIZARD_NO_PACKAGES_SELECTED; severity = IMessageProvider.INFORMATION; } if (messageAux == null) { messageAux = CertificateManagerNLS.UNSIGN_EXTERNAL_PKG_WIZARD_DESCRIPTION; severity = IMessageProvider.NONE; } setMessage(messageAux, severity); setPageComplete(severity == IMessageProvider.NONE); }
From source file:com.motorolamobility.studio.android.certmanager.ui.wizards.SignExternalPackagePage.java
License:Apache License
/** * Update the page status, validating each field of this page The basic * validation is made by superclass//from w ww . ja v a2 s. c o m */ @Override public void updatePageComplete() { super.updatePageComplete(); int severity = getMessageType(); String messageAux = severity == IMessageProvider.NONE ? null : getMessage(); if (messageAux == null) { if (!(((this.keystoreCombo != null) && (this.keystoreCombo.getItemCount() > 0) && (this.keystoreCombo.getItem(this.keystoreCombo.getSelectionIndex()) != null) && !this.keystoreCombo.getItem(this.keystoreCombo.getSelectionIndex()).equalsIgnoreCase("")) //$NON-NLS-1$ && ((this.keysCombo != null) && (this.keysCombo.getItemCount() > 0) && (this.keysCombo.getItem(this.keysCombo.getSelectionIndex()) != null) && !this.keysCombo.getItem(this.keysCombo.getSelectionIndex()).equalsIgnoreCase("")))) //$NON-NLS-1$ { messageAux = CertificateManagerNLS.SIGN_EXTERNAL_PKG_WIZARD_NO_CERTIFICATE_ERROR; severity = IMessageProvider.ERROR; } if (messageAux == null) { messageAux = CertificateManagerNLS.SIGN_EXTERNAL_PKG_WIZARD_DESCRIPTION; severity = IMessageProvider.NONE; } setMessage(messageAux, severity); setPageComplete(severity == IMessageProvider.NONE); } }
From source file:com.nextep.designer.vcs.ui.services.impl.CommonUIService.java
License:Open Source License
private void fillMessages(ITypedObject model, IMessageManager msgManager) { final Collection<IMarker> markers = markerService.getMarkersFor(model); for (IMarker m : markers) { int msgType = IMessageProvider.NONE; switch (m.getMarkerType()) { case ERROR: msgType = IMessageProvider.ERROR; break; case WARNING: msgType = IMessageProvider.WARNING; break; default://from w w w. j a v a 2 s .co m msgType = IMessageProvider.INFORMATION; } msgManager.addMessage(m, m.getMessage(), m, msgType); } }
From source file:com.nokia.carbide.cpp.internal.project.ui.editors.common.ControlManager.java
License:Open Source License
private void setValidationFailureMessage(String message) { if (statusLineManager != null) { statusLineManager.setErrorMessage(message); }//from w w w.j a v a2 s. c o m if (form != null) { form.setMessage(message, IMessageProvider.ERROR); } }
From source file:com.nokia.cdt.internal.debug.launch.newwizard.AbstractLaunchSettingsDialog.java
License:Open Source License
protected int severityToMsgType(int severity) { switch (severity) { case IStatus.OK: case IStatus.CANCEL: default:// w w w . j a v a2 s .c o m break; case IStatus.INFO: return IMessageProvider.INFORMATION; case IStatus.ERROR: return IMessageProvider.ERROR; case IStatus.WARNING: return IMessageProvider.WARNING; } return IMessageProvider.NONE; }
From source file:com.observability.modeling.common.UI.java
License:Open Source License
/** * This method gets the server details (ip and port) where the ModelHandler RMI service * is running. It shows an input dialog where the user would enter the ip and port where * the RMI service is running. /*from w w w . j a v a2 s . c o m*/ * If the user presses Cancel, the action would be cancelled and nothing would be done. * * The user input is validated before being accepted. Currently only ipv4 addresses are accepted. * * @param messageType the type of the message to be shown in the dialog box. * The values should be used from JOptionPane class. * @param message Any additional message which needs to be appended before the default input message * * @return A String array containing ip and port. Index 0 contains ip, index 1 contains port */ public String[] getServerDetails(int messageType, String message) { String input = null; // create the input dialog box ipPortInputDialog.create(messageType, (message + Messages.Ui_MSG_INFO_ENTER_IP_PORT)); // open the input dialog box and take user input if (ipPortInputDialog.open() == org.eclipse.jface.window.Window.OK) { input = ipPortInputDialog.getIpPort(); } if (input == null || input.equals("")) { //user has pressed cancel button or has not entered anything Take confirmation from user String msg = Messages.Ui_MSG_INFO_SERVER_CANCEL; boolean option = MessageDialog.openConfirm(shell, SERVER_DETAILS_TITLE, msg); if (option) { // Do not transfer files to server return new String[0]; } else { // show the box again return getServerDetails(IMessageProvider.NONE, ""); } } else { //validate input String ipRegex = "(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}):(\\d{1,5})"; Pattern pattern = Pattern.compile(ipRegex); Matcher matcher = pattern.matcher(input); String[] serverDetails = new String[2]; if (matcher.matches()) { serverDetails[0] = matcher.group(1); //ip serverDetails[1] = matcher.group(2); //port return serverDetails; } else { //wrong input. Get input again return getServerDetails(IMessageProvider.ERROR, Messages.Ui_MSG_ERROR_WRONG_INPUT); } } }
From source file:com.openlegacy.enterprise.ide.eclipse.editors.pages.details.jpa.FieldsJpaManyToOneFieldDetailsPage.java
License:Open Source License
private boolean validateJavaTypeControl(TextValidator validator, UUID uuid) { boolean isValid = true; String text = validator.getControl().getText(); String fullyQuailifiedName = (String) validator.getControl() .getData(FormRowCreator.ID_FULLY_QUALIFIED_NAME); if (StringUtils.isEmpty(text)) { isValid = false;/*ww w . jav a 2 s . c o m*/ } if (isValid && StringUtils.equalsIgnoreCase(text, void.class.getSimpleName())) { isValid = false; } if (!isValid) { validator.addMessage(Messages.getString("validation.java.type.must.be.specified"), //$NON-NLS-1$ IMessageProvider.ERROR, uuid); return isValid; } if (getEntity().getEntityFullyQualifiedName().equals(fullyQuailifiedName)) { isValid = false; } if (!isValid) { validator.addMessage(Messages.getString("validation.java.type.equal.to.current.entity"), //$NON-NLS-1$ IMessageProvider.ERROR, uuid); } return isValid; }
From source file:com.openlegacy.enterprise.ide.eclipse.editors.pages.jpa.ActionsPape.java
License:Open Source License
private void validateTargetEntityColumn(ActionModel model) { Class<?> targetEntity = model.getTargetEntity(); boolean isJpaEntity = false; for (Annotation annotation : targetEntity.getDeclaredAnnotations()) { if (annotation.annotationType().getName().equals(Entity.class.getName())) { isJpaEntity = true;/*from w w w . j a v a 2 s . c om*/ break; } } String validationMarkerKey = MessageFormat.format("{0}-{1}", model.getUuid(), "targetEntity");//$NON-NLS-1$ //$NON-NLS-2$ JpaEntityEditor editor = (JpaEntityEditor) getEntityEditor(); if (isJpaEntity || targetEntity.getName().equals(void.class.getName())) { // remove validation marker managedForm.getMessageManager().removeMessage(validationMarkerKey); editor.removeValidationMarker(validationMarkerKey); } else { // add validation marker String message = MessageFormat.format("Target entity: {0} \n {1}", targetEntity.getName(), //$NON-NLS-1$ Messages.getString("validation.selected.class.is.not.jpa.entity"));//$NON-NLS-1$ managedForm.getMessageManager().addMessage(validationMarkerKey, message, null, IMessageProvider.ERROR); editor.addValidationMarker(validationMarkerKey, message); } }
From source file:com.opera.widgets.ui.editor.validation.AbstractControlValidation.java
License:Open Source License
public boolean validate() { if (enabled == false) { return valid; }//from w w w .j av a 2 s .c o m valid = validateControl(); if (valid) { managedForm.getMessageManager().removeMessages(control); } else { addMessage(getMessage(), IMessageProvider.ERROR); } return valid; }