Example usage for org.eclipse.jface.dialogs IDialogConstants MINIMUM_MESSAGE_AREA_WIDTH

List of usage examples for org.eclipse.jface.dialogs IDialogConstants MINIMUM_MESSAGE_AREA_WIDTH

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants MINIMUM_MESSAGE_AREA_WIDTH.

Prototype

int MINIMUM_MESSAGE_AREA_WIDTH

To view the source code for org.eclipse.jface.dialogs IDialogConstants MINIMUM_MESSAGE_AREA_WIDTH.

Click Source Link

Document

Minimum width of message area in dialog units (value 300).

Usage

From source file:it.uniba.di.cdg.xcore.ui.dialogs.CompletableInputDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);/*w w  w  .ja v  a  2 s  .co m*/
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    text = new CCombo(composite, SWT.FLAT | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    errorMessageText = new Text(composite, SWT.READ_ONLY);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    this.text.setItems(completableItems);
    if (selectedItem > 0) {
        value = completableItems[selectedItem];
        text.select(selectedItem);
    } else
        value = "";

    applyDialogFont(composite);
    return composite;
}

From source file:masterviews.dialogs.ComboInputDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);//from   www  . j  ava 2  s  .c om
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    combo = new Combo(composite, SWT.NONE);
    combo.setItems(choices);
    combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    combo.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}

From source file:melnorme.lang.ide.ui.utils.StatusMessageDialog2.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite topControl = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) topControl.getLayout();
    gridLayout.numColumns = 2;/*from   ww  w  . ja  v a  2s . c  o m*/
    iconAndMessageWidget.createComponentInlined(topControl);
    iconAndMessageWidget.messageControlLayoutData().widthHint = convertHorizontalDLUsToPixels(
            IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);

    return topControl;
}

From source file:msi.gama.gui.swt.dialogs.AbstractDetailsDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part of this dialog (above the button bar).
 * This includes an image, if specified, and a message.
 * /* ww w . j a v  a  2 s  .c o  m*/
 * @param parent the parent composite to contain the dialog area
 * 
 * @return the dialog area control
 */
@Override
protected Control createDialogArea(final Composite parent) {
    final Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    if (image != null) {
        ((GridLayout) composite.getLayout()).numColumns = 2;
        final Label label = new Label(composite, 0);
        image.setBackground(label.getBackground());
        label.setImage(image);
        label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
    }
    if (message != null) {
        final Label label = new Label(composite, SWT.WRAP);
        label.setText(message);
        final GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    return composite;
}

From source file:net.enilink.komma.edit.ui.dialogs.InputDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);//  ww w .  j  a  v a  2  s  . co m
        GridData data = new GridData(
                GridData.GRAB_HORIZONTAL/* | GridData.GRAB_VERTICAL */ | GridData.HORIZONTAL_ALIGN_FILL
                        | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    /*
     * text = new Text(composite, SWT.SINGLE | SWT.BORDER);
     * text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL |
     * GridData.HORIZONTAL_ALIGN_FILL));
     */
    text = createText(composite);
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    errorMessageText = new Text(composite, SWT.READ_ONLY);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}

From source file:net.heartsome.license.CustomMessageDialog.java

@Override
protected Control createMessageArea(Composite composite) {
    Image image = getImage();//  w  w w . ja v  a 2 s. com
    if (image != null) {
        imageLabel = new Label(composite, SWT.NULL);
        image.setBackground(imageLabel.getBackground());
        imageLabel.setImage(image);
        addAccessibleListeners(imageLabel, image);
        GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
    }
    // create message
    if (message != null) {
        text = new StyledText(composite, getMessageLabelStyle());
        text.setBackground(composite.getBackground());
        text.setText(message);
        text.setEditable(false);
        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
                .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
                .applyTo(text);
        setStyle();
    }
    return composite;
}

From source file:net.refractions.udig.ui.ExceptionDetailsDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    if (image != null) {
        ((GridLayout) composite.getLayout()).numColumns = 2;
        Label label = new Label(composite, 0);
        image.setBackground(label.getBackground());
        label.setImage(image);/*from  w  w w .j a va2  s  .c o  m*/
        label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
    }

    Label label = new Label(composite, SWT.WRAP);
    if (message != null)
        label.setText(message);
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(data);
    label.setFont(parent.getFont());

    return composite;
}

From source file:net.rim.ejde.internal.ui.dialogs.VCWarningDialog.java

License:Open Source License

protected Control createMessageArea(Composite composite) {
    // create composite
    // create image
    Image image = getImage();//from  w w w. j a va  2  s  .c  o m

    if (image != null) {
        imageLabel = new Label(composite, SWT.NULL);
        image.setBackground(imageLabel.getBackground());
        imageLabel.setImage(image);

        GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
    }
    // create message
    if (message != null) {
        Link _link = new Link(composite, SWT.TOP);
        _link.setText(message + " The required package can be installed from: <a href=" + _href
                + "> MS VC2008 Redistributable Package</a>");

        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
                .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
                .applyTo(_link);
        _link.addSelectionListener(new SelectionListener() {
            public void widgetDefaultSelected(SelectionEvent e) {
                // Do Nothing
            }

            public void widgetSelected(SelectionEvent e) {
                _log.debug(e.text);
                IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
                try {
                    IWebBrowser browser = support.createBrowser(
                            IWorkbenchBrowserSupport.AS_EXTERNAL | IWorkbenchBrowserSupport.NAVIGATION_BAR,
                            null, null, null);
                    browser.openURL(new URL(e.text));
                } catch (PartInitException e1) {
                    // TODO Auto-generated catch block
                    _log.error("enable to open external broswer");
                } catch (MalformedURLException e2) {
                    // TODO Auto-generated catch block
                    _log.error("enable to open external broswer");
                }
            }
        });
    }

    return composite;
}

From source file:net.sf.eclipsensis.dialogs.MinimalProgressMonitorDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite composite) {
    // create message
    if (message != null) {
        messageLabel = new Label(composite, SWT.NONE);
        messageLabel.setText(message);/*from  ww  w  .  ja v a2  s  . c om*/
        GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
        data.horizontalSpan = 2;
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(data);
        taskLabel = messageLabel;
        if (mBGImage != null) {
            messageLabel.addPaintListener(mLabelPaintListener);
        }
    }
    return composite;
}

From source file:net.sf.eclipsensis.dialogs.StatusMessageDialog.java

License:Open Source License

protected Control createMessageArea(Composite composite) {
    Image image = getImage();// w  w  w  . j ava  2 s .  c  o m
    if (image != null) {
        mImageLabel = new Label(composite, SWT.NONE);
        image.setBackground(mImageLabel.getBackground());
        mImageLabel.setImage(image);
        mImageLabel.setLayoutData(
                new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
    }
    // create message
    if (mMessage != null) {
        mMessageLabel = new Label(composite, getMessageLabelStyle());
        mMessageLabel.setText(mMessage);
        GridData data = new GridData(
                GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        mMessageLabel.setLayoutData(data);
        if ((mMessageLabel.getStyle() & SWT.WRAP) == 0) {
            mMessageLabel.addControlListener(new ControlAdapter() {
                @Override
                public void controlResized(ControlEvent e) {
                    updateMessageLabelToolTip();
                }
            });
        }
    }
    return composite;
}