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.erlide.wrangler.refactoring.duplicatedcode.ui.SimilarCodeDetectionInputDialog.java

License:Open Source License

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

    final Label minLenlabel = new Label(composite, SWT.WRAP);
    minLenlabel.setText("Minimum lenght of an expression sequence:");
    final GridData minLenData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    minLenData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    minLenlabel.setLayoutData(minLenData);
    minLenlabel.setFont(parent.getFont());

    minLenText = new Text(composite, getInputTextStyle());
    minLenText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    minLenText.setText("5");
    minLenText.addModifyListener(new ModifyListener() {
        @Override/*  w  ww .j  a  v a 2  s .  c o  m*/
        public void modifyText(final ModifyEvent e) {
            validateInput();
        }
    });

    final Label minTokslabel = new Label(composite, SWT.WRAP);
    minTokslabel.setText("Minimum number of tokens a clone should have:");
    final GridData minToksData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    minToksData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    minTokslabel.setLayoutData(minToksData);
    minTokslabel.setFont(parent.getFont());

    minToksText = new Text(composite, getInputTextStyle());
    minToksText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    minToksText.setText("40");
    minToksText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            validateInput();
        }
    });

    final Label minFreqLabel = new Label(composite, SWT.WRAP);
    minFreqLabel.setText("Minimum number appearance times:");
    final GridData minFreqData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    minFreqData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    minFreqLabel.setLayoutData(minFreqData);
    minFreqLabel.setFont(parent.getFont());

    minFreqText = new Text(composite, getInputTextStyle());
    minFreqText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    minFreqText.setText("2");
    minFreqText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            validateInput();
        }
    });

    final Label maxNewVarsLabel = new Label(composite, SWT.WRAP);
    maxNewVarsLabel.setText("Maximum number of new parameters of the least-general abstraction:");
    final GridData maxNewVarsData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    maxNewVarsData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    maxNewVarsLabel.setLayoutData(maxNewVarsData);
    maxNewVarsLabel.setFont(parent.getFont());

    maxNewVarsText = new Text(composite, getInputTextStyle());
    maxNewVarsText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    maxNewVarsText.setText("4");
    maxNewVarsText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            validateInput();
        }
    });

    final Label simScoreLabel = new Label(composite, SWT.WRAP);
    simScoreLabel.setText("Similarity score (between 0.1 and 1.0):");
    final GridData simScoreData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    simScoreData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    simScoreLabel.setLayoutData(simScoreData);
    simScoreLabel.setFont(parent.getFont());

    simScoreText = new Text(composite, getInputTextStyle());
    simScoreText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    simScoreText.setText("0.8");
    simScoreText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            validateInput();
        }

    });

    onlyInFileCheckBoxButton = new Button(composite, SWT.CHECK);
    onlyInFileCheckBoxButton.setText("Detect similar code snippets in the project");

    onlyInFileCheckBoxButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
    onlyInFileCheckBoxButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            validateInput();

        }

        @Override
        public void widgetDefaultSelected(final SelectionEvent 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));

    setErrorMessage("");

    applyDialogFont(composite);
    validateInput();
    return composite;
}

From source file:org.erlide.wrangler.refactoring.duplicatedcode.ui.SimilarSearchInputDialog.java

License:Open Source License

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

    final Label simScoreLabel = new Label(composite, SWT.WRAP);
    simScoreLabel.setText("Similarity score (between 0.1 and 1.0):");
    final GridData simScoreData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    simScoreData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    simScoreLabel.setLayoutData(simScoreData);
    simScoreLabel.setFont(parent.getFont());

    simScoreText = new Text(composite, getInputTextStyle());
    simScoreText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    simScoreText.setText("0.8");
    simScoreText.addModifyListener(new ModifyListener() {

        @Override//from w ww . j a v  a  2  s .c om
        public void modifyText(final ModifyEvent e) {
            validateInput();
        }

    });

    onlyInFileCheckBoxButton = new Button(composite, SWT.CHECK);
    onlyInFileCheckBoxButton.setText("Detect similar code snippets in the project");

    onlyInFileCheckBoxButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
    onlyInFileCheckBoxButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            validateInput();

        }

        @Override
        public void widgetDefaultSelected(final SelectionEvent 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));

    setErrorMessage("");

    applyDialogFont(composite);
    validateInput();
    return composite;
}

From source file:org.erlide.wrangler.refactoring.ui.NewParameterNameInputDialog.java

License:Open Source License

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

    final Label newParameterNameLabel = new Label(composite, SWT.WRAP);
    newParameterNameLabel.setText("New parameter name:");
    final GridData minToksData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    minToksData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    newParameterNameLabel.setLayoutData(minToksData);
    newParameterNameLabel.setFont(parent.getFont());

    newParameterName = new Text(composite, getInputTextStyle());
    newParameterName.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    newParameterName.addModifyListener(new ModifyListener() {
        @Override//from  ww  w .  j a va 2s  . c  o m
        public void modifyText(final ModifyEvent e) {
            data = newParameterName.getText();
            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));

    setErrorMessage("New parameter name must be a valid variable name!");
    newParameterName.setText("");

    return composite;

}

From source file:org.erlide.wrangler.refactoring.ui.RemoteFunctionClauseDialog.java

License:Open Source License

@Override
protected Control createDialogArea(final Composite parent) {

    final Composite composite = (Composite) super.createDialogArea(parent);
    final Tree functionClausesTree;

    final Label label = new Label(composite, SWT.WRAP);
    label.setText("Please select the function clause which against should fold!");
    final GridData minToksData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    minToksData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(minToksData);//from  ww  w  .  j a  v  a  2 s.  c om
    label.setFont(parent.getFont());

    functionClausesTree = new Tree(composite, SWT.BORDER);
    final GridData treeData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    treeData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    functionClausesTree.setLayoutData(treeData);

    try {
        final Collection<IErlModule> erlmodules = GlobalParameters.getWranglerSelection().getErlElement()
                .getProject().getModules();

        for (final IErlModule m : erlmodules) {
            // must refresh the scanner!
            if (/* !m.isStructureKnown() */true) {
                // FIXME: not permitted operation
                m.open(null);
            }

            final TreeItem moduleName = new TreeItem(functionClausesTree, 0);
            moduleName.setText(m.getModuleName());
            moduleName.setData(m);
            final List<IErlFunction> functions = filterFunctions(m.getChildren());
            for (final IErlFunction f : functions) {
                final TreeItem functionName = new TreeItem(moduleName, 0);
                functionName.setText(f.getNameWithArity());
                final List<IErlFunctionClause> clauses = filterClauses(f.getChildren());
                functionName.setData(f);
                for (final IErlFunctionClause c : clauses) {
                    final TreeItem clauseName = new TreeItem(functionName, 0);
                    clauseName.setText(String.valueOf(c.getName()));
                    clauseName.setData(c);
                }
            }
        }

        // listen to treeitem selection
        functionClausesTree.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetDefaultSelected(final SelectionEvent e) {
            }

            // if a function or a function clause is selected, then
            // highlight it
            // and store the selection
            @Override
            public void widgetSelected(final SelectionEvent e) {

                final TreeItem[] selectedItems = functionClausesTree.getSelection();

                if (selectedItems.length > 0) {
                    final TreeItem treeItem = selectedItems[0];
                    final Object data = treeItem.getData();
                    if (data instanceof IErlFunctionClause) {
                        // enable the ok button
                        okButton.setEnabled(true);

                        // highlight
                        WranglerUtils.highlightSelection((IErlFunctionClause) data);

                        // store
                        functionClause = (IErlFunctionClause) data;
                    } else {
                        okButton.setEnabled(false);
                    }
                }

            }

        });
    } catch (final ErlModelException e) {
        e.printStackTrace();
    }

    applyDialogFont(composite);
    return composite;
}

From source file:org.fusesource.ide.launcher.ui.debug.editors.BooleanVariableEditor.java

License:Open Source License

@Override
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);/* w w w . j av a 2  s  . c  o  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);
    }

    combo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
    combo.add(Boolean.TRUE.toString());
    combo.add(Boolean.FALSE.toString());

    GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    gridData.heightHint = 12;
    gridData.widthHint = 30;
    combo.setLayoutData(gridData);
    combo.setFont(font);
    combo.addSelectionListener(new SelectionAdapter() {

        /*
         * (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            if (okButton.isEnabled()) {
                return;
            }
            okButton.setEnabled(true);
        }
    });

    return composite;
}

From source file:org.hibernate.eclipse.jdt.ui.internal.jpa.process.wizard.EntitiesList.java

License:Open Source License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);/*from  w ww .  ja  v  a 2 s . c  om*/
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 1;
    //Label label = new Label(container, SWT.NULL);
    //label.setText(JdtUiMessages.AllEntitiesProcessor_message);

    listViewer = new TableViewer(container, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    //listViewer.setComparator(getViewerComparator());
    Control control = listViewer.getControl();
    GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
    gridData.heightHint = convertHeightInCharsToPixels(10);
    control.setLayoutData(gridData);
    String[] columnProperties = new String[] { Columns.CLASS.toString(), Columns.PROJECT.toString(), };
    listViewer.setColumnProperties(columnProperties);
    listViewer.setContentProvider(createContentProvider(data));
    listViewer.setLabelProvider(new TableLableProvider(listViewer));
    createTableColumns(listViewer.getTable());
    listViewer.setInput(data.getEntities());
    listViewer.getTable().setHeaderVisible(true);
    listViewer.getTable().setLinesVisible(true);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
                    convertHorizontalDLUsToPixels(2 * IDialogConstants.BUTTON_BAR_HEIGHT))
            .applyTo(listViewer.getControl());
    //Button generateChoice = new Button(container, SWT.CHECK);
    //generateChoice.setText("fdwsdfv");
    Composite combolabel = new Composite(container, SWT.NULL);
    layout = new GridLayout();
    combolabel.setLayout(layout);
    layout.numColumns = 2;
    Label labelChoice = new Label(combolabel, SWT.NULL);
    labelChoice.setText(JdtUiMessages.AllEntitiesProcessor_preferred_location_annotations);
    Combo generateChoice = new Combo(combolabel, SWT.READ_ONLY);
    generateChoice.add(JdtUiMessages.AllEntitiesProcessor_fields);
    generateChoice.add(JdtUiMessages.AllEntitiesProcessor_getters);
    generateChoice.add(JdtUiMessages.AllEntitiesProcessor_auto_select_from_class_preference);
    int idx = 0;
    if (params.getAnnotationStyle().equals(AnnotStyle.FIELDS)) {
        idx = 0;
    } else if (params.getAnnotationStyle().equals(AnnotStyle.GETTERS)) {
        idx = 1;
    } else if (params.getAnnotationStyle().equals(AnnotStyle.AUTO)) {
        idx = 2;
    }
    generateChoice.select(idx);
    final ModifyListener mlGenerateChoice = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            int idx = ((Combo) e.getSource()).getSelectionIndex();
            if (idx == 0 && !params.getAnnotationStyle().equals(AnnotStyle.FIELDS)) {
                params.setAnnotationStyle(AnnotStyle.FIELDS);
                params.reCollectModification(data.getEntities());
            } else if (idx == 1 && !params.getAnnotationStyle().equals(AnnotStyle.GETTERS)) {
                params.setAnnotationStyle(AnnotStyle.GETTERS);
                params.reCollectModification(data.getEntities());
            } else if (idx == 2 && !params.getAnnotationStyle().equals(AnnotStyle.AUTO)) {
                params.setAnnotationStyle(params.getAnnotationStylePreference());
                params.reCollectModification(data.getEntities());
                params.setAnnotationStyle(AnnotStyle.AUTO);
            }
        }

    };
    generateChoice.addModifyListener(mlGenerateChoice);

    Label labelDefaultStrLength = new Label(combolabel, SWT.NULL);
    labelDefaultStrLength.setText(JdtUiMessages.AllEntitiesProcessor_default_string_length);
    Text textDefaultStrLength = new Text(combolabel, SWT.SINGLE | SWT.BORDER | SWT.TRAIL);
    textDefaultStrLength.setText(String.valueOf(params.getDefaultStrLength()));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(textDefaultStrLength);
    textDefaultStrLength.addListener(SWT.Verify, new Listener() {
        public void handleEvent(Event e) {
            for (int i = 0; i < e.text.length(); i++) {
                char val = e.text.charAt(i);
                if (!('0' <= val && val <= '9')) {
                    e.doit = false;
                    return;
                }
            }
        }
    });
    final ModifyListener mlDefaultStrLength = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (e == null || !(e.getSource() instanceof Text)) {
                return;
            }
            String str = ((Text) e.getSource()).getText();
            Integer val = IHibernateJPAWizardParams.columnLength;
            if (str != null && str.length() > 0) {
                val = Integer.valueOf(str);
            }
            params.setDefaultStrLength(val);
            params.reCollectModification(data.getEntities());
        }

    };
    textDefaultStrLength.addModifyListener(mlDefaultStrLength);

    // enable optimistic locking functionality
    Label labelOptLock = new Label(combolabel, SWT.NULL);
    labelOptLock.setText(JdtUiMessages.AllEntitiesProcessor_enable_optimistic_locking);
    Button checkboxOptLock = new Button(combolabel, SWT.CHECK);
    checkboxOptLock.setSelection(params.getEnableOptLock());
    final Listener mlOptLock = new Listener() {

        public void handleEvent(Event e) {
            params.setEnableOptLock(((Button) e.widget).getSelection());
            params.reCollectModification(data.getEntities());
        }

    };
    checkboxOptLock.addListener(SWT.Selection, mlOptLock);

    setControl(container);
}

From source file:org.jboss.tools.usage.internal.reporting.UsageReportEnablementDialog.java

License:Open Source License

private void createUsageReportingWidgets(Composite parent, Composite composite) {
    // message//from  w ww  . ja v  a2 s  .c om
    Link link = new Link(composite, SWT.WRAP);
    link.setFont(parent.getFont());

    link.setText(branding.getStartupAllowReportingMessage());
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            BrowserUtil.checkedCreateExternalBrowser(branding.getStartupAllowReportingDetailLink(),
                    JBossToolsUsageActivator.PLUGIN_ID, JBossToolsUsageActivator.getDefault().getLog());
        }
    });
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
            .hint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH, SWT.DEFAULT).applyTo(link);
}

From source file:org.jboss.tools.vpe.preview.editor.EngineDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite composite) {
    // create composite
    // create image
    Image image = getImage();//from   w  ww .j  a  v a2  s . c  om
    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) {
        link = new Link(composite, getMessageLabelStyle());
        link.setText(message);
        link.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                PreferencesUtil.createPreferenceDialogOn(null, PREFS_ID, new String[] { PREFS_ID }, null)
                        .open();
            }
        });

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

    return composite;
}

From source file:org.obeonetwork.dsl.dart.usage.internal.dialog.UsageDialog.java

License:Open Source License

/**
 * {@inheritDoc}/*from w w  w .  ja va2s  . c o m*/
 * 
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Link link = new Link(composite, SWT.NONE);
    String message = UsageDialogMessages.Usage_Dialog_Message;
    link.setText(message);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                // Open default external browser
                PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(e.text));
            } catch (PartInitException ex) {
                UsageActivator.log(IStatus.ERROR, UsageMessages.Error_OpeningUsageHyperlink, ex);
            } catch (MalformedURLException ex) {
                UsageActivator.log(IStatus.ERROR, UsageMessages.Error_OpeningUsageHyperlink, ex);
            }
        }
    });
    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:org.obeonetwork.dsl.uml2.usage.dialog.UsageDialog.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 = UsageDialogMessages.Usage_Dialog_Message;
    link.setText(message);//from w w  w. ja v  a  2s .  c o  m
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                // Open default external browser
                PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(e.text));
            } catch (PartInitException ex) {
                UsageActivator.log(IStatus.ERROR, UsageMessages.Error_OpeningUsageHyperlink, ex);
            } catch (MalformedURLException ex) {
                UsageActivator.log(IStatus.ERROR, UsageMessages.Error_OpeningUsageHyperlink, ex);
            }
        }
    });
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
            .hint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH, SWT.DEFAULT).applyTo(link);
    applyDialogFont(composite);

    return composite;
}