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:com.motorolamobility.preflighting.ui.wizards.ApkValidationWizardPage.java
License:Apache License
/** * Validates if the source directory is valid one * //from www. ja v a 2s .c om * @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 = PreflightingUiNLS.ApkValidationWizardPage_emptyListMsg; severity = IMessageProvider.INFORMATION; } /* * Do Win32 Validation */ if ((messageAux == null) && Platform.getOS().equalsIgnoreCase(Platform.OS_WIN32)) { // test path size if (path.toString().length() > 255) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_tooLongMsg; severity = IMessageProvider.WARNING; } String device = path.getDevice(); File deviceFile = null; if (device != null) { deviceFile = new File(path.getDevice()); } if ((device != null) && !deviceFile.exists()) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_invalidDeviceMsg + " [" + device + "]"; //$NON-NLS-2$ //$NON-NLS-3$ severity = IMessageProvider.ERROR; } } // test if path is absolute if (messageAux == null) { if (!path.isAbsolute() || !path.toFile().exists()) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_invalidFolderMsg; severity = IMessageProvider.ERROR; } } if (messageAux == null) { for (String folderName : path.segments()) { if (!ResourcesPlugin.getWorkspace().validateName(folderName, IResource.FOLDER).isOK()) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_invalidFolderMsg; severity = IMessageProvider.ERROR; } } } if ((messageAux == null) && ((path.toFile().exists() && !path.toFile().isDirectory()))) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_invalidSourceDirectoryMsg; severity = IMessageProvider.ERROR; } /* * Setting message */ if (messageAux == null) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_validateMsg; severity = IMessageProvider.NONE; } setMessage(messageAux, severity); return severity == IMessageProvider.NONE; }
From source file:com.motorolamobility.preflighting.ui.wizards.ApkValidationWizardPage.java
License:Apache License
/** * Update the page status, validating each field of this page Subclasses *//*from www . j a va 2 s. c o m*/ public void updatePageComplete() { String messageAux = null; int severity = IMessageProvider.NONE; if (isSourceDirValid()) { if (this.packagesTree.getItemCount() == 0) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_emptyFolderMsg; severity = IMessageProvider.ERROR; } } else { messageAux = getMessage(); severity = getMessageType(); } if ((messageAux == null) && (getSelectedPackages().size() == 0)) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_onePackageMsg; severity = IMessageProvider.INFORMATION; } if (messageAux == null) { messageAux = PreflightingUiNLS.ApkValidationWizardPage_validateMsg; severity = IMessageProvider.NONE; } setMessage(messageAux, severity); setPageComplete(severity == IMessageProvider.NONE); }
From source file:com.motorolamobility.studio.android.certmanager.ui.wizards.CreateKeystorePage.java
License:Apache License
private void validatePage() { boolean pageComplete = true; String errorMessage = null;/*from w w w . j a va2s . c o m*/ String message = CertificateManagerNLS.CreateKeystorePage_WizardDefaultMessage; int messageType = IMessageProvider.NONE; if (initialValidation == true) { //when the wizard opens, does not show any errors pageComplete = false; initialValidation = false; } else { //password text and confirmation password text must match if (!keystorePasswordText.getText().equals(keystoreConfirmPasswordText.getText())) { //if the user hasn't started typing the confirmation password, //then just show an info, instead of an error if (userChangedPasswordConfirmation) { errorMessage = CertificateManagerNLS.CreateKeystorePage_PasswordDoesNotMatch; pageComplete = false; } else { message = CertificateManagerNLS.CreateKeystorePage_ConfirmPasswordInfoMsg; messageType = IMessageProvider.INFORMATION; pageComplete = false; } } //check password size according to keytool specification if (keystorePasswordText.getText().length() < KeyStoreNode.KEYSTORE_PASSWORD_MIN_SIZE) { if (userChangedPassword) { errorMessage = CertificateManagerNLS.bind( CertificateManagerNLS.CreateKeystorePage_PasswordMinSizeMessage, KeyStoreNode.KEYSTORE_PASSWORD_MIN_SIZE); //$NON-NLS-1$ pageComplete = false; } else { message = CertificateManagerNLS.CreateKeystorePage_SetPasswordInfoMsg; messageType = IMessageProvider.INFORMATION; pageComplete = false; } } //check if store type is filled if (keystoreTypeComboViewer.getCombo().getText().isEmpty()) { errorMessage = CertificateManagerNLS.CreateKeystorePage_SetKeystoreType; pageComplete = false; } //check if filename is valid try { File keystoreFile = new File(keystoreFilenameText.getText().trim()); Path keystorePath = new Path(keystoreFilenameText.getText().trim()); if (!keystorePath.isValidPath(keystoreFile.getCanonicalPath())) { //throw the same exception as getCanonicalPath() in order to do not duplicate code throw new IOException(); } } catch (IOException e) { errorMessage = CertificateManagerNLS.CreateKeystorePage_FilenameSyntaxError; pageComplete = false; } if (keystoreFilenameText.getText().trim().isEmpty()) { errorMessage = CertificateManagerNLS.ImportKeystorePage_FilenameCannotBeEmpty; pageComplete = false; } } setMessage(message, messageType); setErrorMessage(errorMessage); setPageComplete(pageComplete); }
From source file:com.motorolamobility.studio.android.certmanager.ui.wizards.RemoveExternalPackageSignaturePage.java
License:Apache License
/** * Validates if the source directory is valid one * // w w w .j a v a 2 s. co 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 w w . jav a2 s . c o m */ 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// w ww.j a v a 2s .co 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 www . j av a 2 s . c o m*/ msgType = IMessageProvider.INFORMATION; } msgManager.addMessage(m, m.getMessage(), m, msgType); } }
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://from ww w. j a v a 2 s. co 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.nokia.cdt.internal.debug.launch.newwizard.AbstractLaunchSettingsDialog.java
License:Open Source License
protected void updateStatus(final IStatus status) { Display.getDefault().asyncExec(new Runnable() { public void run() { setTitle(title);/*from www .j a v a2s .com*/ if (status.isOK()) { setMessage("", IMessageProvider.NONE); //$NON-NLS-1$ } else { setMessage(status.getMessage(), severityToMsgType(status.getSeverity())); } setOkEnabled(!status.matches(IStatus.ERROR)); } }); }
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 .ja v a2s. 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); } } }