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.papyrus.infra.table.common.dialog.TwoInputDialog.java

License:Open Source License

/**
 * Create the second Text Area/*from   w  ww .  ja va  2s . co  m*/
 * 
 * @see org.eclipse.jface.dialogs.InputDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 * 
 * @param parent
 * @return
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    if (message_2 != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message_2);
        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_2 = new Text(composite, getInputTextStyle());
    text_2.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.pde.api.tools.ui.internal.actions.ExportDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    Composite comp = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;/* ww  w  . j  av  a2  s.co m*/
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    // create message
    if (message != null) {
        Label label = new Label(comp, SWT.WRAP);
        label.setText(message);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.horizontalSpan = 2;
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    text = new Text(comp, getInputTextStyle());
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Button browseButton = SWTFactory.createPushButton(comp, ActionMessages.Browse, null, SWT.RIGHT);
    GridData data = new GridData(SWT.LEFT, SWT.CENTER, false, false);
    browseButton.setLayoutData(data);

    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(getShell());
            dialog.setText(ActionMessages.SelectFileName);
            String loctext = ExportDialog.this.getValue().trim();
            if (loctext.length() > 0) {
                File file = new File(loctext).getParentFile();
                if (file != null && file.exists()) {
                    dialog.setFilterPath(file.getAbsolutePath());
                }
            }
            String newPath = dialog.open();
            if (newPath != null) {
                ExportDialog.this.getText().setText(newPath);
            }
        }
    });
    errorMessageText = new Text(comp, SWT.READ_ONLY | SWT.WRAP);
    GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    layoutData.horizontalSpan = 2;
    errorMessageText.setLayoutData(layoutData);
    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(comp);
    initialize();
    PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IApiToolsHelpContextIds.API_COMPARE_EXPORT_DIALOG);
    return parent;
}

From source file:org.eclipse.php.composer.ui.dialogs.ComposerJobFailureDialog.java

License:Open Source License

protected Control createMessageArea(Composite composite) {
    // create composite
    // create image
    Image image = getImage();/*from   ww w. j a v a  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) {
        messageLabel = new Label(composite, getMessageLabelStyle());
        messageLabel.setText(Messages.ComposerJobFailureDialog_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.php.internal.debug.ui.breakpoint.property.PHPBreakpointPropertyPage.java

License:Open Source License

protected Control createContents(Composite parent) {
    breakpoint = (PHPConditionalBreakpoint) getElement().getAdapter(PHPConditionalBreakpoint.class);
    if (breakpoint == null) {
        Logger.log(Logger.ERROR, "Could not adapt to PHPConditionalBreakpoint"); //$NON-NLS-1$
        return null;
    }//from  ww  w  .ja  v a  2s.  co m
    conditionEnabled = breakpoint.isConditionEnabled();
    String currentCondition = breakpoint.getCondition();
    if (currentCondition.equals("")) { //$NON-NLS-1$
        conditionEnabled = true;
    }
    Label label = new Label(parent, SWT.WRAP);
    label.setText(MessageFormat.format(PHPDebugUIMessages.EnterCondition_1, new Object[] {}));
    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());
    text = new Text(parent, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.setText(currentCondition);
    final Button checkbox = new Button(parent, SWT.CHECK);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    checkbox.setLayoutData(data);
    checkbox.setFont(parent.getFont());
    checkbox.setText(MessageFormat.format(PHPDebugUIMessages.EnableSetCondition_1, new Object[] {}));
    checkbox.setSelection(conditionEnabled);
    text.setEnabled(conditionEnabled);

    checkbox.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            conditionEnabled = checkbox.getSelection();
            text.setEnabled(conditionEnabled);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }

    });
    // HELP - waiting for keren
    // PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
    // IStudioHelpContextIds.???);
    return parent;
}

From source file:org.eclipse.php.ui.util.LinkMessageDialog.java

License:Open Source License

protected Control createMessageArea(Composite composite) {
    // Create image
    Image image = getImage();/*from ww  w.  j a v a 2s.c o  m*/
    if (image != null) {
        imageLabel = new Label(composite, SWT.NULL);
        image.setBackground(imageLabel.getBackground());
        imageLabel.setImage(image);
        imageLabel.setLayoutData(
                new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
    }
    // Create message with link
    if (message != null) {
        Link messageLabel = new Link(composite, getMessageLabelStyle());
        messageLabel.setFont(composite.getFont());
        messageLabel.setText(dialogMessage);
        messageLabel.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                linkActivated();
            }
        });
        GridData data = new GridData(
                GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(data);
    }
    return composite;
}

From source file:org.eclipse.ptp.debug.internal.ui.propertypages.SignalPropertyPage.java

License:Open Source License

protected Control createContents(Composite parent) {
    noDefaultAndApplyButton();/*from   ww w . j  a  v a  2s  . c o m*/
    Composite composite = new Composite(parent, SWT.NONE);
    Font font = parent.getFont();
    composite.setFont(font);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Create description field
    try {
        String description = getSignal().getDescription();
        Label label = new Label(composite, SWT.WRAP);
        label.setText(NLS.bind(Messages.SignalPropertyPage_0, new Object[] { description }));
        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(font);
    } catch (DebugException e1) {
    }

    // Create pass button
    try {
        boolean pass = getSignal().isPassEnabled();
        fPassButton = new SelectionButtonDialogField(SWT.CHECK);
        fPassButton.setLabelText(Messages.SignalPropertyPage_1);
        fPassButton.setSelection(pass);
        fPassButton.setEnabled(getSignal().canModify());
        fPassButton.doFillIntoGrid(composite, 1);
    } catch (DebugException e) {
    }

    // Create stop button
    try {
        boolean stop = getSignal().isStopEnabled();
        fStopButton = new SelectionButtonDialogField(SWT.CHECK);
        fStopButton.setLabelText(Messages.SignalPropertyPage_2);
        fStopButton.setSelection(stop);
        fStopButton.setEnabled(getSignal().canModify());
        fStopButton.doFillIntoGrid(composite, 1);
    } catch (DebugException e) {
    }

    setValid(true);
    return composite;
}

From source file:org.eclipse.ptp.internal.debug.ui.propertypages.SignalPropertyPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    noDefaultAndApplyButton();//  w  w w  . j  a va2s  .com
    Composite composite = new Composite(parent, SWT.NONE);
    Font font = parent.getFont();
    composite.setFont(font);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Create description field
    try {
        String description = getSignal().getDescription();
        Label label = new Label(composite, SWT.WRAP);
        label.setText(NLS.bind(Messages.SignalPropertyPage_0, new Object[] { description }));
        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(font);
    } catch (DebugException e1) {
    }

    // Create pass button
    try {
        boolean pass = getSignal().isPassEnabled();
        fPassButton = new SelectionButtonDialogField(SWT.CHECK);
        fPassButton.setLabelText(Messages.SignalPropertyPage_1);
        fPassButton.setSelection(pass);
        fPassButton.setEnabled(getSignal().canModify());
        fPassButton.doFillIntoGrid(composite, 1);
    } catch (DebugException e) {
    }

    // Create stop button
    try {
        boolean stop = getSignal().isStopEnabled();
        fStopButton = new SelectionButtonDialogField(SWT.CHECK);
        fStopButton.setLabelText(Messages.SignalPropertyPage_2);
        fStopButton.setSelection(stop);
        fStopButton.setEnabled(getSignal().canModify());
        fStopButton.doFillIntoGrid(composite, 1);
    } catch (DebugException e) {
    }

    setValid(true);
    return composite;
}

From source file:org.eclipse.rcptt.ui.dialogs.LinkMessageDialogWithToggle.java

License:Open Source License

@Override
protected Control createMessageArea(Composite composite) {
    super.createMessageArea(composite);
    Link link = new Link(composite, SWT.NONE);
    link.setText(linkMessage);/* ww  w.j  av a  2 s.c  om*/
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .applyTo(link);
    link.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            Program.launch(LinkMessageDialogWithToggle.this.link);
        }
    });
    return composite;
}

From source file:org.eclipse.rcptt.ui.refactoring.delete.DeleteQ7ElementInputPage.java

License:Open Source License

private void createLabel(Composite parent, String text) {
    Label label = new Label(parent, SWT.WRAP);
    label.setFont(parent.getFont());/*w  w w .j a  v  a2s . c  o  m*/
    label.setText(text);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(gridData);
}

From source file:org.eclipse.recommenders.internal.news.rcp.LinkEditor.java

License:Open Source License

@Override
protected void doFillIntoGrid(final Composite parent, int numColumns) {
    Link notificationsLink = new Link(parent, SWT.NONE | SWT.WRAP);
    notificationsLink.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).align(SWT.FILL, SWT.BEGINNING)
            .grab(true, false).hint(super.convertHorizontalDLUsToPixels(notificationsLink,
                    IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .create());/*  w  ww  . j a  v a  2  s .  c o m*/
    notificationsLink.setText(getPreferenceName());
    notificationsLink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            PreferencesUtil.createPreferenceDialogOn(parent.getShell(), getLabelText(), null, null);
        }
    });
}