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.cdt.launch.remote.tabs.RemoteCDSFMainTab.java

License:Open Source License

protected void handleRemoteConnectionPropertiesSelected() {
    class RemoteConnectionPropertyDialog extends Dialog {
        private IHost fHost;
        boolean fbLocalHost;
        private Button fSkipDownloadBtn;
        private Text fWSRoot;

        public RemoteConnectionPropertyDialog(Shell parentShell, String dialogTitle, IHost host) {
            super(parentShell);
            parentShell.setText(dialogTitle);
            fHost = host;/*from w ww.j  a  v  a  2 s.c o m*/
            fbLocalHost = fHost.getSystemType().isLocal();
        }

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

            Label label = new Label(composite, SWT.WRAP);
            label.setText(Messages.RemoteCMainTab_Properties_Location);
            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());
            fWSRoot = new Text(composite, SWT.SINGLE | SWT.BORDER);
            fWSRoot.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));

            fSkipDownloadBtn = new Button(composite, SWT.CHECK);
            fSkipDownloadBtn.setText(Messages.RemoteCMainTab_Properties_Skip_default);
            if (!fbLocalHost) {
                IPropertySet propertySet = fHost.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
                if (propertySet != null) {
                    String value = propertySet.getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
                    if (value != null) {
                        fWSRoot.setText(value);
                    }
                    fSkipDownloadBtn.setSelection(Boolean
                            .valueOf(propertySet
                                    .getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
                            .booleanValue());
                }
            } else {
                fSkipDownloadBtn.setEnabled(false);
                fWSRoot.setEnabled(false);
            }
            applyDialogFont(composite);
            return composite;
        }

        @Override
        protected void buttonPressed(int buttonId) {
            if (!fbLocalHost && (buttonId == IDialogConstants.OK_ID)) {
                IPropertySet propertySet = fHost.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
                if (propertySet == null) {
                    propertySet = fHost.createPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
                }
                propertySet.addProperty(IRemoteConnectionHostConstants.REMOTE_WS_ROOT, fWSRoot.getText());
                propertySet.addProperty(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD,
                        Boolean.toString(fSkipDownloadBtn.getSelection()));
                fHost.commit();
            }
            super.buttonPressed(buttonId);
        }
    }
    IHost currentConnectionSelected = getCurrentConnection();
    RemoteConnectionPropertyDialog dlg = new RemoteConnectionPropertyDialog(getControl().getShell(),
            Messages.RemoteCMainTab_Properties_title, currentConnectionSelected);
    dlg.setBlockOnOpen(true);
    dlg.open();
}

From source file:org.eclipse.cdt.ui.dialogs.InputStatusDialog.java

License:Open Source License

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

    Label label = new Label(composite, SWT.WRAP);
    label.setText(message);/*from  w  ww  .ja  va  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());

    text = new Text(composite, getInputTextStyle());
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    text.setFocus();
    if (value != null) {
        text.setText(value);
        text.selectAll();
    }

    applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.common_prefs.preferences.PrefFileDialog.java

License:Open Source License

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   w w  w  . jav 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.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            setErrorMessage(null);
        }
    });

    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));
    setErrorMessage(errorMessage);

    // create a Validate checkbox to allow non accessible resource input
    // for example when adding a http address which isn't accessible
    validateButton = new Button(composite, SWT.CHECK);
    validateButton.setText("Validate that the resource exist.");
    validateButton.setSelection(true);
    GridData gdlb = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
    validateButton.setLayoutData(gdlb);
    validateButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            // When changing state of the validate button, also
            // allow user to click OK again.
            Control button = getButton(IDialogConstants.OK_ID);
            if (button != null) {
                button.setEnabled(true);
            }
        }
    });

    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneMaxLengthDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Label label = new Label(composite, SWT.WRAP);
    label.setText(MessagesForDetailPane.PaneMaxLengthDialog_MaxCharactersToDisplay);
    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);//from w  w  w.  j  a v  a2s.c om
    label.setFont(parent.getFont());
    fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    fTextWidget.setText(fValue);
    fTextWidget.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
            fValue = fTextWidget.getText();
        }
    });
    fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
    fErrorTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    fErrorTextWidget.setBackground(fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    setErrorMessage(fErrorMessage);
    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.debug.internal.ui.actions.variables.ChangeVariableValueInputDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Font font = parent.getFont();
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);

    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);//from www.  j  a va2s.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(font);
    }

    text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);

    GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    gridData.heightHint = 50;
    gridData.widthHint = 100;
    text.setLayoutData(gridData);
    text.setFont(font);
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (okButton.isEnabled()) {
                return;
            }
            errorMessageLabel.setText(IInternalDebugCoreConstants.EMPTY_STRING);
            errorMessageLabel.getParent().update();
            okButton.setEnabled(true);
        }
    });

    errorMessageLabel = new Label(composite, SWT.NONE);
    errorMessageLabel.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageLabel.setFont(font);
    return composite;
}

From source file:org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneMaxLengthDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Label label = new Label(composite, SWT.WRAP);
    label.setText(VariablesViewMessages.DetailPaneMaxLengthDialog_1);
    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);/* w  ww  .  j  a  v a  2 s .com*/
    label.setFont(parent.getFont());
    fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    fTextWidget.setText(fValue);
    fTextWidget.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
            fValue = fTextWidget.getText();
        }
    });
    fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
    fErrorTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    fErrorTextWidget.setBackground(fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    setErrorMessage(fErrorMessage);
    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.debug.internal.ui.stringsubstitution.PasswordPrompt.java

License:Open Source License

public void prompt() {
    Dialog dialog = new Dialog((Shell) null) {
        private Text text;

        /* (non-Javadoc)
         * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
         *//*w ww.ja v a2 s .c om*/
        protected Control createDialogArea(Composite parent) {
            // create composite
            Composite composite = (Composite) super.createDialogArea(parent);
            // create message
            if (dialogMessage != null) {
                Label label = new Label(composite, SWT.WRAP);
                label.setText(dialogMessage);
                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 | SWT.PASSWORD);
            text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
            String value = defaultValue == null ? lastValue : defaultValue;
            if (value != null) {
                text.setText(value);
            }
            applyDialogFont(composite);
            return composite;
        }

        /* (non-Javadoc)
         * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
         */
        protected void buttonPressed(int buttonId) {
            if (buttonId == IDialogConstants.OK_ID) {
                returnValue = text.getText();
            } else {
                returnValue = null;
            }
            super.buttonPressed(buttonId);
        }

        /* (non-Javadoc)
         * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
         */
        protected void configureShell(Shell newShell) {
            super.configureShell(newShell);
            newShell.setText(StringSubstitutionMessages.StringPromptExpander_0);
        }

    };

    int dialogResult = dialog.open();
    if (dialogResult == Window.OK) {
        dialogResultString = returnValue;
    }
}

From source file:org.eclipse.ecf.discovery.ui.userinput.handler.InputDialogWithComboHistory.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  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());
    }
    combo = new Combo(composite, SWT.SINGLE | SWT.BORDER);
    combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    combo.addModifyListener(new ModifyListener() {
        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:org.eclipse.ecf.internal.filetransfer.ui.StartFileDownloadDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Label label = new Label(composite, SWT.WRAP);
    label.setText(Messages.getString("StartFileDownloadDialog.OutputFile")); //$NON-NLS-1$
    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);//  w  w  w.  j  a  va2s  . c  o m
    label.setFont(parent.getFont());

    fileLocation = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fileLocation.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    fileLocation.setText(filePath);
    fileLocation.setSelection(fileLocation.getText().length());

    Text text = getInputText();
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateURL();
        }
    });

    text.addFocusListener(new FocusListener() {
        public void focusGained(FocusEvent e) {
            // nothing
        }

        public void focusLost(FocusEvent e) {
            fileLocation.setText(getFullDownloadPath(getCurrentDirectory(), getFileNameFromURL()));
            fileLocation.setSelection(fileLocation.getText().length());
        }
    });

    final Button fileBrowse = new Button(composite, SWT.PUSH);
    fileBrowse.setText(Messages.getString("StartFileDownloadDialog.Browse")); //$NON-NLS-1$
    fileBrowse.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            if (event.type == SWT.Selection) {
                String fileName = getFileNameFromURL();
                FileDialog fd = new FileDialog(fileBrowse.getShell(), SWT.SAVE);
                fd.setText(Messages.getString("StartFileDownloadDialog.OutputFile")); //$NON-NLS-1$
                fd.setFileName(fileName);
                fd.setFilterPath(getCurrentDirectory());
                String fname = fd.open();
                if (fname != null) {
                    fileLocation.setText(fname);
                    fileLocation.setSelection(fileLocation.getText().length());
                }
            }
        }
    });

    label = new Label(composite, SWT.WRAP);
    label.setText(Messages.getString("StartFileDownloadDialog.Userid")); //$NON-NLS-1$
    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());
    useridText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    useridText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    useridText.setText(System.getProperty("user.name")); //$NON-NLS-1$
    useridText.setSelection(useridText.getText().length());

    label = new Label(composite, SWT.WRAP);
    label.setText(Messages.getString("StartFileDownloadDialog.Password")); //$NON-NLS-1$
    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());
    passwordText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    passwordText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.edt.ide.ui.preferences.CompilerPropertyAndPreferencePage.java

License:Open Source License

protected void promptForNewCompiler(String errorCompilerId) {
    String message = MessageFormat.format(UINlsStrings.CompilerPreferencePage_compilerNoLongerAvailable,
            new Object[] { errorCompilerId });
    MessageDialog dialog = new MessageDialog(getShell(),
            UINlsStrings.CompilerPreferencePage_compilerNoLongerAvailable_title, null, message,
            MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 2) {
        protected int getMinimumMessageWidth() {
            return convertHorizontalDLUsToPixels((int) (IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH * 1.5));
        }//from w ww. j a  v  a2 s .co m

        protected Control createCustomArea(Composite parent) {
            Composite composite = new Composite(parent, SWT.NONE);
            GridLayout layout = new GridLayout();
            composite.setLayout(layout);
            GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false);
            gridData.widthHint = this.getMinimumMessageWidth();
            composite.setLayoutData(gridData);
            return composite;
        }
    };
    int res = dialog.open();
    if (res == IDialogConstants.CANCEL_ID) { // cancel pressed
        latestStatus.setWarning(MessageFormat.format(UINlsStrings.CompilerPreferencePage_cannotDisplayCompiler,
                new Object[] { errorCompilerId }));
        statusChangeListener.statusChanged(latestStatus);
    }
}