Example usage for org.eclipse.jface.layout GridDataFactory generate

List of usage examples for org.eclipse.jface.layout GridDataFactory generate

Introduction

In this page you can find the example usage for org.eclipse.jface.layout GridDataFactory generate.

Prototype

public static void generate(Control theControl, int hSpan, int vSpan) 

Source Link

Document

Generates layout data to the given control, given the number of cells spanned by the control.

Usage

From source file:com.liferay.ide.project.ui.upgrade.animated.InitConfigureProjectPage.java

License:Open Source License

private void createDownloaBundleCheckboxElement() {
    disposeBundleCheckboxElement();/*from   w  w  w  . jav a 2  s.co m*/
    downloadBundleCheckbox = SWTUtil.createCheckButton(pageParent, "Download Liferay bundle (recommended)",
            null, true, 1);
    GridDataFactory.generate(downloadBundleCheckbox, 2, 1);
    downloadBundleCheckbox.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            dataModel.setDownloadBundle(downloadBundleCheckbox.getSelection());

            if (dataModel.getDownloadBundle().content()) {
                disposeImportElement();
                createBundleElement();
                createImportElement();
                pageParent.layout();
            } else {
                disposeBundleElement();
                disposeImportElement();
                createImportElement();
                pageParent.layout();
            }

            startCheckThread();
        }
    });
}

From source file:com.liferay.ide.project.ui.upgrade.animated.Page.java

License:Open Source License

protected Label createLabel(Composite composite, String text) {
    Label label = new Label(composite, SWT.NONE);
    label.setText(text);// ww w . ja v  a2s  .c  om

    GridDataFactory.generate(label, 2, 1);

    return label;
}

From source file:com.liferay.ide.server.tomcat.ui.wizard.LiferayTomcatRuntimeComposite.java

License:Open Source License

protected Button createButton(String text, int style) {
    Button button = new Button(this, style);

    button.setText(text);/*from   w ww. j a va  2s  .c o  m*/

    GridDataFactory.generate(button, 2, 1);

    return button;
}

From source file:com.liferay.ide.server.tomcat.ui.wizard.LiferayTomcatRuntimeComposite.java

License:Open Source License

protected Label createLabel(String text) {
    Label label = new Label(this, SWT.NONE);
    label.setText(text);/* w w  w. ja v  a2  s  .co  m*/

    GridDataFactory.generate(label, 2, 1);

    return label;
}

From source file:com.liferay.ide.server.tomcat.ui.wizard.LiferayTomcatRuntimeComposite.java

License:Open Source License

protected Link createLink(String linkText) {
    Link link = new Link(this, SWT.NONE);
    link.setText(linkText);// www.j  av  a2  s .c  o m

    GridDataFactory.generate(link, 2, 1);

    return link;
}

From source file:com.liferay.ide.server.tomcat.ui.wizard.LiferayTomcatRuntimeOptionalComposite.java

License:Open Source License

protected Button createButton(String text, int style) {
    Button button = new Button(this, style);
    button.setText(text);//w  w w  .  j av a2  s  .com

    GridDataFactory.generate(button, 2, 1);

    return button;
}

From source file:com.liferay.ide.server.tomcat.ui.wizard.LiferayTomcatRuntimeOptionalComposite.java

License:Open Source License

protected static Label createLabel(Composite parent, String text) {
    Label label = new Label(parent, SWT.NONE);
    label.setText(text);//from  w w  w .  j a  v a 2  s. c o m

    GridDataFactory.generate(label, 2, 1);

    return label;
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.JavadocProblemsConfigurationBlock.java

License:Open Source License

private Composite createJavadocTabContent(Composite folder) {
    String[] errorWarningIgnore = new String[] { ERROR, WARNING, IGNORE };

    String[] errorWarningIgnoreLabels = new String[] {
            PreferencesMessages.JavadocProblemsConfigurationBlock_error,
            PreferencesMessages.JavadocProblemsConfigurationBlock_warning,
            PreferencesMessages.JavadocProblemsConfigurationBlock_ignore };

    String[] enabledDisabled = new String[] { ENABLED, DISABLED };
    String[] disabledEnabled = new String[] { DISABLED, ENABLED };

    String[] visibilities = new String[] { PUBLIC, PROTECTED, DEFAULT, PRIVATE };

    String[] visibilitiesLabels = new String[] { PreferencesMessages.JavadocProblemsConfigurationBlock_public,
            PreferencesMessages.JavadocProblemsConfigurationBlock_protected,
            PreferencesMessages.JavadocProblemsConfigurationBlock_default,
            PreferencesMessages.JavadocProblemsConfigurationBlock_private };

    String[] missingTagValues = { ALL_STANDARD_TAGS, RETURN_TAGS, NO_TAG };
    String[] missingTagLabels = new String[] {
            PreferencesMessages.JavadocProblemsConfigurationBlock_allStandardTags,
            PreferencesMessages.JavadocProblemsConfigurationBlock_returnTag,
            PreferencesMessages.JavadocProblemsConfigurationBlock_ignore };

    int nColumns = 3;

    final ScrolledPageContent sc1 = new ScrolledPageContent(folder);

    Composite outer = sc1.getBody();

    GridLayout layout = new GridLayout();
    layout.numColumns = nColumns;/*from w  w  w .j  av a2s .  c o  m*/
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    outer.setLayout(layout);

    StyledText widget = new StyledText(outer, SWT.READ_ONLY | SWT.WRAP);
    widget.setText(Messages.format(PreferencesMessages.JavadocProblemsConfigurationBlock_note_message,
            PreferencesMessages.JavadocProblemsConfigurationBlock_note_title));
    widget.setBackground(outer.getBackground());
    widget.setLeftMargin(0);
    widget.setEnabled(false);
    StyleRange styleRange = new StyleRange();
    styleRange.start = 0;
    styleRange.length = PreferencesMessages.JavadocProblemsConfigurationBlock_note_title.length();
    styleRange.fontStyle = SWT.BOLD;
    widget.setStyleRange(styleRange);
    GridDataFactory.generate(widget, nColumns, 1);

    Composite spacer = new Composite(outer, SWT.NONE);
    GridDataFactory.fillDefaults().span(nColumns, 1).hint(1, 5).applyTo(spacer);

    String label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_javadoc_support_label;
    addCheckBox(outer, label, PREF_JAVADOC_SUPPORT, enabledDisabled, 0);

    layout = new GridLayout();
    layout.numColumns = nColumns;
    layout.marginHeight = 0;

    Composite composite = new Composite(outer, SWT.NONE);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, true));

    fJavadocComposite = composite;

    Label description = new Label(composite, SWT.WRAP);
    description.setText(PreferencesMessages.JavadocProblemsConfigurationBlock_javadoc_description);
    GridData gd = new GridData();
    gd.horizontalSpan = nColumns;
    description.setLayoutData(gd);

    int indent = fPixelConverter.convertWidthInCharsToPixels(4);

    spacer = new Composite(composite, SWT.NONE);
    GridDataFactory.fillDefaults().span(nColumns, 1).hint(1, 5).applyTo(spacer);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_label;
    addComboBox(composite, label, PREF_PB_INVALID_JAVADOC, errorWarningIgnore, errorWarningIgnoreLabels, 0);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_tags_visibility_label;
    addComboBox(composite, label, PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY, visibilities, visibilitiesLabels,
            indent);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_tags_label;
    addCheckBox(composite, label, PREF_PB_INVALID_JAVADOC_TAGS, enabledDisabled, indent);

    Composite validateTagComposite = new Composite(composite, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
    gridData.horizontalIndent = indent;
    gridData.horizontalSpan = nColumns;
    validateTagComposite.setLayoutData(gridData);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    validateTagComposite.setLayout(gridLayout);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_tags_not_visible_ref_label;
    addCheckBox(validateTagComposite, label, PREF_PB_INVALID_JAVADOC_TAGS_NOT_VISIBLE_REF, enabledDisabled,
            indent);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_tags_deprecated_label;
    addCheckBox(validateTagComposite, label, PREF_PB_INVALID_JAVADOC_TAGS_DEPRECATED_REF, enabledDisabled,
            indent);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_tag_description;
    addComboBox(composite, label, PREF_PB_MISSING_JAVADOC_TAG_DESCRIPTION, missingTagValues, missingTagLabels,
            indent);

    spacer = new Composite(composite, SWT.NONE);
    GridDataFactory.fillDefaults().span(nColumns, 1).hint(1, 5).applyTo(spacer);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_javadoc_label;
    addComboBox(composite, label, PREF_PB_MISSING_JAVADOC_TAGS, errorWarningIgnore, errorWarningIgnoreLabels,
            0);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_javadoc_tags_visibility_label;
    addComboBox(composite, label, PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY, visibilities, visibilitiesLabels,
            indent);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_javadoc_tags_overriding_label;
    addCheckBox(composite, label, PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING, disabledEnabled, indent);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_comments_method_type_parameter_label;
    addCheckBox(composite, label, PREF_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS, disabledEnabled, indent);

    spacer = new Composite(composite, SWT.NONE);
    GridDataFactory.fillDefaults().span(nColumns, 1).hint(1, 5).applyTo(spacer);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_comments_label;
    addComboBox(composite, label, PREF_PB_MISSING_JAVADOC_COMMENTS, errorWarningIgnore,
            errorWarningIgnoreLabels, 0);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_comments_visibility_label;
    addComboBox(composite, label, PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY, visibilities, visibilitiesLabels,
            indent);

    label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_comments_overriding_label;
    addCheckBox(composite, label, PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING, disabledEnabled, indent);

    return sc1;
}

From source file:gov.redhawk.ide.dcd.ui.wizard.ScaDeviceProjectPropertiesWizardPage.java

License:Open Source License

/**
 * {@inheritDoc}/* w  ww.  j  av a 2s. c  om*/
 */
@Override
public void customCreateControl(final Composite parent) {
    if (this.showDeviceGroup) {
        // Device Group
        deviceGroup = new Group(parent, SWT.NONE);
        deviceGroup.setText(getResourceType());
        deviceGroup.setLayout(new GridLayout(2, false));
        GridDataFactory.generate(deviceGroup, 2, 1);

        deviceTypeCombo = new Combo(deviceGroup, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
        deviceTypeCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
        deviceTypeCombo.setItems(RedhawkIdePreferenceConstants.DEVICE_TYPES);
        deviceTypeCombo.select(0);

        aggregateButton = new Button(deviceGroup, SWT.CHECK);
        aggregateButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(1, 1).create());
        aggregateButton.setText(RedhawkIdePreferenceConstants.AGGREGATE_DEVICE + " device");

        context.bindValue(WidgetProperties.text().observe(deviceTypeCombo),
                PojoProperties.value("deviceType").observe(this.deviceProjSettings));
        context.bindValue(WidgetProperties.selection().observe(aggregateButton),
                PojoProperties.value("aggregate").observe(this.deviceProjSettings));
        deviceTypeCombo.addDisposeListener(new DisposeListener() {

            @Override
            public void widgetDisposed(DisposeEvent e) {
                if (context != null) {
                    context.dispose();
                    context = null;
                }
            }
        });
    }
}

From source file:gov.redhawk.ide.dcd.ui.wizard.ScaNodeProjectDevicesWizardPage.java

License:Open Source License

/**
 * {@inheritDoc}//  w ww . j  av  a 2s. c  o  m
 */
@Override
public void createControl(final Composite parent) {
    // The top-level composite for this page
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));

    // Top Heading
    final Label directionsLabel = new Label(composite, SWT.NONE);
    directionsLabel.setText("Check the boxes next to the devices to include in this node:");
    GridDataFactory.generate(directionsLabel, 2, 1);

    this.tableViewer = new CheckboxTableViewer(new Table(composite, SWT.CHECK | SWT.BORDER));
    this.tableViewer.getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));

    final ComposedAdapterFactory factory = new ComposedAdapterFactory();
    factory.addAdapterFactory(new SpdItemProviderAdapterFactory());

    this.tableViewer.setContentProvider(new ArrayContentProvider());
    this.tableViewer.setLabelProvider(new DecoratingLabelProvider(new AdapterFactoryLabelProvider(factory),
            PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()) {

        @Override
        public String getText(final Object element) {
            if (element instanceof SoftPkgImpl) {
                final SoftPkgImpl softPkg = (SoftPkgImpl) element;
                final URI uri = softPkg.eResource().getURI();
                return softPkg.getName() + " (" + uri.path().replace(uri.lastSegment(), "") + ")";
            }

            return "";
        }

    });
    this.tableViewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(final DoubleClickEvent event) {
            final StructuredSelection ss = (StructuredSelection) event.getSelection();
            final SoftPkg selected = (SoftPkg) ss.getFirstElement();
            ScaNodeProjectDevicesWizardPage.this.tableViewer.setChecked(selected,
                    !ScaNodeProjectDevicesWizardPage.this.tableViewer.getChecked(selected));
        }
    });
    this.tableViewer.setInput(this.devices);
    this.tableViewer.setCheckedElements(Collections.EMPTY_LIST.toArray());

    setControl(composite);
}