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:es.axios.udig.spatialoperations.ui.view.Message.java

License:LGPL

/**
 * @return Returns the image/*from  w  w w.  jav a  2 s  .co  m*/
 */
public final Image getImage() {

    Image image = null;

    switch (type) {
    case FAIL:
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
        break;
    case INFORMATION:
    case IMPORTANT_INFO:
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
        break;
    case WARNING:
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
        break;
    case ERROR:
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
        break;

    case NULL:
        image = null;
        break;

    default:
        assert false; // imposible!
        break;
    }

    return image;
}

From source file:es.axios.udig.ui.commons.message.InfoMessage.java

License:LGPL

/**
 * @return Returns the image/*from  ww  w . j  a  v  a  2s .  co  m*/
 */
public final Image getImage() {

    Image image = null;

    switch (type) {
    case FAIL:
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
        break;
    case INFORMATION:
    case IMPORTANT_INFO:
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
        break;
    case WARNING:
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
        break;
    case ERROR:
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
        break;

    case NULL:
        image = null;
        break;

    default:
        assert false; // impossible!
        break;
    }

    return image;
}

From source file:ext.org.eclipse.jdt.internal.ui.dialogs.SortMembersMessageDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);//from  w w  w.  j a  va2  s  . com

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    createLinkControl(messageComposite);

    int indent = convertWidthInCharsToPixels(3);

    fNotSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent);

    fSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null), indent);

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    imageLabel1.setImage(image);
    imageLabel1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    final Label label = new Label(warningComposite, SWT.WRAP);
    label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(gridData);
    label.setFont(warningComposite.getFont());

    fNotSortAllRadio.setDialogFieldListener(new IDialogFieldListener() {
        public void dialogFieldChanged(DialogField field) {
            imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
            label.setEnabled(!fNotSortAllRadio.isSelected());
        }
    });
    imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
    label.setEnabled(!fNotSortAllRadio.isSelected());

    return messageComposite;
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.cleanup.CodeFormatingTabPage.java

License:Open Source License

@Override
protected void doCreatePreferences(Composite composite, int numColumns) {

    Group group = createGroup(numColumns, composite, CleanUpMessages.CodeFormatingTabPage_GroupName_Formatter);

    if (!isSaveAction()) {
        final CheckboxPreference format = createCheckboxPref(group, numColumns,
                CleanUpMessages.CodeFormatingTabPage_CheckboxName_FormatSourceCode,
                CleanUpConstants.FORMAT_SOURCE_CODE, CleanUpModifyDialog.FALSE_TRUE);
        registerPreference(format);//from   w w w .  j a  v  a 2s.c  o m
        format.addObserver(new Observer() {
            public void update(Observable o, Object arg) {
                fPreview.setFormat(format.getChecked());
                fPreview.update();
            }
        });
    }

    final CheckboxPreference whiteSpace = createCheckboxPref(group, numColumns,
            CleanUpMessages.CodeFormatingTabPage_RemoveTrailingWhitespace_checkbox_text,
            CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpModifyDialog.FALSE_TRUE);
    intent(group);
    final RadioPreference allPref = createRadioPref(group, 1,
            CleanUpMessages.CodeFormatingTabPage_RemoveTrailingWhitespace_all_radio,
            CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpModifyDialog.FALSE_TRUE);
    final RadioPreference ignoreEmptyPref = createRadioPref(group, 1,
            CleanUpMessages.CodeFormatingTabPage_RemoveTrailingWhitespace_ignoreEmpty_radio,
            CleanUpConstants.FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpModifyDialog.FALSE_TRUE);
    registerSlavePreference(whiteSpace, new RadioPreference[] { allPref, ignoreEmptyPref });

    final CheckboxPreference correctIndentation = createCheckboxPref(group, numColumns,
            CleanUpMessages.CodeFormatingTabPage_correctIndentation_checkbox_text,
            CleanUpConstants.FORMAT_CORRECT_INDENTATION, CleanUpModifyDialog.FALSE_TRUE);
    registerPreference(correctIndentation);
    correctIndentation.addObserver(new Observer() {
        public void update(Observable o, Object arg) {
            fPreview.setCorrectIndentation(correctIndentation.getChecked());
            fPreview.update();
        }
    });

    if (!isSaveAction()) {
        createLabel(numColumns, group, CleanUpMessages.CodeFormatingTabPage_FormatterSettings_Description)
                .setFont(composite.getFont());

        Group importsGroup = createGroup(numColumns, composite,
                CleanUpMessages.CodeFormatingTabPage_Imports_GroupName);
        CheckboxPreference organizeImports = createCheckboxPref(importsGroup, numColumns,
                CleanUpMessages.CodeFormatingTabPage_OrganizeImports_CheckBoxLable,
                CleanUpConstants.ORGANIZE_IMPORTS, CleanUpModifyDialog.FALSE_TRUE);
        registerPreference(organizeImports);
        createLabel(numColumns, importsGroup,
                CleanUpMessages.CodeFormatingTabPage_OrganizeImportsSettings_Description)
                        .setFont(composite.getFont());
    }

    Group sortMembersGroup = createGroup(numColumns, composite,
            CleanUpMessages.CodeFormatingTabPage_SortMembers_GroupName);

    final CheckboxPreference sortMembersPref = createCheckboxPref(sortMembersGroup, numColumns,
            CleanUpMessages.CodeFormatingTabPage_SortMembers_CheckBoxLabel, CleanUpConstants.SORT_MEMBERS,
            CleanUpModifyDialog.FALSE_TRUE);
    intent(sortMembersGroup);
    final RadioPreference sortAllPref = createRadioPref(sortMembersGroup, numColumns - 1,
            CleanUpMessages.CodeFormatingTabPage_SortMembersFields_CheckBoxLabel,
            CleanUpConstants.SORT_MEMBERS_ALL, CleanUpModifyDialog.FALSE_TRUE);
    intent(sortMembersGroup);
    final Button nullRadio = new Button(sortMembersGroup, SWT.RADIO);
    nullRadio.setText(CleanUpMessages.CodeFormatingTabPage_SortMembersExclusive_radio0);
    nullRadio.setLayoutData(createGridData(numColumns - 1, GridData.FILL_HORIZONTAL, SWT.DEFAULT));
    nullRadio.setFont(composite.getFont());
    intent(sortMembersGroup);
    final Label warningImage = new Label(sortMembersGroup, SWT.LEFT | SWT.WRAP);
    warningImage.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    warningImage.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
    final Label warningLabel = createLabel(numColumns - 2, sortMembersGroup,
            CleanUpMessages.CodeFormatingTabPage_SortMembersSemanticChange_warning);

    registerSlavePreference(sortMembersPref, new RadioPreference[] { sortAllPref });
    sortMembersPref.addObserver(new Observer() {
        public void update(Observable o, Object arg) {
            nullRadio.setEnabled(sortMembersPref.getChecked());

            boolean warningEnabled = sortMembersPref.getChecked() && sortAllPref.getChecked();
            warningImage.setEnabled(warningEnabled);
            warningLabel.setEnabled(warningEnabled);
        }
    });
    sortAllPref.addObserver(new Observer() {
        public void update(Observable o, Object arg) {
            boolean warningEnabled = sortMembersPref.getChecked() && sortAllPref.getChecked();
            warningImage.setEnabled(warningEnabled);
            warningLabel.setEnabled(warningEnabled);
        }
    });
    nullRadio.setEnabled(sortMembersPref.getChecked());
    nullRadio.setSelection(CleanUpOptions.FALSE.equals(fValues.get(CleanUpConstants.SORT_MEMBERS_ALL)));
    boolean warningEnabled = sortMembersPref.getChecked() && sortAllPref.getChecked();
    warningImage.setEnabled(warningEnabled);
    warningLabel.setEnabled(warningEnabled);

    createLabel(numColumns, sortMembersGroup, CleanUpMessages.CodeFormatingTabPage_SortMembers_Description);
}

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

License:Open Source License

private Composite createComplianceTabContent(Composite folder) {

    boolean hide_1_7 = JavaModelUtil.HIDE_VERSION_1_7 && !(VERSION_1_7.equals(getValue(PREF_COMPLIANCE))
            || VERSION_1_7.equals(getValue(PREF_CODEGEN_TARGET_PLATFORM)));

    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 };
    if (hide_1_7) {
        values3456 = removeLast(values3456);
        values3456Labels = removeLast(values3456Labels);
    }//from   ww w  .j av  a 2 s  . c o m

    final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
    Composite composite = sc1.getBody();
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    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 };
    if (hide_1_7) {
        versions = removeLast(versions);
        versionsLabels = removeLast(versionsLabels);
    }

    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:ext.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;// www.  j a v  a2s.  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;
                if (JavaModelUtil.HIDE_VERSION_1_7 && VERSION_1_7.equals(compliance)) {
                    String javaVersion = ((IVMInstall2) install).getJavaVersion();
                    if (javaVersion != null && javaVersion.startsWith(VERSION_1_7)) {
                        isVisible = false;
                    }
                }
            }
        }
        String complianceFollowsEE = getValue(INTR_COMPLIANCE_FOLLOWS_EE);
        if (JavaModelUtil.HIDE_VERSION_1_7 && DEFAULT_CONF.equals(complianceFollowsEE)) {
            if (getEE().getId().indexOf(JavaCore.VERSION_1_7) != -1) {
                isVisible = true;
                fJRE50InfoText.setText(PreferencesMessages.ComplianceConfigurationBlock_17_ee_warning);
            }
        }
        fJRE50InfoText.setVisible(isVisible);
        fJRE50InfoImage.setImage(isVisible ? JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING) : null);
        fJRE50InfoImage.getParent().layout();
    }
}

From source file:ext.org.eclipse.jdt.internal.ui.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);/*www.j  a  v  a  2s.  c  o m*/

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label infoLabel = new Label(messageComposite, SWT.WRAP);
    infoLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_select_strategy);
    GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    infoLabel.setLayoutData(gd);
    infoLabel.setFont(parent.getFont());

    int indent = convertWidthInCharsToPixels(3);

    fExactStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fExactStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_1);
    fExactStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fExactStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EXACT);
    LayoutUtil.setHorizontalIndent(fExactStrategyRadio.getSelectionButton(null), indent);

    fEmbeddedStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fEmbeddedStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_2);
    fEmbeddedStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fEmbeddedStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EMBEDDED);
    LayoutUtil.setHorizontalIndent(fEmbeddedStrategyRadio.getSelectionButton(null), indent);

    fSuffixStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fSuffixStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_3);
    fSuffixStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fSuffixStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_SUFFIX);
    LayoutUtil.setHorizontalIndent(fSuffixStrategyRadio.getSelectionButton(null), indent);

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    fWarningImageLabel = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    fWarningImageLabel.setImage(image);
    fWarningImageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    fWarningLabel = new Label(warningComposite, SWT.WRAP);
    fWarningLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_warning_short_names);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    fWarningLabel.setLayoutData(gridData);
    fWarningLabel.setFont(warningComposite.getFont());

    fExactStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EXACT;
        }
    });

    fEmbeddedStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EMBEDDED;
        }
    });

    fSuffixStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_SUFFIX;
        }
    });

    updateLabel();

    return messageComposite;
}

From source file:ext.org.eclipse.jdt.internal.ui.wizards.buildpaths.NewVariableEntryDialog.java

License:Open Source License

private void updateDeprecationWarning() {
    if (fWarning == null || fWarning.isDisposed())
        return;//from   ww w.  jav  a2  s .c om

    for (Iterator<CPVariableElement> iter = fVariablesList.getSelectedElements().iterator(); iter.hasNext();) {
        CPVariableElement element = 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:ext.org.eclipse.jdt.internal.ui.wizards.buildpaths.VariableBlock.java

License:Open Source License

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

    for (Iterator<CPVariableElement> iter = fSelectedElements.iterator(); iter.hasNext();) {
        CPVariableElement element = 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:fr.imag.adele.cadse.si.workspace.uiplatform.swt.SWTUIPlatform.java

License:Apache License

public void setMessage(String newMessage, int newType) {
    if (_pageSite != null) {
        IStatusLineManager statusLine = _pageSite.getActionBars().getStatusLineManager();
        if (statusLine != null) {
            Image newImage = null;
            if (newMessage != null) {
                switch (newType) {
                case IMessageProvider.NONE:
                    break;
                case IMessageProvider.INFORMATION:
                    newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
                    break;
                case IMessageProvider.WARNING:
                    newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
                    break;
                case IMessageProvider.ERROR:
                    newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
                    break;
                }//from w w  w .j  av  a2  s .  co  m
                if (newType == UIPlatform.ERROR) {
                    statusLine.setErrorMessage(newImage, newMessage);

                } else {
                    statusLine.setMessage(newImage, newMessage);
                }
            } else {
                statusLine.setErrorMessage(null);
                statusLine.setMessage(null);
            }
        }
    } else if (dialog != null) {
        if (newMessage != null) {
            if (newType == UIPlatform.ERROR) {
                dialog.setErrorMessage(newMessage);
                IWizardPage page = dialog.getCurrentPage();
                if (page instanceof WizardPage)
                    ((WizardPage) page).setPageComplete(false);
            } else {
                dialog.setMessage(newMessage, newType);
                IWizardPage page = dialog.getCurrentPage();
                if (page instanceof WizardPage)
                    ((WizardPage) page).setPageComplete(true);
            }
        } else {
            dialog.setErrorMessage(null);
            dialog.setMessage(null);

            IWizardPage page = dialog.getCurrentPage();
            if (page instanceof WizardPage)
                ((WizardPage) page).setPageComplete(true);

        }
    }
}