Example usage for org.eclipse.jface.dialogs TitleAreaDialog DLG_IMG_TITLE_BANNER

List of usage examples for org.eclipse.jface.dialogs TitleAreaDialog DLG_IMG_TITLE_BANNER

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs TitleAreaDialog DLG_IMG_TITLE_BANNER.

Prototype

String DLG_IMG_TITLE_BANNER

To view the source code for org.eclipse.jface.dialogs TitleAreaDialog DLG_IMG_TITLE_BANNER.

Click Source Link

Document

Image registry key for banner image (value "dialog_title_banner_image").

Usage

From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java

License:Open Source License

/**
 * Creates the dialog's title area.//w w  w.  j a v a 2 s  . co  m
 *
 * @param parent
 *          the SWT parent for the title area widgets
 * @return Control with the highest x axis value.
 */
private Control createTitleArea(final Composite parent) {
    // remeber parent in order to change its colors
    m_parent = parent;

    // Determine the background color of the title bar
    final Display display = parent.getDisplay();
    m_defaultTitleBackground = JFaceColors.getBannerBackground(display).getRGB();
    m_defaultTitleForeground = JFaceColors.getBannerForeground(display).getRGB();

    final int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    final int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    // Dialog image @ right
    m_titleImage = new Label(parent, SWT.CENTER);
    m_titleImage.setImage(JFaceResources.getImage(TitleAreaDialog.DLG_IMG_TITLE_BANNER));
    final FormData imageData = new FormData();
    imageData.top = new FormAttachment(0, verticalSpacing);
    // Note: do not use horizontalSpacing on the right as that would be a
    // regression from
    // the R2.x style where there was no margin on the right and images are
    // flush to the right
    // hand side. see reopened comments in 41172
    imageData.right = new FormAttachment(100, 0); // horizontalSpacing
    m_titleImage.setLayoutData(imageData);
    // Title label @ top, left
    m_titleLabel = new Label(parent, SWT.LEFT);
    m_titleLabel.setFont(JFaceResources.getBannerFont());
    m_titleLabel.setText(" ");//$NON-NLS-1$
    final FormData titleData = new FormData();
    titleData.top = new FormAttachment(0, verticalSpacing);
    titleData.right = new FormAttachment(m_titleImage);
    titleData.left = new FormAttachment(0, horizontalSpacing);
    m_titleLabel.setLayoutData(titleData);
    // Message image @ bottom, left
    m_messageImageLabel = new Label(parent, SWT.CENTER);
    // Message label @ bottom, center
    m_messageLabel = new Text(parent, SWT.WRAP | SWT.READ_ONLY);
    m_messageLabel.setText(" \n "); // two lines//$NON-NLS-1$
    m_messageLabel.setFont(JFaceResources.getDialogFont());

    // Filler labels
    m_leftFillerLabel = new Label(parent, SWT.CENTER);
    m_bottomFillerLabel = new Label(parent, SWT.CENTER);
    setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    determineTitleImageLargest();
    if (m_titleImageLargest)
        return m_titleImage;
    return m_messageLabel;
}