Example usage for org.eclipse.jface.dialogs Dialog DIALOG_DEFAULT_BOUNDS

List of usage examples for org.eclipse.jface.dialogs Dialog DIALOG_DEFAULT_BOUNDS

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog DIALOG_DEFAULT_BOUNDS.

Prototype

int DIALOG_DEFAULT_BOUNDS

To view the source code for org.eclipse.jface.dialogs Dialog DIALOG_DEFAULT_BOUNDS.

Click Source Link

Document

A value that can be used for stored dialog width or height that indicates that the default bounds should be used.

Usage

From source file:com.technophobia.substeps.junit.ui.viewhistory.ImportTestRunSessionFromURLAction.java

License:Open Source License

@Override
public void run() {
    final String title = SubstepsFeatureMessages.SubstepsFeatureTestRunnerViewPart_ImportTestRunSessionAction_title;
    final String message = SubstepsFeatureMessages.SubstepsFeatureTestRunnerViewPart_ImportTestRunSessionFromURLAction_url;

    final IDialogSettings dialogSettings = FeatureRunnerPlugin.instance().getDialogSettings();
    String url = dialogSettings.get(ImportTestRunSessionAction.PREF_LAST_PATH);

    final IInputValidator validator = new URLValidator();

    final InputDialog inputDialog = new InputDialog(fShell, title, message, url, validator) {
        @Override/*from   w w  w  .j a va 2 s  . co m*/
        protected Control createDialogArea(final Composite parent) {
            final Control dialogArea2 = super.createDialogArea(parent);
            final Object layoutData = getText().getLayoutData();
            if (layoutData instanceof GridData) {
                final GridData gd = (GridData) layoutData;
                gd.widthHint = convertWidthInCharsToPixels(150);
            }
            return dialogArea2;
        }

        @Override
        protected IDialogSettings getDialogBoundsSettings() {
            IDialogSettings settings = dialogSettings.getSection(DIALOG_SETTINGS);
            if (settings == null) {
                settings = dialogSettings.addNewSection(DIALOG_SETTINGS);
            }
            settings.put("DIALOG_HEIGHT", Dialog.DIALOG_DEFAULT_BOUNDS); //$NON-NLS-1$
            return settings;
        }

        @Override
        protected boolean isResizable() {
            return true;
        }
    };

    final int res = inputDialog.open();
    if (res == IDialogConstants.OK_ID) {
        url = inputDialog.getValue();
        dialogSettings.put(ImportTestRunSessionAction.PREF_LAST_PATH, url);
        TestSessionRunImporter.importTestRunSession(url);
    }
}