Example usage for org.eclipse.jface.dialogs IMessageProvider WARNING

List of usage examples for org.eclipse.jface.dialogs IMessageProvider WARNING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider WARNING.

Prototype

int WARNING

To view the source code for org.eclipse.jface.dialogs IMessageProvider WARNING.

Click Source Link

Document

Constant for a warning message (value 2).

Usage

From source file:com.microsoft.tfs.client.eclipse.ui.egit.importwizard.GitImportWizardSelectProjectsPage.java

License:Open Source License

public boolean isValid() {

    final ImportEclipseProject[] selectedProjects = getSelectedProjects();

    if (selectedProjects.length == 0) {
        setMessage(/*w  w  w.  j a va2 s  . c o m*/
                Messages.getString("GitImportWizardSelectProjectsPage.NoEclipseProjectImportedWarningMessage"), //$NON-NLS-1$
                IMessageProvider.WARNING);
        return true;
    }

    if (workspaceProjectNameCollision(selectedProjects)) {
        return false;
    }

    if (duplicateProjectNamesSelected(selectedProjects)) {
        return false;
    }

    setErrorMessage(null);
    setMessage(null);
    return true;
}

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 w w  w.  j a v  a 2s . com
    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.mobilesorcery.sdk.builder.android.ui.properties.AndroidSigningPropertyPage.java

License:Open Source License

private void handleSecurePropertyException(SecurePropertyException e) {
    setMessage(new DefaultMessageProvider(e.getMessage(), IMessageProvider.WARNING));
}

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.  ja va2 s  .c  o m*/
 * @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);/*from   www.j  a  v a2 s. c  om*/
    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.builder.s60.ui.properties.SymbianSigningPropertyPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite main = new Composite(parent, SWT.NONE);
    main.setLayout(new GridLayout(1, false));

    useProjectSpecific = new Button(main, SWT.CHECK);
    useProjectSpecific.setText(Messages.SymbianSigningPropertyPage_EnableProjectSpecific);

    useProjectSpecific// w  w w  .  j  a  va  2  s . c  om
            .setSelection(PropertyUtil.getBoolean(getProject(), PropertyInitializer.S60_PROJECT_SPECIFIC_KEYS));
    useProjectSpecific.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            updateUI();
        }
    });

    Label separator = new Label(main, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    signingGroup = new Group(main, SWT.NONE);
    signingGroup.setText(Messages.SymbianSigningPropertyPage_Signing);
    signingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    keyFile = new FileFieldEditor("dummy.1", Messages.SymbianSigningPropertyPage_KeyFile, signingGroup); //$NON-NLS-1$
    keyFile.setPage(this);
    certFile = new FileFieldEditor("dummy.2", Messages.SymbianSigningPropertyPage_CertificateFile, //$NON-NLS-1$
            signingGroup);
    certFile.setPage(this);

    String keyFilePath = getProject().getProperty(PropertyInitializer.S60_KEY_FILE);
    keyFile.setStringValue(keyFilePath == null ? "" : keyFilePath); //$NON-NLS-1$

    String certFilePath = getProject().getProperty(PropertyInitializer.S60_CERT_FILE);
    certFile.setStringValue(certFilePath == null ? "" : certFilePath); //$NON-NLS-1$

    passkeyLabel = new Label(signingGroup, SWT.NONE);
    passkeyLabel.setText(Messages.SymbianSigningPropertyPage_Passkey);

    passkey = new Text(signingGroup, SWT.BORDER | SWT.SINGLE);
    passkeyDec = new PasswordTextFieldDecorator(passkey);
    GridData passkeyData = new GridData(GridData.FILL_HORIZONTAL);
    passkeyData.horizontalSpan = 2;
    passkey.setLayoutData(passkeyData);

    String passKeyValue = getProject().getProperty(PropertyInitializer.S60_PASS_KEY);
    passkey.setText(passKeyValue == null ? "" : passKeyValue);

    setMessage("The passkey will be stored as clear text", IMessageProvider.WARNING);

    updateUI();

    return main;
}

From source file:com.mobilesorcery.sdk.fontsupport.internal.wizard.GenerateMOFWizard.java

License:Open Source License

public void validate() {
    String message = null;/*from   ww  w .j  a v a2  s  . c  o  m*/
    int severity = IMessageProvider.NONE;
    File outputFile = getOutputFile();
    if (outputFile.exists()) {
        message = Messages.GenerateMOFWizard_9;
        severity = IMessageProvider.WARNING;
    }
    mofConfigPage.setMessage(message, severity);
}

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));
    }/*from   ww  w  .jav  a2s .c om*/

    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.motorola.studio.android.common.utilities.ui.PasswordInputDialog.java

License:Apache License

private void setErrorMessage(String errorMsg, int severity) {
    if ((errorMsg == null) || (severity == IMessageProvider.NONE)) {
        image.setImage(null);//from   w w w  . j av  a  2s. c  o  m
        image.setVisible(false);
        message.setText(description);
        getButton(OK).setEnabled(errorMsg == null);
    } else {
        message.setText(errorMsg);
        message.setVisible(true);
        switch (severity) {
        case IMessageProvider.ERROR:
            image.setImage(
                    PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
            break;

        case IMessageProvider.INFORMATION:
            image.setImage(
                    PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK));
            break;

        case IMessageProvider.WARNING:
            image.setImage(
                    PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK));
            break;

        default:
            image.setImage(
                    PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
            break;
        }
        image.setVisible(true);
        getButton(OK).setEnabled(false);
    }
    message.getParent().layout();
}

From source file:com.motorola.studio.android.packaging.ui.export.PackageExportWizardArea.java

License:Apache License

/**
 * Get all projects severities to avoid user selects erroneous projects
 */// w ww. j  a v  a 2 s.  co m
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) {
        StudioLogger.error(PackageExportWizardArea.class, "Impossible to get project severity"); //$NON-NLS-1$
    }
}