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

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

Introduction

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

Prototype

int INFORMATION

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

Click Source Link

Document

Constant for an info message (value 1).

Usage

From source file:org.eclipse.emf.ecoretools.legacy.tabbedproperties.sections.AbstractTabbedPropertySection.java

License:Open Source License

/**
 * Add a decorator to the given control. A tool tip will display the given
 * message//from w  w w  .  j av  a  2  s . c om
 * 
 * @param control
 * @param message
 * 
 * @since 1.0 M3
 */
protected void setInfoDecorator(Control control, String message) {
    setDecorator(control, message, IMessageProvider.INFORMATION);
}

From source file:org.eclipse.emf.editor.ModelCheckor.java

License:Open Source License

private List<MessageData> ecoreValidation(EObject rootObject) {
    int status = IMessageProvider.INFORMATION;
    Diagnostic diagnostic = Diagnostician.INSTANCE.validate(rootObject);

    switch (diagnostic.getSeverity()) {
    case Diagnostic.ERROR:
        status = IMessageProvider.ERROR;
        break;//from w w  w  . j  a va2  s  .c  o m
    case Diagnostic.WARNING:
        status = IMessageProvider.WARNING;
        break;
    case Diagnostic.INFO:
        status = IMessageProvider.INFORMATION;
    default:
        break;
    }
    return createMessagesFromDiagnostic(rootObject, diagnostic, status);
}

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://w  w w  . j  av a2 s. c  o  m
        return IMessageProvider.NONE;
    }
}

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

License:Open Source License

/**
 * Compute the message type of the given status.
 * //from  w  w  w . j a  v  a 2 s  .  c o  m
 * @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  a v  a 2  s. com*/
 * @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.PasswordRecoveryDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite compositeTop = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(compositeTop, SWT.NONE);

    setMessage(SecUIMessages.pswRecoveryMsg, IMessageProvider.INFORMATION);

    for (int i = 0; i < questionsText.length; i++) {
        Group group = new Group(composite, SWT.NONE);
        group.setText(NLS.bind(SecUIMessages.passwordGroup, Integer.toString(i + 1)));
        group.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
        group.setLayout(new GridLayout());

        String question = NLS.bind(SecUIMessages.pswRecoveryQuestion, questionsText[i]);
        new Label(group, SWT.LEFT).setText(question);
        answers[i] = new Text(group, SWT.LEFT | SWT.BORDER);
        answers[i].setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
        answers[i].addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent event) {
                validateOK();//from w  w w  . j av  a 2s .  co  m
            }
        });
    }

    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayoutFactory.swtDefaults().generateLayout(composite);

    return composite;
}

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

License:Open Source License

protected void validateOK() {
    boolean valid = true;
    for (int i = 0; i < questionsText.length; i++) {
        if (answers[i] == null)
            continue;
        String question = answers[i].getText();
        if (question == null || question.length() == 0) {
            valid = false;//from w w  w .  j  a v a  2  s .co m
            break;
        }
    }
    if (valid)
        setMessage(SecUIMessages.pswRecoveryMsg, IMessageProvider.INFORMATION);
    else
        setMessage(SecUIMessages.pswRecoveryWarning, IMessageProvider.WARNING);
    okButton.setEnabled(valid);
}

From source file:org.eclipse.equinox.p2.authoring.forms.RichFormPage.java

License:Open Source License

private void configureFormText(final Form form, FormText text) {
    text.addHyperlinkListener(new HyperlinkAdapter() {
        @Override//from  w ww . j a  va2  s .  c o  m
        public void linkActivated(HyperlinkEvent e) {
            String is = (String) e.getHref();
            try {
                int index = Integer.parseInt(is);
                IMessage[] messages = form.getChildrenMessages();
                IMessage message = messages[index];
                Control c = message.getControl();
                ((FormText) e.widget).getShell().dispose();
                if (c != null)
                    c.setFocus();
            } catch (ArrayIndexOutOfBoundsException ex) {
                // This can happens if message array changes while menu is up
                ((FormText) e.widget).getShell().dispose();
            } catch (NumberFormatException ex) {
            }
        }
    });
    text.setImage("error", getImage(IMessageProvider.ERROR)); //$NON-NLS-1$
    text.setImage("warning", getImage(IMessageProvider.WARNING)); //$NON-NLS-1$
    text.setImage("info", getImage(IMessageProvider.INFORMATION)); //$NON-NLS-1$
}

From source file:org.eclipse.equinox.p2.authoring.forms.RichFormPage.java

License:Open Source License

/**
 * Formats messages into a form string/*w  w  w. j a  va2  s .  c om*/
 * 
 * @param messages
 *            - messages to format
 * @return a form string
 */
private String createFormTextContent(IMessage[] messages) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    pw.println("<form>"); //$NON-NLS-1$
    for (int i = 0; i < messages.length; i++) {
        IMessage message = messages[i];
        pw.print("<li vspace=\"false\" style=\"image\" indent=\"16\" value=\""); //$NON-NLS-1$
        switch (message.getMessageType()) {
        case IMessageProvider.ERROR:
            pw.print("error"); //$NON-NLS-1$
            break;
        case IMessageProvider.WARNING:
            pw.print("warning"); //$NON-NLS-1$
            break;
        case IMessageProvider.INFORMATION:
            pw.print("info"); //$NON-NLS-1$
            break;
        }
        pw.print("\"> <a href=\""); //$NON-NLS-1$
        pw.print(i + ""); //$NON-NLS-1$
        pw.print("\">");//$NON-NLS-1$
        if (message.getPrefix() != null)
            pw.print(message.getPrefix());
        pw.print(message.getMessage());
        pw.println("</a></li>"); //$NON-NLS-1$
    }
    pw.println("</form>"); //$NON-NLS-1$
    pw.flush();
    return sw.toString();
}

From source file:org.eclipse.equinox.p2.authoring.forms.RichFormPage.java

License:Open Source License

/**
 * Convenience method to pick up platform images for error and warning.
 * //from  ww  w  . j av a2  s  .co m
 * @param type
 * @return
 */
private Image getImage(int type) {
    switch (type) {
    case IMessageProvider.ERROR:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
    case IMessageProvider.WARNING:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
    case IMessageProvider.INFORMATION:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    }
    return null;
}