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

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

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Constant for a regular message (value 0).

Usage

From source file:org.eclipse.cdt.internal.ui.wizards.settingswizards.ProjectSettingsImportStrategy.java

License:Open Source License

@Override
public void fileSelected(IProjectSettingsWizardPage page) {
    List<ImporterSectionPair> pairs = Collections.emptyList();
    try {//from  w w w  .  ja  v  a 2  s  .  c  o m
        pairs = extractSectionsFromFile(page);
        page.setMessage(getMessage(MessageType.MESSAGE), IMessageProvider.NONE); // its all good
    } catch (FileNotFoundException e) {
        page.setMessage(Messages.ProjectSettingsWizardPage_Import_openError, IMessageProvider.ERROR);
    } catch (SettingsImportExportException e) {
        page.setMessage(Messages.ProjectSettingsWizardPage_Import_parseError, IMessageProvider.ERROR);
    }

    List<ISettingsProcessor> importersToDisplay = new ArrayList<ISettingsProcessor>();
    for (ImporterSectionPair pair : pairs) {
        importersToDisplay.add(pair.importer);
    }

    // if there was an error then importersToDisplay will be empty and this will clear the list
    page.setDisplayedSettingsProcessors(importersToDisplay);
}

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  w w. j ava 2  s  .  com
        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;
    }// ww  w. j  av  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  v a2  s.  c om*/
 * <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.contribution.visualiser.internal.preference.VisualiserPreferencesDialog.java

License:Open Source License

/**
 * Update the message/* w  ww.ja  v a 2  s .com*/
 * @see org.eclipse.jface.preference.IPreferencePageContainer#updateMessage()
 */
public void updateMessage() {
    String pageMessage = visPage.getMessage();
    int pageMessageType = IMessageProvider.NONE;
    if (pageMessage != null)
        pageMessageType = ((IMessageProvider) visPage).getMessageType();

    String pageErrorMessage = visPage.getErrorMessage();

    // Adjust the font
    if (pageMessage == null && pageErrorMessage == null)
        messageLabel.setFont(JFaceResources.getBannerFont());
    else
        messageLabel.setFont(JFaceResources.getDialogFont());

    // Set the message and error message   
    if (pageMessage == null) {
        setMessage(visPage.getTitle());
    } else {
        setMessage(pageMessage, pageMessageType);
    }
    setErrorMessage(pageErrorMessage);
}

From source file:org.eclipse.datatools.connectivity.oda.design.internal.ui.profile.ProfileSelectionPageHelper.java

License:Open Source License

private void setPageComplete(boolean complete) {
    if (m_wizardPage != null)
        m_wizardPage.setPageComplete(complete);
    else if (m_propertyPage != null)
        m_propertyPage.setValid(complete);

    if (complete)
        setMessage(EMPTY_STRING, IMessageProvider.NONE);
    else//  w w w .j  a  v a2 s.c  o m
        setDefaultMessageAsError(true);
}

From source file:org.eclipse.datatools.connectivity.oda.design.internal.ui.profile.ProfileSelectionPageHelper.java

License:Open Source License

private void setMessage(String newMessage, int newType) {
    if (m_wizardPage != null)
        m_wizardPage.setMessage(newMessage, newType);
    else if (m_propertyPage != null) {
        // use default title instead of leaving the message area empty
        if (newMessage.length() == 0 && newType == IMessageProvider.NONE)
            newMessage = Messages.profilePage_pageTitle;
        m_propertyPage.setMessage(newMessage, newType);
    }/*from www . j  a  v  a2s.c o m*/
}

From source file:org.eclipse.datatools.connectivity.oda.design.internal.ui.profile.ProfileSelectionPageHelper.java

License:Open Source License

private void setDefaultMessageAsError(boolean isError) {
    int newType = isError ? IMessageProvider.ERROR : IMessageProvider.NONE;
    setMessage(Messages.profilePage_selectProfileDefaultMessage, newType);
}

From source file:org.eclipse.datatools.connectivity.oda.design.internal.ui.profile.ProfileSelectionPageHelper.java

License:Open Source License

int getMessageType() {
    if (m_wizardPage != null)
        return m_wizardPage.getMessageType();
    if (m_propertyPage != null)
        return m_propertyPage.getMessageType();
    return IMessageProvider.NONE;
}

From source file:org.eclipse.datatools.connectivity.oda.design.internal.ui.profile.ProfileSelectionPageHelper.java

License:Open Source License

private void handleTreeSelection() {
    TreeItem item = getSelectedProfileItem();

    if (item == null) {
        clearSelectedProfile();/*from ww w .ja v a 2s  . c  om*/
        setSelectedDataSourceName(EMPTY_STRING);
        setExternalLinkOption(null);
        setDefaultMessageAsError(true);
    } else {
        m_profileID = item.getData().toString();
        m_odaDataSourceID = getProfileItemDataSourceId(item);
        setSelectedDataSourceName(item.getText());
        setExternalLinkOption(m_odaDataSourceID);

        if (getMessageType() == IMessageProvider.NONE) // no current error
            setDefaultMessageAsError(false);
    }
}