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.bpel.apache.ode.deploy.ui.pages.dialogs.EditMappingDialog.java

License:Apache License

@Override
protected Control createContents(Composite parent) {
    Control contents = super.createContents(parent);
    setTitle("Edit an existing data source");
    setMessage("Please edit the data of the selected data source", IMessageProvider.INFORMATION);
    return contents;
}

From source file:org.eclipse.cft.server.ui.internal.editor.CloudFoundryApplicationsEditorPage.java

License:Open Source License

protected void setMessageInPage(IStatus status) {
    String message = status != null ? status.getMessage() : null;
    if (message == null || status == null || status.isOK()) {
        setMessage(null, IMessageProvider.NONE);
    } else {/*from   w ww  .  j  a v a 2 s .  c  o  m*/
        int providerStatus = IMessageProvider.NONE;
        switch (status.getSeverity()) {
        case IStatus.INFO:
            providerStatus = IMessageProvider.INFORMATION;
            break;
        case IStatus.WARNING:
            providerStatus = IMessageProvider.WARNING;
            break;
        case IStatus.ERROR:
            providerStatus = IMessageProvider.ERROR;
            break;
        }

        setMessage(message, providerStatus);
    }

}

From source file:org.eclipse.cft.server.ui.internal.editor.EditorMessageTypes.java

License:Open Source License

public static int getMessageProviderType(IStatus status) {
    if (status == null) {
        return IMessageProvider.NONE;
    }/* w w  w  . ja  v a2 s  .  c  o  m*/

    switch (status.getSeverity()) {
    case IStatus.INFO:
        return IMessageProvider.INFORMATION;
    case IStatus.WARNING:
        return IMessageProvider.WARNING;
    case IStatus.ERROR:
        return IMessageProvider.ERROR;
    }
    return IMessageProvider.NONE;
}

From source file:org.eclipse.contribution.visualiser.internal.preference.VisualiserPreferencesDialog.java

License:Open Source License

/**
 * Sets the message for this dialog with an indication of what type
 * of message it is.//from w  w w.ja  va  2  s.co  m
 * <p>
 * The valid message types are one of <code>NONE</code>, 
 * <code>INFORMATION</code>, <code>WARNING</code>, or <code>ERROR</code>.
 * </p>
 * <p>
 * Note that for backward compatibility, a message of type <code>ERROR</code> 
 * is different than an error message (set using <code>setErrorMessage</code>). 
 * An error message overrides the current message until the error message is 
 * cleared. This method replaces the current message and does not affect the 
 * error message.
 * </p>
 *
 * @param newMessage the message, or <code>null</code> to clear
 *   the message
 * @param newType the message type
 */
public void setMessage(String newMessage, int newType) {
    Image newImage = null;

    if (newMessage != null) {
        switch (newType) {
        case IMessageProvider.NONE:
            break;
        case IMessageProvider.INFORMATION:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_INFO);
            break;
        case IMessageProvider.WARNING:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING);
            break;
        case IMessageProvider.ERROR:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_ERROR);
            break;
        }
    }

    showMessage(newMessage, newImage);
}

From source file:org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.tableeditor.commonui.ColumnDefaultValueInputDialog.java

License:Open Source License

protected Control createContents(Composite parent) {
    Control c = super.createContents(parent);
    initialize();//from   w  w w.ja  va 2  s .  c om
    setTitle(Messages.ColumnDefaultValueInputDialog_default_value_2);
    setMessage(_message); //$NON-NLS-1$
    if (_disableComputed) {
        setMessage(Messages.ColumnDefaultValueInputDialog_can_not_set_computed_value,
                IMessageProvider.INFORMATION);
    }
    return c;
}

From source file:org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.tableeditor.commonui.ColumnDefaultValueInputDialog.java

License:Open Source License

private void validateDefaultAndUpdate() {
    if (_noDefaultRadio.getSelection()
            || (_computedValueRadio.getSelection() && _computedText.getText().trim().length() != 0)) {
        setMessage(_message);/*from  ww w.j a va2 s  .  co  m*/
        getButton(IDialogConstants.OK_ID).setEnabled(true);
        return;
    } else if (_defaultValueRadio.getSelection() && _sysDefinedDefaultRadio.getSelection()) {
        if (_sysDefinedValuesCombo.getText().equals("")) //$NON-NLS-1$
        {
            setMessage(Messages.ColumnDefaultValueInputDialog_select_a_system_default,
                    IMessageProvider.INFORMATION);
            getButton(IDialogConstants.OK_ID).setEnabled(false);
        } else {
            getButton(IDialogConstants.OK_ID).setEnabled(true);
        }
        return;
    } else if (_defaultValueRadio.getSelection() && _userDefinedDefaultRadio.getSelection()) {
        if (_defaultValueTxt.getText().trim().length() == 0) {
            setMessage(Messages.ColumnDefaultValueInputDialog_input_default, IMessageProvider.INFORMATION);
            getButton(IDialogConstants.OK_ID).setEnabled(false);
            return;
        } else {
            setMessage(_message);
            getButton(IDialogConstants.OK_ID).setEnabled(true);

            ISQLDataOfflineValidator validator = new ASASQLDataOfflineValidator();
            String errorMsg = validator.validate(_column.getDataType(),
                    _isDefaultLiteralButton.getSelection() ? SQLUtil.quote(_defaultValueTxt.getText(), "'") //$NON-NLS-1$
                            : _defaultValueTxt.getText());
            if (errorMsg != null) {
                setMessage(errorMsg, IMessageProvider.ERROR);
                getButton(IDialogConstants.OK_ID).setEnabled(false);
            } else {
                setMessage(_message);
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            }
        }
    } else {
        setMessage(Messages.ColumnDefaultValueInputDialog_input_compute, IMessageProvider.INFORMATION);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return;
    }
}

From source file:org.eclipse.dltk.freemarker.internal.ui.editor.validation.AbstractControlValidator.java

License:Open Source License

/**
 * @param status/*  w ww. j a  va2 s . c  o  m*/
 * @return
 */
public static int getMessageType(IStatus status) {
    int severity = status.getSeverity();
    // Translate severity to the equivalent message provider type
    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;
    }
    // IStatus.CANCEL
    return IMessageProvider.NONE;
}

From source file:org.eclipse.e4.tools.ui.designer.dialogs.ElementInitializeDialog.java

License:Open Source License

/**
 * In fact, severity of status is different from the type of messages.
 *//*  www  .j  a v a 2 s .  c  om*/
protected void setMessage(IStatus status) {
    if (status == null || status.isOK()) {
        setMessage((String) null);
    } else {
        int severity = status.getSeverity();
        String message = status.getMessage();
        switch (severity) {
        case IStatus.ERROR:
            setMessage(message, IMessageProvider.ERROR);
            break;
        case IStatus.INFO:
            setMessage(message, IMessageProvider.INFORMATION);
            break;
        case IStatus.WARNING:
            setMessage(message, IMessageProvider.WARNING);
            break;
        default:
            setMessage((String) null);
            break;
        }
    }
    Button button = getButton(IDialogConstants.OK_ID);
    if (button != null && !button.isDisposed()) {
        button.setEnabled(status == null || status.getSeverity() != IStatus.ERROR);
    }
}

From source file:org.eclipse.e4.xwt.vex.palette.customize.dialogs.CustomizePaletteDialog.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Control contents = super.createContents(parent);

    Rectangle screenSize = Display.getDefault().getClientArea();
    Rectangle frameSize = this.getShell().getBounds();
    this.getShell().setLocation((screenSize.width - frameSize.width) / 2,
            (screenSize.height - frameSize.height) / 2);

    // Set the title
    setTitle(EditorMessages.CustomizePaletteDialog_Title);
    // Set the message
    setMessage(EditorMessages.CustomizePaletteDialog_Message, IMessageProvider.INFORMATION);
    return contents;
}

From source file:org.eclipse.ease.modules.modeling.ui.views.ModelRefactoringView.java

License:Open Source License

protected void handleGoto() {
    String theText = text.getText();
    frmNavigation.setMessage(null);//w w w  .  j a  va 2s .  c  o  m
    ISelection selec = comboViewer.getSelection();
    if (selec instanceof IStructuredSelection) {
        IStructuredSelection structured = (IStructuredSelection) selec;
        if (structured.getFirstElement() instanceof IMatcher) {
            IMatcher matcher = (IMatcher) structured.getFirstElement();
            Collection<EObject> toUse;
            try {
                toUse = matcher.getElements(theText, getCurrentEditor());
                toUse.remove(null);
                if (toUse.isEmpty()) {
                    if (frmNavigation.getMessage() == null) {
                        frmNavigation.setMessage(Messages.ModelRefactoringView_NO_ELEMENTS,
                                IMessageProvider.WARNING);
                    }
                }
                tableViewer_Search.setInput(toUse);
                frmNavigation.setMessage(toUse.size() + Messages.ModelRefactoringView_NB_ELEMENTS_FOUND,
                        IMessageProvider.INFORMATION);
            } catch (MatcherException e) {
                frmNavigation.setMessage(e.getMessage(), IMessageProvider.ERROR);
                e.printStackTrace();
            }

        }
    }

}