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:eu.geclipse.ui.dialogs.ProblemDialog.java

License:Open Source License

protected void createReasonArea(final Composite parent) {

    String[] reasons = getReasons();

    if ((reasons != null) && (reasons.length > 0)) {

        ImageRegistry imgReg = Activator.getDefault().getImageRegistry();
        Image reasonImage = imgReg.get("reason"); //$NON-NLS-1$

        final ScrolledComposite sComp = createListArea("Reasons:", parent, 200);

        final Composite reasonList = new Composite(sComp, SWT.NONE);
        sComp.setContent(reasonList);//  w  w  w.ja  va2  s.c om
        reasonList.setLayout(new GridLayout(2, false));

        for (String reason : reasons) {

            Label imgLabel = new Label(reasonList, SWT.NONE);
            imgLabel.setImage(reasonImage);
            GridData gData = new GridData();
            gData.horizontalAlignment = GridData.CENTER;
            gData.verticalAlignment = GridData.BEGINNING;
            imgLabel.setLayoutData(gData);

            Label label = new Label(reasonList, SWT.WRAP);
            label.setText(reason);
            gData = new GridData(GridData.FILL_HORIZONTAL);
            gData.grabExcessHorizontalSpace = true;
            gData.horizontalAlignment = GridData.BEGINNING;
            label.setLayoutData(gData);

        }

        int wHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        reasonList.setSize(reasonList.computeSize(wHint, SWT.DEFAULT));

        sComp.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(final ControlEvent e) {
                Rectangle r = sComp.getClientArea();
                Point cSize = reasonList.computeSize(r.width, SWT.DEFAULT);
                reasonList.setSize(cSize);
            }
        });

    }

}

From source file:eu.geclipse.ui.dialogs.ProblemDialog.java

License:Open Source License

protected void createSolutionArea(final Composite parent) {

    ISolution[] solutions = getSolutions();

    if ((solutions != null) && (solutions.length > 0)) {

        ImageRegistry imgReg = Activator.getDefault().getImageRegistry();
        Image solutionImage = imgReg.get("solution"); //$NON-NLS-1$

        final ScrolledComposite sComp = createListArea(Messages.getString("ProblemDialog.solutions_label"), //$NON-NLS-1$
                parent, 200);//from  w  w w .j a  v  a 2s.  com

        final Composite solutionList = new Composite(sComp, SWT.NONE);
        sComp.setContent(solutionList);
        solutionList.setLayout(new GridLayout(2, false));

        for (final ISolution solution : solutions) {

            Label imgLabel = new Label(solutionList, SWT.NONE);
            imgLabel.setImage(solutionImage);
            GridData gData = new GridData();
            gData.horizontalAlignment = GridData.CENTER;
            gData.verticalAlignment = GridData.BEGINNING;
            imgLabel.setLayoutData(gData);

            Link link = new Link(solutionList, SWT.WRAP);
            String text = solution.getDescription();
            if (solution.isActive()) {
                link.setText("<a>" + text + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
            } else {
                link.setText(text);
            }
            gData = new GridData(GridData.FILL_HORIZONTAL);
            gData.grabExcessHorizontalSpace = true;
            gData.horizontalAlignment = GridData.BEGINNING;
            link.setLayoutData(gData);
            link.addSelectionListener(new SelectionAdapter() {
                @SuppressWarnings("synthetic-access")
                @Override
                public void widgetSelected(final SelectionEvent e) {
                    setReturnCode(SOLVE);
                    close();
                    try {
                        solution.solve();
                    } catch (InvocationTargetException itExc) {
                        Throwable cause = itExc.getCause();
                        Activator.logException(cause);
                    }
                }
            });
        }

        int wHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        solutionList.setSize(solutionList.computeSize(wHint, SWT.DEFAULT));

        sComp.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(final ControlEvent e) {
                Rectangle r = sComp.getClientArea();
                Point cSize = solutionList.computeSize(r.width, SWT.DEFAULT);
                solutionList.setSize(cSize);
            }
        });

    }

}

From source file:eu.portavita.coverage.handlers.ComboInputDialog.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);//from  w ww . j a  v  a  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.toArray(new String[] {}));
    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:ext.org.eclipse.jdt.internal.ui.dialogs.SortMembersMessageDialog.java

License:Open Source License

private Control createLinkControl(Composite composite) {
    Link link = new Link(composite, SWT.WRAP | SWT.RIGHT);
    link.setText(DialogsMessages.SortMembersMessageDialog_description);
    link.addSelectionListener(new SelectionAdapter() {
        @Override//ww w  . j av a 2 s  . c o m
        public void widgetSelected(SelectionEvent e) {
            openMembersSortOrderPage();
        }
    });
    link.setToolTipText(DialogsMessages.SortMembersMessageDialog_link_tooltip);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);//convertWidthInCharsToPixels(60);
    link.setLayoutData(gridData);
    link.setFont(composite.getFont());

    return link;
}

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

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);//www  .  j  a  v  a2  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.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);//from   w  ww.  j a  v  a  2 s  .  c om

    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:fr.inria.linuxtools.internal.tmf.ui.dialogs.MultiLineInputDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    final Text text = getText();

    /* create dialog message label here instead because default implementation uses GRAB_VERTICAL */
    if (dialogMessage != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(dialogMessage);//from w  w w .  ja v  a  2s.  co m
        GridData data = new GridData(
                GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
        label.moveAbove(text);
    }

    /* modify text layout data here because default implementation doesn't fill vertically */
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = convertHorizontalDLUsToPixels(250);
    gridData.heightHint = convertHeightInCharsToPixels(3);
    text.setLayoutData(gridData);

    text.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
                if (submitOnCR) {
                    /* submit the dialog */
                    e.doit = false;
                    okPressed();
                    return;
                }
            } else if (e.character == SWT.TAB) {
                /* don't insert a tab character in the text */
                e.doit = false;
                text.traverse(SWT.TRAVERSE_TAB_NEXT);
            }
            /* don't allow CR to submit anymore */
            submitOnCR = false;
        }
    });

    text.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent e) {
            /* don't allow CR to submit anymore */
            submitOnCR = false;
        }
    });

    return composite;
}

From source file:fr.obeo.dsl.arduino.preferences.ArduinoSdkDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Link link = new Link(composite, SWT.NONE);
    String message = "Set the path to the Arduino SDK in the Arduino Designer Preferences to be able to compile and upload code to the target";
    link.setText(message);/*from  w w  w  .  j av a2  s.  c  o m*/

    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
            .hint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH, SWT.DEFAULT).applyTo(link);
    applyDialogFont(composite);

    return composite;
}

From source file:gov.nasa.arc.spife.ui.timeline.action.dialog.GoToTimeDialog.java

License:Open Source License

/**
 * The label that is used to display the calculated message to the user.
 * //from  w  ww.ja  v  a2s .  c om
 * @param parent
 * @param composite
 * @param message
 * @return the newly created label
 */
private Label createLabel(Composite parent, Composite composite, String message) {
    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 label;
}

From source file:gov.nasa.ensemble.core.plan.editor.drudgery.MoveSelectedDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    final GridLayout gridLayout = new GridLayout(1, true);
    container.setLayout(gridLayout);//from  w  w  w. j  av a 2 s  .c  om

    GridData data = null;

    Label purposeLabel = new Label(container, SWT.WRAP);
    purposeLabel.setText("Enter the desired start time of the earliest element or how far to move them");
    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);
    purposeLabel.setLayoutData(data);
    purposeLabel.setFont(parent.getFont());

    text = new Text(container, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.setText(DEFAULT_TO_CURRENT ? DATE_STRINGIFIER.getDisplayString(referenceDate) : "");
    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });

    for (String formatHelpLine : FORMAT_HELP) {
        Label formatLabel = new Label(container, SWT.WRAP);
        formatLabel.setText(formatHelpLine.replace('\'', '"'));
        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);
        formatLabel.setLayoutData(data);
        formatLabel.setFont(parent.getFont());
    }

    return container;
}