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:com.microsoft.tfs.client.common.ui.teambuild.wizards.BuildToolPicker.java

License:Open Source License

protected void createUI() {
    SWTUtil.gridLayout(this, 4, false);

    label = new Label(this, SWT.NONE);
    label.setText(labelName);//ww  w  .  j  ava 2  s .  c o m
    if (labelWidth > 0) {
        GridDataBuilder.newInstance().vAlign(SWT.CENTER).wCHint(label, labelWidth).applyTo(label);
    } else {
        GridDataBuilder.newInstance().vAlign(SWT.CENTER).applyTo(label);
    }

    pathTypeCombo = new Combo(this, SWT.READ_ONLY);
    GridDataBuilder.newInstance().hFill().vAlign(SWT.CENTER).applyTo(pathTypeCombo);
    selectedIndex = 0;
    updateCombo(pathTypeCombo);

    pathText = new Text(this, SWT.BORDER);
    GridDataBuilder.newInstance().hAlign(SWT.FILL).hGrab().vAlign(SWT.CENTER).applyTo(pathText);

    selectButton = new Button(this, SWT.NONE);
    selectButton.setText(Messages.getString("BuildToolPicker.SelectButtonLabel")); //$NON-NLS-1$
    GridDataBuilder.newInstance().vAlign(SWT.CENTER).applyTo(selectButton);

    selectButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            browseOnServer(((Button) e.widget).getShell());
        }
    });

    SWTUtil.createHorizontalGridLayoutSpacer(this, 1);

    helpLabel = new Label(this, SWT.WRAP);
    GridDataBuilder.newInstance().hSpan(2).hFill().hGrab().wHint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH)
            .applyTo(helpLabel);

    pathTypeCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            selectedIndex = pathTypeCombo.getSelectionIndex();
            processSelectedLinkType();
        }
    });

    processSelectedLinkType();
}

From source file:com.microsoft.tfs.client.common.ui.teambuild.wizards.UploadArchiveDialog.java

License:Open Source License

private Composite createInfoComposite(final Composite parent) {
    final Composite composite = SWTUtil.createComposite(parent);
    SWTUtil.gridLayout(composite, 2, false);
    GridDataBuilder.newInstance().hFill().hGrab().applyTo(composite);

    iconLabel = SWTUtil.createLabel(composite, infoImage);
    GridDataBuilder.newInstance().vAlign(SWT.TOP).applyTo(iconLabel);

    helpLabel = new Label(composite, SWT.WRAP);
    helpLabel.setText(folderHelper);/*  w  w w.  j  a  va 2s  .  c o m*/
    GridDataBuilder.newInstance().hFill().hGrab().wHint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH)
            .applyTo(helpLabel);
    return composite;
}

From source file:com.microsoft.tfs.client.common.ui.wit.dialogs.LabelableLinkSelectionDialog.java

License:Open Source License

@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    dialogArea.setLayout(layout);/*  w ww .j a v  a2 s.  c  om*/

    final Label explanationLabel = new Label(dialogArea, SWT.WRAP);
    explanationLabel.setText(Messages.getString("LabelableLinkSelectionDialog.LinkSelectionNotAvail")); //$NON-NLS-1$
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(explanationLabel);
    ControlSize.setSizeHints(explanationLabel,
            convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT);

    linkTable = new LabelableLinkTable(dialogArea, SWT.BORDER | SWT.FULL_SELECTION);
    linkTable.setLinkItems(linkItems);
    GridDataBuilder.newInstance().grab().fill().applyTo(linkTable);
    ControlSize.setCharHeightHint(linkTable, 8);

    linkTable.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            selection = linkTable.getSelectedLinkItem();
            final Exception error = selection == null ? null : selection.getError();

            if (error != null) {
                if (selection.getErrorShown() == false) {
                    if (error instanceof MacroTargetNotConfiguredException) {
                        final MacroTargetNotConfiguredException macroEx = (MacroTargetNotConfiguredException) error;
                        MessageDialog.openInformation(getShell(), macroEx.getMessageTitle(),
                                macroEx.getMessageBody());
                    } else {
                        final String messageFormat = Messages
                                .getString("LabelableLinkSelectionDialog.ErrorDialogTextFormat"); //$NON-NLS-1$
                        final String message = MessageFormat.format(messageFormat,
                                selection.getError().getLocalizedMessage());

                        ErrorDialog.openError(getShell(),
                                Messages.getString("LabelableLinkSelectionDialog.ErrorDialogTitle"), //$NON-NLS-1$
                                message, null);
                    }

                    selection.setErrorShown(true);
                }

                getButton(IDialogConstants.OK_ID).setEnabled(false);
                return;
            } else {
                getButton(IDialogConstants.OK_ID).setEnabled(selection != null);
            }
        }
    });
}

From source file:com.motorola.studio.android.common.utilities.EclipseUtils.java

License:Apache License

private static int showInformationDialog(final String dialogTitle, final String dialogMessage,
        final String detailsMessage, final String[] buttonLabels, final int dialogImageType) {
    final int[] returnCode = new int[1];
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
        public void run() {
            Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

            Rectangle parentSize;
            if (shell.getParent() != null) {
                parentSize = shell.getParent().getBounds();
            } else {

                parentSize = shell.getBounds();
            }/*from   w ww.j  av a2s . c  o m*/

            MessageDialog dlg;
            String[] internButtonLabels = buttonLabels;
            if (internButtonLabels == null) {
                internButtonLabels = new String[] { "OK" };
            }

            if (detailsMessage == null) {
                dlg = new MessageDialog(shell, dialogTitle, null, dialogMessage, dialogImageType,
                        internButtonLabels, 0);
            } else {
                dlg = new MessageDialog(shell, dialogTitle, null, dialogMessage, dialogImageType,
                        internButtonLabels, 0) {
                    @Override
                    protected Control createCustomArea(Composite parent) {
                        final Composite main = new Composite(parent, parent.getStyle());
                        GridLayout layout = new GridLayout();
                        main.setLayout(layout);
                        GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
                        main.setLayoutData(data);

                        final Button detailsButton = new Button(main, SWT.PUSH);
                        detailsButton.setText(UtilitiesNLS.UI_EclipseUtils_OpenDetails);
                        data = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
                        detailsButton.setLayoutData(data);
                        detailsButton.addSelectionListener(new SelectionAdapter() {
                            private Label detailsText;

                            @Override
                            public void widgetSelected(SelectionEvent e) {
                                if ((detailsText != null) && !detailsText.isDisposed()) {
                                    detailsButton.setText(UtilitiesNLS.UI_EclipseUtils_OpenDetails);
                                    detailsText.dispose();
                                } else {
                                    detailsButton.setText(UtilitiesNLS.UI_EclipseUtils_CloseDetails);
                                    detailsText = new Label(main, SWT.WRAP | SWT.BORDER);
                                    detailsText.setText(detailsMessage);
                                    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
                                    detailsText.setLayoutData(data);
                                    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING)
                                            .grab(true, false)
                                            .hint(convertHorizontalDLUsToPixels(
                                                    IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
                                            .applyTo(detailsText);
                                }
                                getShell().pack();
                            }
                        });

                        return main;
                    }
                };
            }

            Rectangle dialogSize = shell.getBounds();

            int x = ((parentSize.width - dialogSize.width) / 2) + parentSize.x;
            int y = ((parentSize.height - dialogSize.height) / 2) + parentSize.y;

            shell.setLocation(x, y);

            returnCode[0] = dlg.open();
        }
    });

    return returnCode[0];
}

From source file:com.nokia.tools.s60ct.javaversionchecker.ui.ShowDialogJob.java

License:Open Source License

/**
 * Shows JRE warning dialog./*ww  w.j  a va 2 s  .  co  m*/
 * @return state of toggle
 */
private static boolean showDialog() {
    MessageDialogWithToggle dialog = new MessageDialogWithToggle(
            PlatformUI.getWorkbench().getDisplay().getActiveShell(), MessageGenerator.generateTitle(), null,
            MessageGenerator.generateMessage(), MessageDialog.WARNING,
            new String[] { IDialogConstants.OK_LABEL }, 0, "Do not warn again", false) {
        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);
            }

            Link link = new Link(composite, getMessageLabelStyle());
            link.setText(message);
            link.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    if ("Download JRE".equals(e.text)) {

                        try {
                            IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport()
                                    .getExternalBrowser();
                            browser.openURL(new URL(SupportedJavaVersions.sunJre1_6_0_DownloadSite));
                        } catch (MalformedURLException ex) {
                            ex.printStackTrace();
                        } catch (PartInitException ex) {
                            ex.printStackTrace();
                        }
                    } else {
                        try {
                            IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport()
                                    .getExternalBrowser();
                            browser.openURL(new URL(
                                    "http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/running_eclipse.htm"));
                        } catch (MalformedURLException ex) {
                            ex.printStackTrace();
                        } catch (PartInitException ex) {
                            ex.printStackTrace();
                        }

                    }
                }
            });

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

            return composite;
        }
    };

    dialog.open();
    return dialog.getToggleState();
}

From source file:com.nokia.tools.screen.ui.dialogs.MessageDialogWithCheckBox.java

License:Open Source License

@Override
protected Control createMessageArea(Composite composite) {
    super.createMessageArea(composite);

    if (helpID != null)
        PlatformUI.getWorkbench().getHelpSystem()
                .setHelp(composite.getParent() == null ? composite : composite.getParent(), helpID);

    if (linkMessage != null && linkAddress != null) {
        GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING);
        gd.verticalSpan = 2;// ww w. j av  a  2 s  .  c o m
        imageLabel.setLayoutData(gd);

        lnkMessage = new Link(composite, SWT.WRAP);
        lnkMessage.setText(linkMessage);
        gd = new GridData(
                GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
        gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        gd.verticalIndent = -6;
        lnkMessage.setLayoutData(gd);
        lnkMessage.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
                close();

                PreferenceDialog prefdlg = PreferencesUtil.createPreferenceDialogOn(
                        Display.getCurrent().getActiveShell(), linkAddress, new String[] { linkAddress }, null);
                prefdlg.open();

                if (pendingAction != null) {
                    pendingAction.run();
                }
            }

            public void widgetDefaultSelected(SelectionEvent e) {

            }
        });

    }
    return composite;
}

From source file:com.redhat.ceylon.eclipse.code.preferences.InputDialog.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);//from w w w.j  ava2  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, getInputTextStyle());
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });

    GridLayout gl = new GridLayout(2, false);
    Composite errorDisplay = new Composite(composite, SWT.NONE);
    errorDisplay.setLayout(gl);
    errorDisplay.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));

    errorImage = new Label(errorDisplay, SWT.NONE);
    errorImage.setVisible(false);
    errorImage.setImage(CeylonResources.ERROR);

    errorMessageText = new Text(errorDisplay, 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:com.rohanclan.snippets.core.SnipFileDialog.java

License:Open Source License

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

    // Snippet name text box label
    Label label = new Label(composite, SWT.WRAP);
    label.setText(snippetNameLabel);/*from  ww  w .jav  a 2 s  . c o  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());

    // Snippet name text box
    snippetNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = convertWidthInCharsToPixels(20);
    snippetNameText.setLayoutData(data);
    snippetNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    snippetNameText.setFont(parent.getFont());

    //Snippet key combo text box label
    label = new Label(composite, SWT.WRAP);
    label.setText(snippetKeyComboLabel);
    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());

    // Snippet key combo text box
    snippetKeyComboText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = convertWidthInCharsToPixels(20);
    snippetKeyComboText.setLayoutData(data);
    snippetKeyComboText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    snippetKeyComboText.setFont(parent.getFont());

    //Snippet description text box label
    label = new Label(composite, SWT.WRAP);
    label.setText(snippetDescriptionLabel);
    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());

    // Snippet description text box
    snippetDescriptionText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.WRAP);
    snippetDescriptionText
            .setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    snippetDescriptionText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    snippetDescriptionText.setFont(parent.getFont());

    //Snippet start block label
    label = new Label(composite, SWT.WRAP);
    label.setText(snippetCodeStartLabel);
    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());

    // Snippet start block text
    snippetStartText = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL
            | GridData.VERTICAL_ALIGN_FILL);
    data.heightHint = convertHeightInCharsToPixels(6);
    snippetStartText.setLayoutData(data);
    snippetStartText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    snippetStartText.setFont(parent.getFont());

    //Snippet end block label
    label = new Label(composite, SWT.WRAP);
    label.setText(snippetCodeEndLabel);
    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());

    //Snippet end block text
    snippetEndText = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL
            | GridData.VERTICAL_ALIGN_FILL);
    data.heightHint = convertHeightInCharsToPixels(6);
    snippetEndText.setLayoutData(data);
    snippetEndText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    snippetEndText.setFont(parent.getFont());

    errorMessageLabel = new Label(composite, SWT.WRAP);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.VERTICAL_ALIGN_CENTER);
    data.heightHint = convertHeightInCharsToPixels(2);
    errorMessageLabel.setLayoutData(data);
    errorMessageLabel.setFont(parent.getFont());
    Color color = new Color(Display.getCurrent(), 255, 0, 0);
    errorMessageLabel.setForeground(color);

    return composite;
}

From source file:com.runwaysdk.manager.widgets.ProgressMonitorDialog.java

License:Open Source License

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

    taskLabel = new Label(composite, SWT.WRAP);
    taskLabel.setText(DEFAULT_TASKNAME);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .applyTo(taskLabel);/*from  w w w. ja v a 2 s .  com*/

    // progress indicator
    GridData gd = new GridData();
    gd.heightHint = convertVerticalDLUsToPixels(BAR_DLUS);
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;

    progressIndicator = new ProgressIndicator(composite);
    progressIndicator.setLayoutData(gd);

    // label showing current task
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = convertVerticalDLUsToPixels(LABEL_DLUS);
    gd.horizontalSpan = 2;

    subTaskLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
    subTaskLabel.setLayoutData(gd);
    subTaskLabel.setFont(parent.getFont());

    composite.layout(true);

    return composite;
}

From source file:com.sap.netweaver.porta.ide.eclipse.server.ui.dialogs.NoWSGateDialog.java

License:Open Source License

private Label createLabel(Composite parent, String text) {
    Label label = new Label(parent, getMessageLabelStyle());
    label.setText(text);//from   www.j  av a 2  s .  c o  m
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .applyTo(label);
    return label;
}