Example usage for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_WARNING

List of usage examples for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_WARNING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_WARNING.

Prototype

String DLG_IMG_MESSAGE_WARNING

To view the source code for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_WARNING.

Click Source Link

Document

Image registry key for info message image (value "dialog_messasge_warning_image").

Usage

From source file:org.eclipse.dltk.ruby.testing.internal.RubyTestingMainLaunchConfigurationTab.java

License:Open Source License

/**
 * @param status/*from w  w w.j  a v  a  2 s.  c  om*/
 */
private void updateEngineStatus(IStatus status) {
    Image newImage = null;
    String newMessage = status.getMessage();
    switch (status.getSeverity()) {
    case IStatus.OK:
        newMessage = EMPTY_STRING;
        break;
    case IStatus.INFO:
        newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
        break;
    case IStatus.WARNING:
        newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
        break;
    case IStatus.ERROR:
        newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
        break;
    }
    showMessage(newMessage, newImage);
}

From source file:org.eclipse.e4.tools.ui.designer.properties.AppearanceSection.java

License:Open Source License

protected void setMessage(IStatus status) {
    if (imageLabel == null || imageLabel.isDisposed() || messageLabel == null || messageLabel.isDisposed()) {
        return;//ww w .  j  a  v a2s.  c  o m
    }
    Image image = null;
    String message = null;
    if (status != null && !status.isOK()) {
        int severity = status.getSeverity();
        switch (severity) {
        case IStatus.ERROR:
            image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
            break;
        case IStatus.WARNING:
            image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
            break;
        case IStatus.INFO:
            image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
            break;
        }
        message = status.getMessage();
    }
    boolean visible = image != null;
    imageLabel.setImage(image);
    imageLabelData.exclude = messageLableData.exclude = !visible;
    imageLabel.setVisible(visible);
    messageLabel.setVisible(visible);
    messageLabel.setText(message == null ? "" : message);
    imageLabel.getParent().layout(new Control[] { imageLabel, messageLabel });
}

From source file:org.eclipse.eatop.workspace.ui.internal.preferences.ModelConverterDescriptionLabels.java

License:Open Source License

/**
 * Creates a new ModelConverterDescriptionLabels instance
 * //from   ww  w  .jav a2 s .  com
 * @param parent
 *            a widget which will be the parent of the new instance (cannot be null)
 */
public ModelConverterDescriptionLabels(Composite parent) {
    super(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    setLayout(gridLayout);

    fWarning = createNewSection(Dialog.DLG_IMG_MESSAGE_WARNING, WARNING_TITLE_TEXT);
    fDescription = createNewSection(Dialog.DLG_IMG_MESSAGE_INFO, DESC_TITLE_TEXT);

    setConverterDescription(null);
}

From source file:org.eclipse.edt.ide.ui.internal.property.pages.VariableBlock.java

License:Open Source License

private void updateDeprecationWarning() {
    if (fWarning == null || fWarning.isDisposed())
        return;/*from   w ww  . jav a  2 s  .c o  m*/

    for (Iterator iter = fSelectedElements.iterator(); iter.hasNext();) {
        CPVariableElement element = (CPVariableElement) iter.next();
        String deprecationMessage = element.getDeprecationMessage();
        if (deprecationMessage != null) {
            fWarning.setText(deprecationMessage);
            fWarning.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
            return;
        }
    }
    fWarning.setText(null);
    fWarning.setImage(null);
}

From source file:org.eclipse.equinox.internal.p2.ui.model.EmptyElementExplanation.java

License:Open Source License

protected String getImageId(Object obj) {
    if (severity == IStatus.ERROR)
        return Dialog.DLG_IMG_MESSAGE_ERROR;
    if (severity == IStatus.WARNING)
        return Dialog.DLG_IMG_MESSAGE_WARNING;
    return Dialog.DLG_IMG_MESSAGE_INFO;
}

From source file:org.eclipse.help.ui.internal.views.MissingContentPart.java

License:Open Source License

public void updateStatus() {
    // Only update the controls if the status has changed
    boolean isRemoteHelpUnavailable = RemoteStatusData.isAnyRemoteHelpUnavailable();
    if (isRemoteHelpUnavailable && wasRemoteHelpUnavailable) {
        return; // Nothing to do, remote help unavailable message already showing
    }/* w w w  .j  a va 2 s.  c  o m*/
    boolean isUnresolvedPlaceholders = MissingContentManager.getInstance().isUnresolvedPlaceholders();
    if (isRemoteHelpUnavailable == wasRemoteHelpUnavailable
            && isUnresolvedPlaceholders == wasUnresolvedPlaceholders) {
        return;
    }
    disposeLink();
    wasRemoteHelpUnavailable = isRemoteHelpUnavailable;
    wasUnresolvedPlaceholders = isUnresolvedPlaceholders;
    FormToolkit toolkit = new FormToolkit(container.getDisplay());
    if (isRemoteHelpUnavailable) {
        createHelpMissingLink(container, toolkit, Dialog.DLG_IMG_MESSAGE_WARNING,
                Messages.remoteHelpUnavailable,
                MissingContentManager.getInstance().getRemoteHelpUnavailablePage(true), true);
    } else if (isUnresolvedPlaceholders) {
        createHelpMissingLink(container, toolkit, Dialog.DLG_IMG_MESSAGE_INFO,
                Messages.ReusableHelpPart_missingContent,
                MissingContentManager.getInstance().getHelpMissingPage(true), false);
    }
    toolkit.dispose();
}

From source file:org.eclipse.jdt.internal.ui.preferences.ComplianceConfigurationBlock.java

License:Open Source License

private Composite createComplianceTabContent(Composite folder) {

    String[] values3456 = new String[] { VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7 };
    String[] values3456Labels = new String[] { PreferencesMessages.ComplianceConfigurationBlock_version13,
            PreferencesMessages.ComplianceConfigurationBlock_version14,
            PreferencesMessages.ComplianceConfigurationBlock_version15,
            PreferencesMessages.ComplianceConfigurationBlock_version16,
            PreferencesMessages.ComplianceConfigurationBlock_version17 };

    final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
    Composite composite = sc1.getBody();
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;//from   ww  w . j  a  v  a 2s.c om
    layout.marginWidth = 0;
    composite.setLayout(layout);

    fControlsComposite = new Composite(composite, SWT.NONE);
    fControlsComposite.setFont(composite.getFont());
    fControlsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 1;
    fControlsComposite.setLayout(layout);

    int nColumns = 3;

    layout = new GridLayout();
    layout.numColumns = nColumns;

    Group group = new Group(fControlsComposite, SWT.NONE);
    group.setFont(fControlsComposite.getFont());
    group.setText(PreferencesMessages.ComplianceConfigurationBlock_compliance_group_label);
    group.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
    group.setLayout(layout);

    String[] defaultUserValues = new String[] { DEFAULT_CONF, USER_CONF };

    Control[] otherChildren = group.getChildren();
    if (fProject != null) {
        String label = PreferencesMessages.ComplianceConfigurationBlock_compliance_follows_EE_label;
        int widthHint = fPixelConverter.convertWidthInCharsToPixels(40);
        addCheckBoxWithLink(group, label, INTR_COMPLIANCE_FOLLOWS_EE, defaultUserValues, 0, widthHint,
                new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        openBuildPathPropertyPage();
                    }
                });
    }

    Control[] allChildren = group.getChildren();
    fComplianceFollowsEEControls.addAll(Arrays.asList(allChildren));
    fComplianceFollowsEEControls.removeAll(Arrays.asList(otherChildren));
    otherChildren = allChildren;

    String label = PreferencesMessages.ComplianceConfigurationBlock_compiler_compliance_label;
    addComboBox(group, label, PREF_COMPLIANCE, values3456, values3456Labels, 0);

    label = PreferencesMessages.ComplianceConfigurationBlock_default_settings_label;
    addCheckBox(group, label, INTR_DEFAULT_COMPLIANCE, defaultUserValues, 0);

    allChildren = group.getChildren();
    fComplianceControls.addAll(Arrays.asList(allChildren));
    fComplianceControls.removeAll(Arrays.asList(otherChildren));
    otherChildren = allChildren;

    int indent = fPixelConverter.convertWidthInCharsToPixels(2);

    String[] versions = new String[] { VERSION_CLDC_1_1, VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4,
            VERSION_1_5, VERSION_1_6, VERSION_1_7 };
    String[] versionsLabels = new String[] { PreferencesMessages.ComplianceConfigurationBlock_versionCLDC11,
            PreferencesMessages.ComplianceConfigurationBlock_version11,
            PreferencesMessages.ComplianceConfigurationBlock_version12,
            PreferencesMessages.ComplianceConfigurationBlock_version13,
            PreferencesMessages.ComplianceConfigurationBlock_version14,
            PreferencesMessages.ComplianceConfigurationBlock_version15,
            PreferencesMessages.ComplianceConfigurationBlock_version16,
            PreferencesMessages.ComplianceConfigurationBlock_version17 };

    boolean showJsr14 = ComplianceConfigurationBlock.VERSION_JSR14
            .equals(getValue(PREF_CODEGEN_TARGET_PLATFORM));
    if (showJsr14) {
        versions = append(versions, ComplianceConfigurationBlock.VERSION_JSR14);
        versionsLabels = append(versionsLabels, ComplianceConfigurationBlock.VERSION_JSR14);
    }

    label = PreferencesMessages.ComplianceConfigurationBlock_codegen_targetplatform_label;
    addComboBox(group, label, PREF_CODEGEN_TARGET_PLATFORM, versions, versionsLabels, indent);

    label = PreferencesMessages.ComplianceConfigurationBlock_source_compatibility_label;
    addComboBox(group, label, PREF_SOURCE_COMPATIBILITY, values3456, values3456Labels, indent);

    String[] errorWarningIgnore = new String[] { ERROR, WARNING, IGNORE };

    String[] errorWarningIgnoreLabels = new String[] { PreferencesMessages.ComplianceConfigurationBlock_error,
            PreferencesMessages.ComplianceConfigurationBlock_warning,
            PreferencesMessages.ComplianceConfigurationBlock_ignore };

    label = PreferencesMessages.ComplianceConfigurationBlock_pb_assert_as_identifier_label;
    addComboBox(group, label, PREF_PB_ASSERT_AS_IDENTIFIER, errorWarningIgnore, errorWarningIgnoreLabels,
            indent);

    label = PreferencesMessages.ComplianceConfigurationBlock_pb_enum_as_identifier_label;
    addComboBox(group, label, PREF_PB_ENUM_AS_IDENTIFIER, errorWarningIgnore, errorWarningIgnoreLabels, indent);

    allChildren = group.getChildren();
    fComplianceChildControls.addAll(Arrays.asList(allChildren));
    fComplianceChildControls.removeAll(Arrays.asList(otherChildren));

    layout = new GridLayout();
    layout.numColumns = nColumns;

    group = new Group(fControlsComposite, SWT.NONE);
    group.setFont(fControlsComposite.getFont());
    group.setText(PreferencesMessages.ComplianceConfigurationBlock_classfiles_group_label);
    group.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
    group.setLayout(layout);

    String[] generateValues = new String[] { GENERATE, DO_NOT_GENERATE };
    String[] enableDisableValues = new String[] { ENABLED, DISABLED };

    label = PreferencesMessages.ComplianceConfigurationBlock_variable_attr_label;
    addCheckBox(group, label, PREF_LOCAL_VARIABLE_ATTR, generateValues, 0);

    label = PreferencesMessages.ComplianceConfigurationBlock_line_number_attr_label;
    addCheckBox(group, label, PREF_LINE_NUMBER_ATTR, generateValues, 0);

    label = PreferencesMessages.ComplianceConfigurationBlock_source_file_attr_label;
    addCheckBox(group, label, PREF_SOURCE_FILE_ATTR, generateValues, 0);

    label = PreferencesMessages.ComplianceConfigurationBlock_codegen_unused_local_label;
    addCheckBox(group, label, PREF_CODEGEN_UNUSED_LOCAL, new String[] { PRESERVE, OPTIMIZE_OUT }, 0);

    label = PreferencesMessages.ComplianceConfigurationBlock_codegen_inline_jsr_bytecode_label;
    addCheckBox(group, label, PREF_CODEGEN_INLINE_JSR_BYTECODE, enableDisableValues, 0);

    Composite infoComposite = new Composite(fControlsComposite, SWT.NONE);
    infoComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    infoComposite.setLayout(new GridLayout(2, false));

    fJRE50InfoImage = new Label(infoComposite, SWT.NONE);
    fJRE50InfoImage.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    GridData gd = new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false);
    fJRE50InfoImage.setLayoutData(gd);

    fJRE50InfoText = new Link(infoComposite, SWT.WRAP);
    fJRE50InfoText.setFont(composite.getFont());
    // set a text: not the real one, just for layouting
    fJRE50InfoText.setText(
            Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info_project,
                    new String[] { getVersionLabel(VERSION_1_3), getVersionLabel(VERSION_1_3) }));
    fJRE50InfoText.setVisible(false);
    fJRE50InfoText.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
            if ("1".equals(e.text)) { //$NON-NLS-1$
                openJREInstallPreferencePage(false);
            } else if ("2".equals(e.text)) { //$NON-NLS-1$
                openJREInstallPreferencePage(true);
            } else {
                openBuildPathPropertyPage();
            }
        }

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }
    });
    gd = new GridData(GridData.FILL, GridData.FILL, true, true);
    gd.widthHint = fPixelConverter.convertWidthInCharsToPixels(50);
    fJRE50InfoText.setLayoutData(gd);
    validateComplianceStatus();

    return sc1;
}

From source file:org.eclipse.jdt.internal.ui.preferences.ComplianceConfigurationBlock.java

License:Open Source License

private void validateComplianceStatus() {
    if (fJRE50InfoText != null && !fJRE50InfoText.isDisposed()) {
        boolean isVisible = false;
        String compliance = getStoredValue(PREF_COMPLIANCE); // get actual value
        IVMInstall install = null;/* w w w.j a  v a2  s .  com*/
        if (fProject != null) { // project specific settings: only test if a 50 JRE is installed
            try {
                install = JavaRuntime.getVMInstall(JavaCore.create(fProject));
            } catch (CoreException e) {
                JavaPlugin.log(e);
            }
        } else {
            install = JavaRuntime.getDefaultVMInstall();
        }
        if (install instanceof IVMInstall2) {
            String compilerCompliance = JavaModelUtil.getCompilerCompliance((IVMInstall2) install, compliance);
            if (!compilerCompliance.equals(compliance)) { // Discourage using compiler with version other than compliance
                String[] args = { getVersionLabel(compliance), getVersionLabel(compilerCompliance) };
                if (fProject == null) {
                    fJRE50InfoText.setText(Messages
                            .format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info, args));
                } else {
                    fJRE50InfoText.setText(Messages.format(
                            PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info_project, args));
                }
                isVisible = true;
            }
        }
        fJRE50InfoText.setVisible(isVisible);
        fJRE50InfoImage.setImage(isVisible ? JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING) : null);
        fJRE50InfoImage.getParent().layout();
    }
}

From source file:org.eclipse.jst.jsf.common.ui.internal.dialogs.TreeViewerSelectionDialog.java

License:Open Source License

/**
 * Get the different message according the message type.
 * @param imageType //from w ww  .j  a  v a2 s .c om
 * 
 * @return Image - the message image
 */
protected Image getMessageImage(int imageType) {
    switch (imageType) {
    case STYLE_ERROR:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
    case STYLE_WARNING:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    case STYLE_INFORMATION:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
    default:
        return null;
    }
}

From source file:org.eclipse.m2e.core.ui.internal.components.NestedProjectsComposite.java

License:Open Source License

private void createOutOfDateProjectsWarning(Composite composite) {
    if (!showOutOfDateUI) {
        return;//w  w w. j av a  2 s. c  o m
    }
    warningArea = new Composite(composite, SWT.NONE);
    warningArea.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
    warningArea.setLayout(new RowLayout(SWT.HORIZONTAL));
    Label warningImg = new Label(warningArea, SWT.NONE);
    warningImg.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));

    includeOutDateProjectslink = new Link(warningArea, SWT.NONE);
    includeOutDateProjectslink.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            includeOutOfDateProjects();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            includeOutOfDateProjects();
        }
    });
}