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:org.eclipse.jst.jsf.ui.internal.classpath.WarningMessageDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite composite) {
    // create composite
    // create image
    Image image = getImage();//  w  w w .j a  va 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) {
        _messageLabel = new Text(composite, getMessageLabelStyle() | SWT.READ_ONLY);
        _messageLabel.setText(message);
        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
                .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
                .applyTo(_messageLabel);
    }
    return composite;
}

From source file:org.eclipse.jubula.client.ui.rcp.wizards.pages.DatabaseMigrationAssistantIntroPage.java

License:Open Source License

/**
 * {@inheritDoc}//from w  ww . j a v a 2s  .  co m
 */
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());

    Label label = new Label(composite, SWT.WRAP);
    label.setText(Messages.DatabaseMigrationAssistantIntroPageText);

    initializeDialogUnits(label);

    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .applyTo(label);

    Plugin.getHelpSystem().setHelp(composite, ContextHelpIds.IMPORT_PROJECT_DIALOG);

    setControl(composite);
}

From source file:org.eclipse.linuxtools.dataviewers.charts.dialogs.ChartDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Composite titleComp = new Composite(composite, SWT.NONE);
    titleComp.setLayout(new RowLayout(SWT.HORIZONTAL));

    Label icon = new Label(titleComp, SWT.NONE);
    icon.setImage(Activator.getImage("icons/chart_icon.png"));

    Label label = new Label(titleComp, SWT.WRAP);
    label.setText("Chart builder");
    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);
    titleComp.setLayoutData(data);//from w ww.j a v  a 2s .c  o m

    Group chartTypeGroup = new Group(composite, SWT.NONE);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    chartTypeGroup.setLayoutData(data);
    chartTypeGroup.setLayout(new GridLayout(2, false));
    chartTypeGroup.setText("Select your chart type");

    ValidateSelectionListener listener = new ValidateSelectionListener();

    barGraphButton = new Button(chartTypeGroup, SWT.RADIO);
    barGraphButton.setText("Bar graph");
    barGraphButton.addSelectionListener(listener);
    barGraphButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            verticalBarsButton.setEnabled(barGraphButton.getSelection());
        }
    });
    data = new GridData();
    barGraphButton.setLayoutData(data);

    verticalBarsButton = new Button(chartTypeGroup, SWT.CHECK);
    verticalBarsButton.setText("Vertical bars");
    data = new GridData();
    verticalBarsButton.setLayoutData(data);

    pieChartButton = new Button(chartTypeGroup, SWT.RADIO);
    pieChartButton.setText("Pie chart");
    pieChartButton.addSelectionListener(listener);
    data = new GridData();
    data.horizontalSpan = 2;
    pieChartButton.setLayoutData(data);

    Group chartColumnGroup = new Group(composite, SWT.NONE);
    chartColumnGroup.setLayout(new GridLayout(1, true));
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    chartColumnGroup.setLayoutData(data);
    chartColumnGroup.setText("Select the columns(s) to show");

    addColumnButtons(chartColumnGroup, listener);

    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));

    applyDialogFont(composite);

    setWidgetsValues();

    return composite;
}

From source file:org.eclipse.linuxtools.internal.dataviewers.charts.dialogs.ChartDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Composite titleComp = new Composite(composite, SWT.NONE);
    titleComp.setLayout(new RowLayout(SWT.HORIZONTAL));

    Label icon = new Label(titleComp, SWT.NONE);
    icon.setImage(Activator.getImage("icons/chart_icon.png")); //$NON-NLS-1$

    Label label = new Label(titleComp, SWT.WRAP);
    label.setText(Messages.ChartConstants_CHART_BUILDER);
    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);
    titleComp.setLayoutData(data);//from   w w  w  .  ja  v  a 2  s . c o m

    Group chartTypeGroup = new Group(composite, SWT.NONE);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    chartTypeGroup.setLayoutData(data);
    chartTypeGroup.setLayout(new GridLayout(2, false));
    chartTypeGroup.setText(Messages.ChartConstants_SELECT_YOUR_CHART_TYPE);

    ValidateSelectionListener listener = new ValidateSelectionListener();

    barGraphButton = new Button(chartTypeGroup, SWT.RADIO);
    barGraphButton.setText(Messages.ChartConstants_BAR_GRAPH);
    barGraphButton.addSelectionListener(listener);
    barGraphButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            verticalBarsButton.setEnabled(barGraphButton.getSelection());
        }
    });
    data = new GridData();
    barGraphButton.setLayoutData(data);

    verticalBarsButton = new Button(chartTypeGroup, SWT.CHECK);
    verticalBarsButton.setText(Messages.ChartConstants_VERTICAL_BARS);
    data = new GridData();
    verticalBarsButton.setLayoutData(data);

    pieChartButton = new Button(chartTypeGroup, SWT.RADIO);
    pieChartButton.setText(Messages.ChartConstants_PIE_CHART);
    pieChartButton.addSelectionListener(listener);
    data = new GridData();
    data.horizontalSpan = 2;
    pieChartButton.setLayoutData(data);

    Group chartColumnGroup = new Group(composite, SWT.NONE);
    chartColumnGroup.setLayout(new GridLayout(1, true));
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    chartColumnGroup.setLayoutData(data);
    chartColumnGroup.setText(Messages.ChartConstants_SELECT_COLUMNS_TO_SHOW);

    addColumnButtons(chartColumnGroup, listener);

    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));

    applyDialogFont(composite);

    setWidgetsValues();

    return composite;
}

From source file:org.eclipse.ltk.internal.ui.refactoring.history.EditRefactoringDetailsDialog.java

License:Open Source License

/**
 * {@inheritDoc}/*from w  w  w  .  jav  a2 s  .  c  o m*/
 */
protected Control createDialogArea(final Composite parent) {
    initializeDialogUnits(parent);
    final Composite composite = (Composite) super.createDialogArea(parent);
    if (fMessage != null) {
        final Label label = new Label(composite, SWT.WRAP);
        label.setText(fMessage);
        final 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());
    }
    fDetailsField = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    final GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.heightHint = convertHeightInCharsToPixels(8);
    fDetailsField.setLayoutData(data);
    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.mylyn.internal.tasks.ui.dialogs.TaskRepositoryCredentialsDialog.java

License:Open Source License

private void createLinkArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Link link = new Link(composite, SWT.WRAP);
    link.setText(Messages.TaskRepositoryCredentialsDialog_HTML_Open_Repository_Properties);
    link.addSelectionListener(new SelectionAdapter() {
        @Override//  w  w w.  j  a v a 2s .  c o  m
        public void widgetSelected(SelectionEvent e) {
            close();
            int returnCode = TasksUiUtil.openEditRepositoryWizard(taskRepository);
            if (returnCode == Window.OK) {
                setReturnCode(TASK_REPOSITORY_CHANGED);
            } else {
                setReturnCode(returnCode);
            }
        }
    });
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .grab(true, false).applyTo(link);
}

From source file:org.eclipse.mylyn.internal.tasks.ui.dialogs.TaskRepositoryCredentialsDialog.java

License:Open Source License

private void createWarningMessage(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*from w w  w  .  j  ava2 s. c  o  m*/
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(composite);

    Label label = new Label(composite, SWT.NONE);
    label.setImage(Dialog.getImage(DLG_IMG_MESSAGE_WARNING));
    label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));

    label = new Label(composite, SWT.WRAP);
    label.setText(Messages.TaskRepositoryCredentialsDialog_Saved_passwords_are_stored_that_is_difficult);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .grab(true, false).applyTo(label);
}

From source file:org.eclipse.papyrus.diagram.common.ui.dialogs.InputDialog.java

License:Open Source License

/**
 * /*  w w w .ja  v a2  s .  com*/
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 * 
 * @param parent
 * @return
 */
@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);
        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());
    }
    return composite;
}

From source file:org.eclipse.papyrus.documentation.view.CommentsComposite.java

License:Open Source License

private void showMessageDialog() {
    MessageDialog dialog = new MessageDialog(getShell(), "Rich Text Edition unavailable", null,
            "Your operating system does not support the SWT Browser component, thus you are not able to edit documentation using rich text capabilities.\n"
                    + "You should try installing XULRunner in your environment so that you can enable Rich Text Edition, and then restart your application.\n"
                    + "To install XulRunner, have a look at : <a>http://www.eclipse.org/atf/downloads/base_files/manualXulrunner_section.php</a>.",
            MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0) {
        @Override/*from   www .  j a v a 2s  .com*/
        protected Control createMessageArea(Composite composite) {
            Image image = getImage();
            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 messageLink = new Link(composite, getMessageLabelStyle());
                messageLink.setText(message);
                messageLink.addListener(SWT.Selection, new Listener() {
                    public void handleEvent(Event event) {
                        try {
                            PlatformUI.getWorkbench().getBrowserSupport().createBrowser(null)
                                    .openURL(new URL(event.text));
                            okPressed();
                        } catch (PartInitException e) {
                            // TODO log
                        } catch (MalformedURLException e) {
                            // TODO log
                        }
                    }
                });
                GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
                        .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
                                SWT.DEFAULT)
                        .applyTo(messageLink);
            }
            return composite;
        }
    };
    dialog.open();
}

From source file:org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog.java

License:Open Source License

/**
 * {@inheritDoc}//w  w w . ja v  a  2 s .  c  o  m
 */
@Override
protected Control createDialogArea(Composite parent) {
    Group composite = new Group(parent, SWT.RESIZE);
    composite.setText("Specification");
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite viewerGroup = new Composite(composite, SWT.RESIZE);
    FillLayout viewerLayout = new FillLayout();
    viewerGroup.setLayout(viewerLayout);
    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);
    viewerGroup.setLayoutData(data);
    viewer = new SourceViewer(viewerGroup, null, SWT.BORDER | SWT.FILL_EVEN_ODD);

    // configure source viewer
    document = new Document();
    document.set(value);

    // add completion processor key listener (ctrl+space keys)
    viewer.appendVerifyKeyListener(new LabelKeyListener(viewer));

    document.addDocumentListener(new DocumentListener());
    viewer.configure(configuration.getSourceViewerConfiguration());
    viewer.setDocument(document);

    Selection selection = configuration.getTextSelection(value, editedObject);
    viewer.setSelectedRange(selection.getStart(), selection.getLentgh());

    Composite extendedArea = configuration.createExtendedDialogArea(viewerGroup);
    if (extendedArea != null) {
        extendedArea.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    }

    errorMessageText = new CLabel(composite, SWT.READ_ONLY | SWT.SHADOW_NONE);
    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;
}