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:org.eclipse.emf.eef.runtime.ui.editors.pages.EEFDetailsPage.java

License:Open Source License

public void createContents(Composite parent) {
    toolkit = getManagedForm().getToolkit();
    parent.setLayout(EEFFormLayoutFactory.createDetailsGridLayout(false, 1));
    parent.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite container = toolkit.createComposite(parent, SWT.FLAT);
    GridLayout containerLayout = new GridLayout();
    container.setLayout(containerLayout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    messageManager = new PropertiesEditionMessageManager() {

        @Override/*from  www  .  j  a  v  a 2s  .c o m*/
        protected void updateStatus(String message) {
            if (message != null && !"".equals(message))
                getManagedForm().getForm().setMessage(message, IMessageProvider.ERROR);
            else
                getManagedForm().getForm().setMessage(null, IMessageProvider.NONE);
        }
    };
    this.viewer = new PropertiesEditionViewer(container, null, SWT.NONE, 1);
    viewer.setDynamicTabHeader(true);
    viewer.setToolkit(getManagedForm().getToolkit());
    viewer.setContentProvider(new PropertiesEditionContentProvider(adapterFactory,
            IPropertiesEditionComponent.LIVE_MODE, editingDomain));
    viewer.addPropertiesListener(this);
}

From source file:org.eclipse.emf.eef.runtime.ui.widgets.masterdetails.eefviewer.PropertiesViewerMasterPart.java

License:Open Source License

/**
 * {@inheritDoc}//from   w ww .j ava 2 s. co m
 * @see org.eclipse.emf.eef.runtime.ui.widgets.masterdetails.AbstractEEFMasterPart#createSectionClientContents(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
 */
protected StructuredViewer createSectionClientContents(Composite parent, FormToolkit toolkit) {
    GridLayout containerLayout = new GridLayout();
    parent.setLayout(containerLayout);
    new PropertiesEditionMessageManager() {

        @Override
        protected void updateStatus(String message) {
            if (message != null)
                getManagedForm().getForm().setMessage(message, IMessageProvider.ERROR);
            else
                getManagedForm().getForm().setMessage(null, IMessageProvider.NONE);
        }
    };
    PropertiesEditionViewer viewer = new PropertiesEditionViewer(parent, null, SWT.NONE, 1);
    viewer.setDynamicTabHeader(true);
    viewer.setToolkit(toolkit);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = 80;
    viewer.getControl().setLayoutData(gridData);
    return viewer;
}

From source file:org.eclipse.emf.example.databinding.project.ui.rcp.views.ProjectFormAreaPart.java

License:Open Source License

private int convertType(int severity) {
    switch (severity) {
    case IStatus.OK:
        return IMessageProvider.NONE;
    case IStatus.CANCEL:
        return IMessageProvider.NONE;
    case IStatus.INFO:
        return IMessageProvider.INFORMATION;
    case IStatus.WARNING:
        return IMessageProvider.WARNING;
    case IStatus.ERROR:
        return IMessageProvider.ERROR;
    default://  ww w  .  j a va 2  s. com
        return IMessageProvider.NONE;
    }
}

From source file:org.eclipse.emf.oda.ecore.ui.impl.EcoreDataSourcePageHelper.java

License:Open Source License

/**
 * Validates that the user has specified values for the properties in the page control
 * and sets page message accordingly./*  www .j a va 2s  . c o  m*/
 */
protected void validateData() {
    String resource = getResource();
    boolean isValid = !StringUtil.isEmpty(resource);

    if (isValid) {
        try {
            URI.createURI(resource);

            setMessage(DEFAULT_MESSAGE, IMessageProvider.NONE);
        } catch (Exception e) {
            setMessage(e.getLocalizedMessage(), IMessageProvider.ERROR);
        }
    } else {
        setMessage(ODAEcoreUIPlugin.INSTANCE.getString("_UI_ResourceCannotBeEmpty_message"), //$NON-NLS-1$
                IMessageProvider.ERROR);
    }

    setPageComplete(isValid);
}

From source file:org.eclipse.epp.internal.mpc.ui.util.Util.java

License:Open Source License

/**
 * Compute the message type of the given status.
 * //  w  ww . j a va2s.c om
 * @see IMessageProvider
 */
public static int computeMessageType(IStatus status) {
    int messageType;
    switch (status.getSeverity()) {
    case IStatus.OK:
    case IStatus.INFO:
        messageType = IMessageProvider.INFORMATION;
        break;
    case IStatus.WARNING:
        messageType = IMessageProvider.WARNING;
        break;
    default:
        messageType = IMessageProvider.ERROR;
        break;
    }
    return messageType;
}

From source file:org.eclipse.equinox.internal.p2.ui.dialogs.ResolutionStatusPage.java

License:Open Source License

/**
 * Update the status area of the wizard to report the results of the operation.
 * /*from w w  w  .  j ava  2  s.co  m*/
 * @param newRoot the root that describes the root IUs involved in creating the plan.
 *       This can be <code>null</code> if the root should not be updated.
 * 
 * @param op the ProfileChangeOperation that describes the operation
 */
public void updateStatus(IUElementListRoot newRoot, ProfileChangeOperation op) {
    IStatus currentStatus = getProvisioningWizard().getCurrentStatus();
    updateCaches(newRoot, op);

    int messageType = IMessageProvider.NONE;
    boolean pageComplete = op != null;
    if (currentStatus != null && !currentStatus.isOK()) {
        messageType = IMessageProvider.INFORMATION;
        int severity = currentStatus.getSeverity();
        if (severity == IStatus.ERROR) {
            messageType = IMessageProvider.ERROR;
            pageComplete = false;
            // Log errors for later support
            ProvUI.reportStatus(currentStatus, StatusManager.LOG);
        } else if (severity == IStatus.WARNING) {
            messageType = IMessageProvider.WARNING;
            // Log warnings for later support
            ProvUI.reportStatus(currentStatus, StatusManager.LOG);
        } else if (severity == IStatus.CANCEL) {
            pageComplete = shouldCompleteOnCancel();
        }
    }
    setPageComplete(pageComplete);
    if (!isCreated())
        return;

    setMessage(getMessageText(currentStatus), messageType);
    setDetailText(op);
}

From source file:org.eclipse.equinox.internal.security.ui.storage.StorageLoginDialog.java

License:Open Source License

protected boolean validatePassword() {
    String password1 = password.getText();
    if ((password1 == null) || (password1.length() == 0)) {
        setMessage(SecUIMessages.messageEmptyPassword, IMessageProvider.ERROR);
        return false;
    }//  w ww.ja  v a 2s  .c  om
    if (confirm != null) {
        String password2 = confirm.getText();
        if (!password1.equals(password2)) {
            setMessage(SecUIMessages.messageNoMatch, IMessageProvider.WARNING);
            return false;
        }
    }
    setMessage("", IMessageProvider.NONE); //$NON-NLS-1$
    return true;
}

From source file:org.eclipse.equinox.internal.security.ui.storage.view.ExportDialog.java

License:Open Source License

protected boolean validFile() {
    if (fileText == null)
        return true;

    boolean valid;
    String tmp = fileText.getText();
    if ((tmp != null) && (tmp.length() != 0)) {
        File check = new File(tmp);
        if (check.exists())
            valid = check.canWrite();//ww w .ja va 2s  . c  o  m
        else
            valid = true;
    } else
        valid = false;

    if (valid)
        setMessage(SecUIMessages.exportDialogMsg, IMessageProvider.WARNING);
    else
        setMessage(SecUIMessages.exportDialogInvalidMsg, IMessageProvider.ERROR);
    return valid;
}

From source file:org.eclipse.equinox.internal.security.ui.storage.view.NewNodeDialog.java

License:Open Source License

protected boolean validName() {
    String tmp = nodeName.getText();
    boolean valid;
    if ((tmp == null) || (tmp.length() == 0))
        valid = false;/*w w  w  .  jav a 2s  .  c o m*/
    else if (tmp.equals(IStorageConst.STORAGE_ID))
        valid = false;
    else
        valid = (tmp.indexOf('/') == -1);
    if (valid)
        setMessage(SecUIMessages.newNodeMsg, IMessageProvider.NONE);
    else
        setMessage(SecUIMessages.newNodeInvalid, IMessageProvider.ERROR);
    return valid;
}

From source file:org.eclipse.equinox.internal.security.ui.storage.view.NewValueDialog.java

License:Open Source License

protected boolean validName() {
    String tmp = keyText.getText();
    boolean valid;
    if ((tmp == null) || (tmp.length() == 0))
        valid = false;/*from w w w .  j  ava 2  s  .  co m*/
    else {
        valid = true;
        for (int i = 0; i < existingKeys.length; i++) {
            if (existingKeys[i].equals(tmp)) {
                valid = false;
                break;
            }
        }
        valid = (tmp.indexOf('/') == -1);
    }
    if (valid)
        setMessage(SecUIMessages.addValueMsg, IMessageProvider.NONE);
    else
        setMessage(SecUIMessages.addValueInvalid, IMessageProvider.ERROR);
    return valid;
}