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.microsoft.tfs.client.common.ui.framework.validation.DialogPageValidatorBinding.java
License:Open Source License
@Override protected void update(final IValidity validity) { if (!firstTime && validity != null && validity.getSeverity() != Severity.OK) { final IValidationMessage message = validity.getFirstMessage(); if (message != null && message.getMessage() != null) { final int type = message.getSeverity() == Severity.WARNING ? IMessageProvider.WARNING : IMessageProvider.ERROR; dialogPage.setMessage(message.getMessage(), type); return; }//ww w . j ava 2 s . co m } dialogPage.setMessage(null); return; }
From source file:com.microsoft.tfs.client.eclipse.ui.egit.importwizard.WizardCrossCollectionRepoSelectionPage.java
License:Open Source License
private IStatus cloneRepository(final UsernamePasswordCredentials credentials, final ImportGitRepository repository) { setMessage(MessageFormat.format(Messages.getString("GitImportWizardClonePage.CloningMessageFormat"), //$NON-NLS-1$ repository.getName()));//from ww w.j a v a 2 s . co m repository.setRemoteName("origin"); //$NON-NLS-1$ repository.setCloneStatus(ImportGitRepository.CLONE_IN_PROGRESS); final CloneGitRepositoryCommand cloneCommand = createCloneCommand(credentials, repository); IStatus status; try { status = this.getCommandExecutor().execute(CommandFactory.newCancelableCommand(cloneCommand)); if (status.getSeverity() == IStatus.CANCEL) { repository.setCloneStatus(ImportGitRepository.CLONE_CANCELLED); setMessage(Messages.getString("GitImportWizardClonePage.CloneCancelledMessageText"), //$NON-NLS-1$ IMessageProvider.WARNING); } else if (status.getSeverity() == IStatus.ERROR) { repository.setCloneStatus(ImportGitRepository.CLONE_ERROR); setMessage(MessageFormat.format( Messages.getString("GitImportWizardClonePage.CloneFailedMessageFormat"), //$NON-NLS-1$ status.getMessage()), IMessageProvider.ERROR); } else { if (repository.getBranches() == null || repository.getBranches().length == 0) { repository.setCloneStatus(ImportGitRepository.CLONE_EMPTY_REPOSITORY); } else { repository.setCloneStatus(ImportGitRepository.CLONE_FINISHED); } setMessage(null); } } catch (final Exception e) { logger.error(e.getMessage(), e); repository.setCloneStatus(ImportGitRepository.CLONE_ERROR); setMessage(e.getLocalizedMessage(), IMessageProvider.ERROR); status = new Status(IStatus.ERROR, TFSCommonClientPlugin.PLUGIN_ID, 0, e.getLocalizedMessage(), e); } return status; }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java
License:Open Source License
/** * Display the given error message. The currently displayed message is saved * and will be redisplayed when the error message is set to * <code>null</code>.// w w w .ja va 2s.c om * * @param newErrorMessage the errorMessage to display or <code>null</code> */ public void setErrorMessage(String newErrorMessage) { if (newErrorMessage == null) { messageArea.clearErrorMessage(); } else { messageArea.updateText(newErrorMessage, IMessageProvider.ERROR); } }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java
License:Open Source License
public void updateMessage() { String message = null;// w w w .java 2 s.c o m String errorMessage = null; if (currentPage != null) { message = currentPage.getMessage(); errorMessage = currentPage.getErrorMessage(); } int messageType = IMessageProvider.NONE; if (message != null && currentPage instanceof IMessageProvider) { messageType = ((IMessageProvider) currentPage).getMessageType(); } if (errorMessage == null) { if (showingError) { // we were previously showing an error showingError = false; } } else { message = errorMessage; messageType = IMessageProvider.ERROR; if (!showingError) { // we were not previously showing an error showingError = true; } } messageArea.updateText(message, messageType); }
From source file:com.mobilesorcery.sdk.builder.iphoneos.Activator.java
License:Open Source License
/** * Validates a UTI, which is used for bundler identifiers etc. * @param ignoreParameters /*from w w w .j a v a 2 s .com*/ * @param uti * @return */ public IMessageProvider validateBundleIdentifier(String bundleId, boolean ignoreParameters) { String message = null; int messageType = IMessageProvider.ERROR; if (Util.isEmpty(bundleId)) { message = "Bundle identifier cannot be empty"; } else if (bundleId.contains("..")) { message = MessageFormat.format("Bundle identifier cannot have empty segment ({0})", bundleId); } else if (bundleId.endsWith(".") || bundleId.startsWith(".")) { message = MessageFormat.format("Bundle identifier cannot start or end with '.' ({0})", bundleId); } else if (containsInvalidChars(bundleId, ignoreParameters)) { message = MessageFormat .format("Bundle identifier segments can only contain letters, digits and '-'. ({0})", bundleId); } else if (!bundleId.startsWith("com.")) { message = "Bundle identifier should start with 'com.'"; messageType = IMessageProvider.WARNING; } else if (bundleId.split("\\.").length != 3) { message = "Recommended bundle identifier format: com.YOURCOMPANY.YOURAPP"; messageType = IMessageProvider.WARNING; } return Util.isEmpty(message) ? DefaultMessageProvider.EMPTY : new DefaultMessageProvider(message, messageType); }
From source file:com.mobilesorcery.sdk.builder.iphoneos.IPhoneOSPackager.java
License:Open Source License
@Override protected void addPlatformSpecifics(MoSyncProject project, IBuildVariant variant, CommandLineBuilder commandLine) throws Exception { DefaultPackager internal = new DefaultPackager(project, variant); // We do not yet support configuration specific certs. String cert = getCertificate(project, variant); commandLine.flag("--ios-cert").with(cert); String version = internal.get(DefaultPackager.APP_VERSION); String ver = new Version(version).asCanonicalString(Version.MICRO); commandLine.flag("--version").with(ver); String bundleId = project.getProperty(PropertyInitializer.IOS_BUNDLE_IDENTIFIER); commandLine.flag("--ios-bundle-id").with(bundleId); IMessageProvider message = Activator.getDefault().validateBundleIdentifier(internal.resolve(bundleId), false);/* ww w . j av a2 s . co m*/ if (message.getMessageType() == IMessageProvider.ERROR) { throw new IllegalArgumentException(message.getMessage()); } else if (message.getMessageType() == IMessageProvider.WARNING) { getBuildConsole().addMessage(IProcessConsole.ERR, MessageFormat.format("WARNING: {0}", message.getMessage())); } if (!shouldBuildWithXcode(project, variant)) { commandLine.flag("--ios-project-only"); } else { SDK sdk = getSDK(project, variant); commandLine.flag("--ios-sdk").with(sdk.getId()); String target = getXcodeTarget(project, variant); commandLine.flag("--ios-xcode-target").with(target); } commandLine.flag("--cpp-output").with(internal.resolveFile("%program-output%").getParent()); }
From source file:com.mobilesorcery.sdk.ui.internal.properties.BuildSettingsPropertyPage.java
License:Open Source License
@Override protected void validate() { ValidationMessageProvider message = new ValidationMessageProvider(); if (appName.getText().indexOf('.') != -1) { message.setMessage(appName, new DefaultMessageProvider("Application name should not have an extension", IMessageProvider.ERROR)); }// w w w . j a v a2 s . co m validatePathsField(message, "Additional Libraries", additionalLibrariesText, null); validatePathsField(message, "Additional Library Paths", additionalLibraryPathsText, null); validatePathsField(message, "Additional Include Paths", additionalIncludePathsText, null); validateMemorySettings(message); if (libraryProjectType.getSelection()) { if (libOutputPath.getText().length() > 0 && Util.getExtension(new File(libOutputPath.getText())).length() == 0) { message.setMessage(libOutputPath, new DefaultMessageProvider("Output file has no extension", IMessageProvider.WARNING)); } if (libOutputPath.getText().length() == 0) { message.setMessage(libOutputPath, new DefaultMessageProvider("Library output file must be set", IMessageProvider.ERROR)); } } setMessage(message); }
From source file:com.mobilesorcery.sdk.ui.internal.properties.BuildSettingsPropertyPage.java
License:Open Source License
private void validateMemorySettings(ValidationMessageProvider provider) { if (!new Version(version.getText()).isValid()) { provider.setMessage(version,//from w ww .j a v a2s .com new DefaultMessageProvider( "Invalid version format, must comply to major[.minor][.micro][.qualifier]", IMessageProvider.ERROR)); } provider.setMessage(stackSize, validateInteger(stackSize.getText(), "Stack size", 1L << 22)); provider.setMessage(heapSize, validateInteger(heapSize.getText(), "Heap size", 1L << 22)); provider.setMessage(dataSize, validateInteger(dataSize.getText(), "Data size", 1L << 22)); if (provider.isEmpty(stackSize) && provider.isEmpty(heapSize) && provider.isEmpty(dataSize)) { // They're all integers long stackSize = Long.parseLong(this.stackSize.getText()); long heapSize = Long.parseLong(this.heapSize.getText()); long dataSize = Long.parseLong(this.dataSize.getText()); if (dataSize < stackSize + heapSize) { provider.setMessage(this.dataSize, new DefaultMessageProvider( "Data size must be at least as large as the stack and heap sizes combined", IMessageProvider.ERROR)); } else if (ceil2p(dataSize) != dataSize) { provider.setMessage(this.dataSize, new DefaultMessageProvider(MessageFormat .format("Will round up data size to nearest power of 2 ({0} kb)", ceil2p(dataSize)), IMessageProvider.INFORMATION)); } } }
From source file:com.mobilesorcery.sdk.ui.internal.properties.BuildSettingsPropertyPage.java
License:Open Source License
private IMessageProvider validateInteger(String value, String fieldName, long max) { try {/* www .ja va 2s. co m*/ long numericalValue = Long.parseLong(value); if (numericalValue > max) { return new DefaultMessageProvider( MessageFormat.format("Value of {0} too large; must be no more than {1}", fieldName, max), IMessageProvider.ERROR); } } catch (Exception e) { return new DefaultMessageProvider(MessageFormat.format("{0} must be an integer value", fieldName), IMessageProvider.ERROR); } return DefaultMessageProvider.EMPTY; }
From source file:com.mobilesorcery.sdk.ui.MoSyncPropertyPage.java
License:Open Source License
protected void setMessage(IMessageProvider message) { String messageStr = message == null ? null : message.getMessage(); int messageType = message == null ? IMessageProvider.NONE : message.getMessageType(); setMessage(messageStr, messageType); setValid(DefaultMessageProvider.isEmpty(message) || message.getMessageType() != IMessageProvider.ERROR); if (message instanceof ValidationMessageProvider) { validationHelper.setMessage((ValidationMessageProvider) message); }/*from ww w . j av a 2s. c om*/ }