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

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

Introduction

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

Prototype

int ERROR

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

Click Source Link

Document

Constant for an error message (value 3).

Usage

From source file:com.google.cloud.tools.eclipse.preferences.areas.FieldEditorWrapper.java

License:Apache License

@Override
public IStatus getStatus() {
    // DialogPage has an unfortunately complex set of message possibilities
    String message = messages.getErrorMessage();
    if (message != null) {
        return new Status(IStatus.ERROR, PLUGIN_ID, message);
    }//from ww w  .  ja  va  2 s  .  com
    int messageType = messages.getMessageType();
    switch (messageType) {
    case IMessageProvider.INFORMATION:
        return new Status(IStatus.INFO, PLUGIN_ID, messages.getMessage());
    case IMessageProvider.WARNING:
        return new Status(IStatus.WARNING, PLUGIN_ID, messages.getMessage());
    case IMessageProvider.ERROR:
        return new Status(IStatus.ERROR, PLUGIN_ID, messages.getMessage());
    default:
        return Status.OK_STATUS;
    }
}

From source file:com.google.dart.tools.ui.web.pubspec.DependencyDetailsPage.java

License:Open Source License

private boolean validateVersionConstriants(String version) {
    boolean isValid = PubYamlUtils.isValidVersionConstraintString(version);

    if (isValid) {
        getManagedForm().getMessageManager().removeMessage(VERSION_CONTSTRAINTS_KEY, versionText);
    } else {//from  w w  w. ja v a 2 s. co m
        getManagedForm().getMessageManager().addMessage(VERSION_CONTSTRAINTS_KEY,
                "The version constriant does not have the correct format as in '1.0.0', '<1.5.0', \n'>=2.0.0 <3.0.0', or it contains invalid characters",
                null, IMessageProvider.ERROR, versionText);
    }
    return isValid;
}

From source file:com.google.dart.tools.ui.web.pubspec.OverviewFormPage.java

License:Open Source License

private boolean validateName(String name) {
    IStatus status = DartIdentifierUtil.validateIdentifier(name);
    if (status == Status.OK_STATUS) {
        form.getMessageManager().removeMessage(NAME_MESSAGE_KEY, nameText);
        return true;
    }// w  w  w.j a v a2 s  . c o  m
    if (status.getSeverity() == Status.ERROR) {
        form.getMessageManager().addMessage(NAME_MESSAGE_KEY,
                "The name must be all lowercase, start with an alphabetic character, '_' or '$' and include only [a-z0-9_].",
                null, IMessageProvider.ERROR, nameText);
    }

    return false;
}

From source file:com.google.dart.tools.ui.web.pubspec.OverviewFormPage.java

License:Open Source License

private boolean validateVersion(String version) {
    if (version.isEmpty() || version.matches(PubYamlUtils.PACKAGE_VERSION_EXPRESSION)) {
        form.getMessageManager().removeMessage(VERSION_MESSAGE_KEY, versionText);
        return true;
    }/* w  w  w. j  a  v  a  2s  .co  m*/
    form.getMessageManager().addMessage(VERSION_MESSAGE_KEY,
            "The specified version does not have the correct format (major.minor.patch), or contains invalid characters.",
            null, IMessageProvider.ERROR, versionText);
    return false;
}

From source file:com.google.dart.tools.ui.web.pubspec.OverviewFormPage.java

License:Open Source License

private boolean validateVersionConstriants(String version) {
    boolean isValid = PubYamlUtils.isValidVersionConstraintString(version);

    if (isValid) {
        getManagedForm().getMessageManager().removeMessage(SDK_VERSION_MESSAGE_KEY, sdkVersionText);
    } else {//from w w w.  j av  a  2  s.  c o  m
        getManagedForm().getMessageManager().addMessage(SDK_VERSION_MESSAGE_KEY,
                "The SDK version constriant does not have the correct format as in '1.0.0', '<1.5.0', \n'>=2.0.0 <3.0.0', or it contains invalid characters",
                null, IMessageProvider.ERROR, sdkVersionText);
    }
    return isValid;
}

From source file:com.google.gdt.eclipse.core.ui.AbstractProjectPropertyPage.java

License:Open Source License

/**
 * Converts a standard IStatus's severity into the severity flags used by
 * dialogs and property pages.// w ww  .ja  va  2s. com
 */
protected static int convertSeverity(IStatus status) {
    switch (status.getSeverity()) {
    case IStatus.ERROR:
        return IMessageProvider.ERROR;
    case IStatus.WARNING:
        return IMessageProvider.WARNING;
    case IStatus.INFO:
        return IMessageProvider.INFORMATION;
    default:
        return IMessageProvider.NONE;
    }
}

From source file:com.google.gdt.eclipse.mobile.android.wizards.NewAndroidCloudProjectWizardPage.java

License:Open Source License

/**
 * Sets the error message for the wizard with the given message icon.
 * //from www  . j  ava 2 s . c  om
 * @param message The wizard message type, one of MSG_ERROR or MSG_WARNING.
 * @return As a convenience, always returns messageType so that the caller can
 *         return immediately.
 */
private int setStatus(String message, int messageType) {
    if (message == null) {
        setErrorMessage(null);
        setMessage(null);
    } else if (!message.equals(getMessage())) {
        if (messageType == MSG_NONE) {
            setMessage(message, IMessageProvider.NONE);
        } else if (messageType == MSG_ERROR) {
            setMessage(message, IMessageProvider.ERROR);
        } else {
            setMessage(message, IMessageProvider.WARNING);
        }
    }
    return messageType;
}

From source file:com.googlecode.osde.internal.editors.locale.AddMessageDialog.java

License:Apache License

private boolean validate() {
    String name = nameText.getText();
    if (StringUtils.isEmpty(name)) {
        setMessage("Please fill the name field.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }/*from   w ww  . ja va 2  s.  co  m*/
    setMessage(null);
    getButton(IDialogConstants.OK_ID).setEnabled(true);
    return true;
}

From source file:com.googlecode.osde.internal.editors.pref.AddEnumValueDialog.java

License:Apache License

private boolean validate() {
    String value = valueText.getText();
    if (StringUtils.isEmpty(value)) {
        setMessage("Please fill the value field.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }/*from w w w . j  a  v a  2s  . com*/
    String displayValue = valueText.getText();
    if (StringUtils.isEmpty(displayValue)) {
        setMessage("Please fill the Display value field.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }
    setMessage(null);
    getButton(IDialogConstants.OK_ID).setEnabled(true);
    return true;
}

From source file:com.googlecode.osde.internal.editors.pref.AddUserPrefDialog.java

License:Apache License

private boolean validate() {
    String id = nameText.getText();
    if (StringUtils.isEmpty(id)) {
        setMessage("Please fill the name field.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }/*from w  w  w.  j  a  v  a 2s .  co m*/
    setMessage(null);
    getButton(IDialogConstants.OK_ID).setEnabled(true);
    return true;
}