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:com.nokia.carbide.cpp.internal.project.ui.editors.images.AIFEditorDialog.java

License:Open Source License

/**
 * //  w  w  w.  jav a2s .  co m
 */
protected void updateValidationMessage() {
    IStatus status = context.getValidationStatus();
    getButton(IDialogConstants.OK_ID).setEnabled(status.getSeverity() != IStatus.ERROR);
    if (status.isOK()) {
        setErrorMessage(null);
        setMessage(null, IMessageProvider.WARNING);
    } else if (status.getSeverity() == IStatus.ERROR)
        setErrorMessage(status.getMessage());
    else {
        if (status.getSeverity() == IStatus.WARNING)
            setMessage(status.getMessage(), IMessageProvider.WARNING);
        else
            setMessage(status.getMessage(), IMessageProvider.INFORMATION);
    }
}

From source file:com.nokia.cdt.internal.debug.launch.newwizard.AbstractLaunchSettingsDialog.java

License:Open Source License

protected int severityToMsgType(int severity) {
    switch (severity) {
    case IStatus.OK:
    case IStatus.CANCEL:
    default://from w w  w. j  a  v  a  2 s  .co m
        break;
    case IStatus.INFO:
        return IMessageProvider.INFORMATION;
    case IStatus.ERROR:
        return IMessageProvider.ERROR;
    case IStatus.WARNING:
        return IMessageProvider.WARNING;
    }
    return IMessageProvider.NONE;
}

From source file:com.nokia.s60tools.memspy.ui.dialogs.SWMTCategoriesDialog.java

License:Open Source License

/**
 * Resets possible error messages and show the default message.
 *//*from ww  w . j  a  v a  2 s  . c  o m*/
private void showDefaultMessage() {
    setErrorMessage(null);
    setMessage(DEFAULT_MESSAGE, IMessageProvider.INFORMATION);
}

From source file:com.nokia.s60tools.memspy.ui.dialogs.SWMTCategoriesDialog.java

License:Open Source License

/**
 * Informs user that parameters are valid and dialog can be
 * dismissed with OK button..//from  w  ww.  j  a  v  a 2s.c o  m
 */
private void setCompleteOkMessage() {
    setErrorMessage(null);
    setMessage(COMPLETE_MESSAGE, IMessageProvider.INFORMATION);
}

From source file:com.opera.widgets.ui.editor.validation.AbstractControlValidation.java

License:Open Source License

public static int getMessageType(IStatus status) {
    int severity = status.getSeverity();
    if (severity == IStatus.OK) {
        return IMessageProvider.NONE;
    } else if (severity == IStatus.ERROR) {
        return IMessageProvider.ERROR;
    } else if (severity == IStatus.WARNING) {
        return IMessageProvider.WARNING;
    } else if (severity == IStatus.INFO) {
        return IMessageProvider.INFORMATION;
    }/*from w w  w . java  2s .  com*/
    return IMessageProvider.NONE;
}

From source file:com.rcpcompany.uibindings.bindingMessages.ValidationLabelDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    final Integer severity = myObjectSeverities.get(element);
    if (severity == null)
        return;/*from   w w w  .  j av  a 2  s  . c  o  m*/
    if (Activator.getDefault() != null && Activator.getDefault().TRACE_LABEL_DECORATOR) {
        LogUtils.debug(this, hashCode() + ": " + element + ": severity: " + severity); //$NON-NLS-1$ //$NON-NLS-2$
    }
    switch (severity) {
    case IMessageProvider.NONE:
        break;
    case IMessageProvider.INFORMATION:
        break;
    case IMessageProvider.WARNING:
        decoration.addOverlay(WARNING_IMAGE);
        break;
    case IMessageProvider.ERROR:
        decoration.addOverlay(ERROR_IMAGE);
        break;
    default:
        break;
    }
}

From source file:com.rcpcompany.uibindings.extests.bindingMessages.LabelDecoratorTest.java

License:Open Source License

/**
 * Tests whether the element - if it is an {@link EObject} - has the specified message type and
 * whether the specified decorator has the specified decoration.
 * //from ww w  .ja v  a2  s. co  m
 * @param labelDecorator the decorator
 * @param element the element in question
 * @param messageType the expected message for the element
 * @param decorationType the expected decoration for the element
 */
private void testLD(ValidationLabelDecorator labelDecorator, Object element, int messageType,
        int decorationType) {
    if (element instanceof EObject) {
        assertEquals(messageType, myValidatorManager.getObjectSeverity((EObject) element));
    }
    if (decorationType == -1) {
        decorationType = messageType;
    }

    myCurrentOverlay = null;
    final IDecoration decoration = new IDecoration() {

        @Override
        public void setForegroundColor(Color color) {
            fail();
        }

        @Override
        public void setFont(Font font) {
            fail();
        }

        @Override
        public void setBackgroundColor(Color color) {
            fail();
        }

        @Override
        public IDecorationContext getDecorationContext() {
            return DecorationContext.DEFAULT_CONTEXT;
        }

        @Override
        public void addSuffix(String suffix) {
            fail();
        }

        @Override
        public void addPrefix(String prefix) {
            fail();
        }

        @Override
        public void addOverlay(ImageDescriptor overlay, int quadrant) {
            fail();
        }

        @Override
        public void addOverlay(ImageDescriptor overlay) {
            assertEquals(null, myCurrentOverlay);
            assertNotNull(overlay);
            myCurrentOverlay = overlay;
        }
    };
    labelDecorator.decorate(element, decoration);
    assertEquals(decorationType, labelDecorator.getElementSeverity(element));
    switch (decorationType) {
    case IMessageProvider.NONE:
        // No overlay expected
        assertEquals(null, myCurrentOverlay);
        break;
    case IMessageProvider.INFORMATION:
        // No overlay expected
        assertEquals(null, myCurrentOverlay);
        break;
    case IMessageProvider.WARNING:
        assertEquals(ValidationLabelDecorator.WARNING_IMAGE, myCurrentOverlay);
        break;
    case IMessageProvider.ERROR:
        assertEquals(ValidationLabelDecorator.ERROR_IMAGE, myCurrentOverlay);
        break;
    }
}

From source file:com.rcpcompany.uibindings.internal.bindingMessages.ValueBindingMessageImageDecorator.java

License:Open Source License

/**
 * @see #updateDecoration()/* w  w  w.j av a 2 s . co m*/
 */
protected void updateDecorationDelayed() {
    if (getBinding().getState() != BindingState.OK)
        return;
    /*
     * As this operation is delayed, the widget might be disposed in the mean time...
     */
    if (getBinding().getUIObservable().isDisposed())
        return;

    if (Activator.getDefault().TRACE_LIFECYCLE_VALUE_BINDING_MESSAGE_DECORATOR) {
        LogUtils.debug(this, "update delayed " + hashCode() + ": " + getBinding()); //$NON-NLS-1$ //$NON-NLS-2$
    }
    if (VALIDATION_MANAGER != null) {
        if (getBinding().getModelObservable().isDisposed()) {
            LogUtils.debug(this, "value is disposed");
            return;
        }
        /*
         * Check if the observed object of the binding has changed. If so, then reset the
         * decoration for the validation manager - this will remove all current messages and set
         * up a new set...
         */
        final EObject newObservedObject = getBinding().getModelObject();
        if (myObservedObject != newObservedObject) {
            myObservedObject = newObservedObject;
            VALIDATION_MANAGER.resetDecorator(this);
        }
    }

    /*
     * Make a list of all the potential messages
     */
    final List<IBindingMessage> ml = new ArrayList<IBindingMessage>();
    final BindingMessageSeverity minimumSeverity = IManager.Factory.getManager()
            .getMessageDecorationMinimumSeverity();
    for (final Object v : myMessageProviders) {
        final IBindingMessage message = (IBindingMessage) ((IObservableValue) v).getValue();
        if (message.getSeverity().compareTo(minimumSeverity) < 0) {
            continue;
        }
        ml.add(message);
    }
    final IObservableList decoratorMessages = getBinding().getDecorator().getMessages();
    if (decoratorMessages != null) {
        for (final Object m : decoratorMessages) {
            final IBindingMessage message = (IBindingMessage) m;
            if (message.getSeverity().compareTo(minimumSeverity) < 0) {
                continue;
            }
            ml.add(message);
        }
    }

    for (final IBindingMessage message : myOutstandingMessages) {
        if (message.getSeverity().compareTo(minimumSeverity) < 0) {
            continue;
        }
        ml.add(message);
    }

    /*
     * Find the current max type and the combined messages to use...
     */
    int maxType = IMessageProvider.NONE;
    final List<IBindingMessage> topList = new ArrayList<IBindingMessage>();
    for (final IBindingMessage message : ml) {
        final int type = message.getMessageType();
        if (type > maxType) {
            topList.clear();
            maxType = type;
        }
        if (type == maxType) {
            topList.add(message);
        }
    }

    /*
     * Weed out any superseded messages.
     * 
     * There has to be at least two messages before there any anything to weed out...
     */
    if (topList.size() > 1) {
        final IBindingMessage[] ma = topList.toArray(new IBindingMessage[topList.size()]);
        for (int i = 0; i < ma.length; i++) {
            final IBindingMessage a = ma[i];
            for (int j = i + 1; j < ma.length; j++) {
                final IBindingMessage b = ma[j];
                if (a.supersedes(b)) {
                    topList.remove(b);
                    continue;
                }
                if (b.supersedes(a)) {
                    topList.remove(a);
                    break;
                }
            }
        }
    }

    /*
     * Updated the messages
     */
    for (final IBindingMessage m : topList) {
        if (myMessages.contains(m)) {
            continue;
        }
        myMessagesOL.add(m);
    }
    for (final IBindingMessage m : myMessages.toArray(new IBindingMessage[myMessages.size()])) {
        if (topList.contains(m)) {
            continue;
        }
        myMessagesOL.remove(m);
    }

    final StringBuilder sb = new StringBuilder(100);
    for (final IBindingMessage message : myMessages) {
        if (sb.length() > 0) {
            sb.append('\n');
        }
        sb.append(message.getMessage());
    }

    /*
     * Show the appropriate message decorations
     */
    final Image oldMessageDecorationImage = myMessageDecorationImage;
    final String oldMessageDecorationMessage = myMessageDecorationMessage;
    switch (maxType) {
    case IMessageProvider.NONE:
        myMessageDecorationImage = null;
        break;
    case IMessageProvider.ERROR:
        myMessageDecorationImage = ERROR_FIELD_DECORATOR.getImage();
        break;
    case IMessageProvider.WARNING:
        myMessageDecorationImage = WARNING_FIELD_DECORATOR.getImage();
        break;
    case IMessageProvider.INFORMATION:
        myMessageDecorationImage = INFORMATION_FIELD_DECORATOR.getImage();
        break;
    default:
        break;
    }
    myMessageDecorationMessage = sb.toString();

    /*
     * The alternative stuff is only relevant if the binding is changeable...
     */
    final Image oldAlternativeDecorationImage = myAlternativeDecorationImage;
    final String oldAlternativeDecorationMessage = myAlternativeDecorationMessage;
    if (getBinding().isChangeable()) {
        final IManager manager = IManager.Factory.getManager();

        /*
         * Only show the alternative decorations for controls if they have the focus - but not
         * for checkboxes
         */
        final Control control = getBinding().getControl();
        boolean showAlternativeDecorations = control != null && control.isFocusControl();
        if (control instanceof Button && (control.getStyle() & SWT.CHECK) == SWT.CHECK) {
            showAlternativeDecorations = false;
        }

        // TODO TMTM add key bindings
        if (getQuickfixes().size() > 0 && manager.isQuickfixVBImageDecorationShown()) {
            myAlternativeDecorationImage = QUICKFIX_FIELD_DECORATOR.getImage();
            myAlternativeDecorationMessage = QUICKFIX_FIELD_DECORATOR.getDescription();
        } else if (showAlternativeDecorations && getBinding().getDataType().isRequired()
                && manager.isRequiredVBImageDecorationShown()) {
            myAlternativeDecorationImage = REQUIRED_FIELD_DECORATOR.getImage();
            myAlternativeDecorationMessage = Messages.ValueBindingMessageImageDecorator_ValueRequired;
        } else if (showAlternativeDecorations && getBinding().getDecorator().getValidUIList() != null
                && getBinding().getUIAttribute().getFieldAssistAdapter() != null
                && manager.isAssistVBImageDecorationShown()) {
            myAlternativeDecorationImage = CONTENT_PROPOSAL_FIELD_DECORATOR.getImage();
            myAlternativeDecorationMessage = Messages.ValueBindingMessageImageDecorator_ContentAssistAvailanble;
        } else {
            myAlternativeDecorationImage = null;
            myAlternativeDecorationMessage = null;
        }
    }

    /*
     * If everything is the same, then do nothing
     */
    if (BasicUtils.equals(oldMessageDecorationImage, myMessageDecorationImage)
            && BasicUtils.equals(oldMessageDecorationMessage, myMessageDecorationMessage)
            && BasicUtils.equals(oldAlternativeDecorationImage, myAlternativeDecorationImage)
            && BasicUtils.equals(oldAlternativeDecorationMessage, myAlternativeDecorationMessage))
        return;

    /*
     * Update the binding
     */
    getBinding().updateBinding();
}

From source file:com.salesforce.ide.ui.internal.wizards.BaseWizardPage.java

License:Open Source License

public void updateInfoStatus(String message) {
    setMessage(message, IMessageProvider.INFORMATION);
}

From source file:com.salesforce.ide.ui.properties.BasePropertyPage.java

License:Open Source License

protected void updateInfoStatus(String message) {
    setMessage(message, IMessageProvider.INFORMATION);
}