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.pde.internal.ui.wizards.tools.OrganizeManifestsWizardPage.java

License:Open Source License

private void createCustomBuildWarning(Composite container) {
    Composite parent = SWTFactory.createComposite(container, 2, 1, GridData.FILL_HORIZONTAL);

    Label image = new Label(parent, SWT.NONE);
    image.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    image.setLayoutData(gd);/*w  ww .  ja va  2s. co  m*/

    String message;
    if (fCustomProjects.size() == 1) {
        message = NLS.bind(PDEUIMessages.OrganizeManifestsWizardPage_ProjectsUsingCustomBuildWarning,
                ((IProject) fCustomProjects.iterator().next()).getName());
    } else {
        StringBuffer buf = new StringBuffer();
        for (Iterator<?> iterator = fCustomProjects.iterator(); iterator.hasNext();) {
            IProject project = (IProject) iterator.next();
            buf.append(project.getName());
            if (iterator.hasNext()) {
                buf.append(',').append(' ');
            }
        }
        message = NLS.bind(PDEUIMessages.OrganizeManifestsWizardPage_ProjectsUsingCustomBuildWarningPlural,
                buf.toString());
    }

    // Using a link as a wrap label appear to force the wizard to max vertical space
    Link link = new Link(parent, SWT.WRAP);
    link.setText(message);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.widthHint = 200;
    link.setLayoutData(gd);
}

From source file:org.eclipse.php.composer.ui.wizard.DetectGroup.java

License:Open Source License

public DetectGroup(Composite parent, LocationGroup locationGroup, NameGroup nameGroup) {
    this.fPHPLocationGroup = locationGroup;
    this.fGroupName = nameGroup;

    Composite composite = new Composite(parent, SWT.None);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
    GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing = 10;/*from  www.  j a v  a  2  s .  co  m*/
    composite.setLayout(layout);

    fIcon = new Label(composite, SWT.LEFT);
    fIcon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
    fIcon.setLayoutData(gridData);
    fIcon.setVisible(false);

    fHintText = new Link(composite, SWT.WRAP);
    fHintText.setFont(composite.getFont());
    gridData = new GridData(GridData.FILL, SWT.FILL, true, true);
    gridData.widthHint = 500;
    fHintText.setLayoutData(gridData);
    fHintText.setText(NewWizardMessages.ScriptProjectWizardFirstPage_DetectGroup_message);
    fHintText.setVisible(false);
}

From source file:org.eclipse.reddeer.jface.test.dialogs.TitleAreaDialogTest.java

License:Open Source License

@Test
public void titleAreaMessagesAndImages() {
    openTitleAreaDialog();/* ww  w  . j a  v a  2s  .  c  o  m*/
    TitleAreaDialogImpl dialog = new TitleAreaDialogImpl();
    assertEquals(TestingTitleAreaDialog.DEFAULT_MESSAGE, dialog.getMessage());
    assertEquals(MessageTypeEnum.NONE, dialog.getMessageType());
    assertEquals(TestingTitleAreaDialog.TITLE, dialog.getTitle());
    assertNull(dialog.getMessageImage());
    assertEquals(Activator.getDefault().getImageRegistry().get(Activator.REDDEER_ICON), dialog.getTitleImage());

    dialog.errorButton();
    assertEquals(TestingTitleAreaDialog.ERROR_MESSAGE, dialog.getMessage());
    assertEquals(MessageTypeEnum.ERROR, dialog.getMessageType());
    assertEquals(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR), dialog.getMessageImage());

    dialog.warningButton();
    assertEquals(TestingTitleAreaDialog.WARNING_MESSAGE, dialog.getMessage());
    assertEquals(MessageTypeEnum.WARNING, dialog.getMessageType());
    assertEquals(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING), dialog.getMessageImage());

    dialog.infoButton();
    assertEquals(TestingTitleAreaDialog.INFO_MESSAGE, dialog.getMessage());
    assertEquals(MessageTypeEnum.INFO, dialog.getMessageType());
    assertEquals(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO), dialog.getMessageImage());

    dialog.noneButton();
    assertEquals(TestingTitleAreaDialog.NONE_MESSAGE, dialog.getMessage());
    assertEquals(MessageTypeEnum.NONE, dialog.getMessageType());
    assertNull(dialog.getMessageImage());

    dialog.errorWithoutProviderButton();
    assertEquals(TestingTitleAreaDialog.ERROR_MESSAGE_WITHOUT_PROVIDER, dialog.getMessage());
    assertEquals(MessageTypeEnum.ERROR, dialog.getMessageType());

}

From source file:org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage.java

License:Open Source License

/**
 * Get the image for the given message type.
 * @param messageType The message type./* w  ww.ja va  2  s  .  c  o  m*/
 * @return The image.
 */
protected Image getMessageImage(int messageType) {
    switch (messageType) {
    case IMessageProvider.INFORMATION:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
    case IMessageProvider.WARNING:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    case IMessageProvider.ERROR:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
    default:
        return null;
    }
}

From source file:org.eclipse.ui.internal.views.markers.ViewerSettingsAndStatusDialog.java

License:Open Source License

/**
 */
protected Image getWarningImage() {
    return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
}

From source file:org.eclipse.ui.texteditor.MessageRegion.java

License:Open Source License

/**
 * Show the new message in the message text and update the image. Base the background color on
 * whether or not there are errors./*from   ww w  . java2s.c  o m*/
 *
 * @param newMessage The new value for the message
 * @param newType One of the IMessageProvider constants. If newType is IMessageProvider.NONE
 *            show the title.
 * @see IMessageProvider
 */
public void updateText(String newMessage, int newType) {
    Image newImage = null;
    boolean showingError = false;
    switch (newType) {
    case IMessageProvider.NONE:
        hideRegion();
        return;
    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);
        showingError = true;
        break;
    }

    if (newMessage == null) {//No message so clear the area
        hideRegion();
        return;
    }
    showRegion();
    // Any more updates required
    if (newMessage.equals(messageText.getText()) && newImage == messageImageLabel.getImage())
        return;
    messageImageLabel.setImage(newImage);
    messageText.setText(newMessage);
    if (showingError)
        setMessageColors(JFaceColors.getErrorBackground(messageComposite.getDisplay()));
    else {
        lastMessageText = newMessage;
        setMessageColors(JFaceColors.getBannerBackground(messageComposite.getDisplay()));
    }

}

From source file:org.eclipse.wst.jsdt.internal.ui.dialogs.SortMembersMessageDialog.java

License:Open Source License

protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);// www. j av a 2  s  .  co 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));

    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:org.eclipse.wst.jsdt.internal.ui.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java

License:Open Source License

protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);//  ww  w .j ava  2 s .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:org.eclipse.xtext.xtext.ui.wizard.project.StatusWidget.java

License:Open Source License

private Image imageFor(final int type) {
    Image _switchResult = null;/*from   w  ww .  j  av a  2  s. c o  m*/
    switch (type) {
    case IMessageProvider.NONE:
        _switchResult = null;
        break;
    case IMessageProvider.INFORMATION:
        _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
        break;
    case IMessageProvider.WARNING:
        _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
        break;
    case IMessageProvider.ERROR:
        _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
        break;
    }
    return _switchResult;
}

From source file:org.fusesource.ide.branding.wizards.NewCamelTestWizardPageOne.java

License:Open Source License

/**
 * Creates the controls for the JUnit 4 toggle control. Expects a
 * <code>GridLayout</code> with at least 3 columns.
 * //from   ww  w. j  a  va2s . c om
 * @param composite
 *            the parent composite
 * @param nColumns
 *            number of columns to span
 * 
 * @since 3.2
 */
protected void createBuildPathConfigureControls(Composite composite, int nColumns) {
    Composite inner = new Composite(composite, SWT.NONE);
    inner.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, nColumns, 1));
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    inner.setLayout(layout);

    fImage = new Label(inner, SWT.NONE);
    fImage.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    fImage.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));

    fLink = new Link(inner, SWT.WRAP);
    fLink.setText("\n\n"); //$NON-NLS-1$
    fLink.addSelectionListener(new SelectionAdapter() {
        /*
         * (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {
            performBuildpathConfiguration(e.text);
        }
    });
    GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, true, false, 1, 1);
    gd.widthHint = convertWidthInCharsToPixels(60);
    fLink.setLayoutData(gd);
    updateBuildPathMessage();
}