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.ebmwebsourcing.petals.server.ui.wizards.PetalsRuntimeWizardFragment3x.java

License:Open Source License

/**
 * Validates the page data.//  ww  w .  j av a  2s.co  m
 */
public void validate() {

    // Validate the petalsRuntimeWc
    this.petalsRuntimeWc.setVMInstall(this.vmInstall);
    if (this.runtimeName == null || this.runtimeName.trim().length() == 0) {
        this.wizard.setMessage("You must give your runtime a name.", IMessageProvider.ERROR);
        setComplete(false);
        this.wizard.update();
        return;
    }

    // Install path
    boolean complete = false;
    if (this.installPath != null)
        this.runtimeWc.setLocation(new Path(this.installPath));
    else
        this.runtimeWc.setLocation(null);

    IStatus status = this.runtimeWc.validate(null);
    complete = status == null || status.getSeverity() != IStatus.ERROR;
    int severity = IMessageProvider.NONE;

    if (status != null) {
        if (status.getSeverity() == IStatus.ERROR)
            severity = IMessageProvider.ERROR;
        else if (status.getSeverity() == IStatus.WARNING)
            severity = IMessageProvider.WARNING;
        else if (status.getSeverity() == IStatus.INFO)
            severity = IMessageProvider.INFORMATION;
    }

    if (status != null && severity != IMessageProvider.NONE)
        this.wizard.setMessage(status.getMessage(), severity);
    else
        this.wizard.setMessage(null, IMessageProvider.ERROR);

    getTaskModel().putObject(TaskModel.TASK_RUNTIME, this.runtimeWc);
    setComplete(complete);
    this.wizard.update();
}

From source file:com.ebmwebsourcing.petals.services.su.refactoring.SuRefactorUserPage.java

License:Open Source License

/**
 * Validates the input./*  w ww .  j  a  v a2  s  .  c  o  m*/
 */
private void validate() {

    this.derivedButton.setEnabled(this.serviceNameButton.getSelection());
    String msg = null;
    if (this.serviceNameButton.getSelection() && !JbiUtils.isSuName(getInfo().getProject().getName()))
        msg = "The original project name does respect the SU naming convention.\nService name extraction cannot be performed.";

    boolean complete = true;
    if (getInfo().getProject().getName().equalsIgnoreCase(getInfo().getNewName()))
        complete = false;
    else if (StringUtils.isEmpty(getInfo().getNewName()))
        complete = false;

    setErrorMessage(msg);
    setPageComplete(complete && msg == null);

    if (msg == null) {
        if (!JbiUtils.isSuName(getInfo().getNewName()))
            msg = "The new project name does respect the SU naming convention.";
        setMessage(msg, IMessageProvider.WARNING);
    }
}

From source file:com.ebmwebsourcing.petals.services.su.ui.EnhancedConsumeDialog.java

License:Open Source License

/**
 * Validates the selection.//from   www . j a v  a 2s  . c  o m
 */
private void validate() {

    String msg = null, warning = null;
    if (this.itfToInvoke == null && this.srvToInvoke == null && this.itfToInvoke == null)
        msg = "You must select a service to consume (invoke).";

    else if (this.operationToInvoke == null && this.needOperation)
        msg = "You must select an operation to invoke.";

    else if (this.constrainedMep != null && !this.constrainedMep.isEmpty()
            && !this.constrainedMep.contains(this.invocationMep))
        warning = "This operation is associated with a MEP which is not supported by the current component.";

    setMessage(warning, IMessageProvider.WARNING);
    setErrorMessage(msg);
    if (warning == null && msg == null)
        setMessage(DEFAULT_MSG);

    Button okButton = getButton(IDialogConstants.OK_ID);
    if (okButton != null)
        okButton.setEnabled(msg == null);
}

From source file:com.ebmwebsourcing.petals.services.su.wizards.pages.JbiConsumePage.java

License:Open Source License

@Override
public boolean validate() {

    setMessage(null);//from  w  ww . j a  v a2 s.  c  om
    setMessage(null, IMessageProvider.WARNING);

    // Interface name
    AbstractEndpoint ae = getNewlyCreatedEndpoint();
    SuWizardSettings settings = getWizard().getSettings();
    if (settings.validateInterface && ae.getInterfaceName() == null) {
        updateStatus("You have to provide the interface name.");
        return false;
    }

    // Service name
    if (this.invokeByServiceName && ae.getServiceName() == null) {
        updateStatus("You have to provide the service name");
        return false;
    }

    // End-point name
    if (this.invokeByEndpointName && StringUtils.isEmpty(ae.getEndpointName())) {
        updateStatus("You have to define the end-point name.");
        return false;
    }

    if (this.invokeByEndpointName && getWizard().getComponentVersionDescription()
            .getAutoGeneratedEndpointValue().equals(ae.getEndpointName())) {
        updateStatus("You cannot invoke by end-point name with autogenerated end-points.");
        return false;
    }

    // MEP
    if (getWizard().getSettings().invocationMep == null) {
        updateStatus("You have to define the invocation MEP.");
        return false;
    }

    // Update data.
    updateStatus(null);

    // Make sure this service can be invoked (MEP)
    Mep invocationMep = getWizard().getSettings().invocationMep;
    if (invocationMep != null && !this.supportedMep.isEmpty() && !this.supportedMep.contains(invocationMep)) {
        String msg = "This invocation MEP is not supported by the component. Only "
                + Mep.listMep(this.supportedMep) + " MEPs are supported.";
        setMessage(msg, IMessageProvider.WARNING);
    }

    return true;
}

From source file:com.ebmwebsourcing.petals.services.su.wizards.pages.ProjectPage.java

License:Open Source License

@Override
public boolean validate() {

    // Project name
    if (StringUtils.isEmpty(this.projectName)) {
        updateStatus("The project name cannot be empty.");
        return false;
    }/*from w ww.  j a v a2 s .  c o  m*/

    // Name syntax
    String warningMsg = null;

    // Remove white spaces ("File Transfer") - cause of problems with systems
    String newSuType = getWizard().getComponentVersionDescription().getComponentAlias().replaceAll("\\s", "")
            .trim();
    if (getWizard().getPetalsMode() == PetalsMode.provides) {
        String regex = "su-" + newSuType + "-" + "[a-zA-Z_]+[.\\w\\-]*" + "-provide.*";
        if (!this.projectName.matches(regex))
            warningMsg = "The project name does not respect the convention su-" + newSuType + "-...-provide.";
    } else {
        String regex = "su-" + newSuType + "-" + "[a-zA-Z_]+[.\\w\\-]*" + "-consume.*";
        if (!this.projectName.matches(regex))
            warningMsg = "The project name does not respect the convention su-" + newSuType + "-...-consume.";
    }

    // Name already used?
    for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
        if (project.getName().equalsIgnoreCase(this.projectNameText.getText())) {
            updateStatus(NLS.bind(Messages.ConsumeJbiPage_12, this.projectNameText.getText()));
            return false;
        }
    }

    // Project location
    File targetfile = computeProjectLocation();
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(this.projectName);
    if (!isAtDefaultlocation()) {
        IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(project, targetfile.toURI());
        if (status.getCode() != IStatus.OK) {
            updateStatus(status.getMessage());
            return false;
        }
    }

    if (targetfile.exists()) {
        if (targetfile.isDirectory())
            warningMsg = "This project will override an existing directory.";
        else
            warningMsg = "This project will override an existing file.";
    }

    // Display warning or clear the messages
    setMessage(warningMsg, IMessageProvider.WARNING);
    updateStatus(null);
    return true;
}

From source file:com.ebmwebsourcing.petals.services.validation.v11.ValidationProvideSpecificPage.java

License:Open Source License

@Override
public boolean validate() {

    boolean valid = true;
    if (!this.createXsd) {
        if (StringUtils.isEmpty(this.xsdURL)) {
            updateStatus("You must select the XML schema to import.");
            valid = false;//from   w  ww.j a  va 2 s .  c  o m
        } else {
            try {
                UriAndUrlHelper.urlToUri(this.xsdURL);

            } catch (Exception e) {
                updateStatus("The URL for the XML schema is not valid.");
                valid = false;
            }
        }
    } else {
        if (StringUtils.isEmpty(this.targetNamespace)) {
            updateStatus("You must define the target name space of the XML schema to create.");
            valid = false;
        }
    }

    if (valid)
        updateStatus(null);

    if (this.createWsdl && !this.createXsd)
        setMessage("The generated WSDL might not reflect the content of the imported XML schema.",
                IMessageProvider.WARNING);
    else
        setMessage(null, IMessageProvider.WARNING);

    return valid;
}

From source file:com.ebmwebsourcing.petals.services.xslt.wizard.XsltProvideSpecificPage.java

License:Open Source License

@Override
public boolean validate() {

    boolean valid = true;
    if (!this.createXsltFile) {
        if (StringUtils.isEmpty(this.xslUrl)) {
            updateStatus("You must select the XSL style sheet to import.");
            valid = false;//from  www.j  a v a 2 s  . com
        } else {
            try {
                UriAndUrlHelper.urlToUri(this.xslUrl);

            } catch (Exception e) {
                updateStatus("The URL for the XSL style sheet is not valid.");
                valid = false;
            }
        }
    }

    if (valid)
        updateStatus(null);

    if (this.createWsdlFile && !this.createXsltFile)
        setMessage("The generated WSDL might not reflect the content of the imported XSL style sheet.",
                IMessageProvider.WARNING);
    else
        setMessage(null, IMessageProvider.WARNING);

    return valid;
}

From source file:com.google.appengine.eclipse.core.deploy.ui.DeployProjectDialog.java

License:Open Source License

private 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:/*from   w w w .j a  va2s  .  c  o m*/
        return IMessageProvider.NONE;
    }
}

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

License:Apache License

@Test
public void testStatusSeverityWarn() {
    // add three areas, status = OK, WARN, INFO; verify showing WARN
    setupAreas();//  w  w w  . jav a2 s . c  o m

    area3.status = new Status(IStatus.INFO, "foo", "info3");
    area3.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.INFORMATION, page.getMessageType());
    assertEquals("info3", page.getMessage());

    area2.status = new Status(IStatus.WARNING, "foo", "warn2");
    area2.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.WARNING, page.getMessageType());
    assertEquals("warn2", page.getMessage());
}

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

License:Apache License

@Test
public void testStatusSeverityError() {
    // add three areas, status = WARN, ERROR, INFO; verify showing ERROR

    setupAreas();/*from   w  w  w. j a  v a 2s. c om*/

    area3.status = new Status(IStatus.INFO, "foo", "info3");
    area3.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.INFORMATION, page.getMessageType());
    assertEquals("info3", page.getMessage());

    area1.status = new Status(IStatus.WARNING, "foo", "warn1");
    area1.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.WARNING, page.getMessageType());
    assertEquals("warn1", page.getMessage());

    area2.status = new Status(IStatus.ERROR, "foo", "error2");
    area2.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertFalse("should now be invalid", page.isValid());
    assertEquals(IMessageProvider.ERROR, page.getMessageType());
    assertEquals("error2", page.getMessage());
}