Example usage for org.eclipse.jface.layout GridLayoutFactory create

List of usage examples for org.eclipse.jface.layout GridLayoutFactory create

Introduction

In this page you can find the example usage for org.eclipse.jface.layout GridLayoutFactory create.

Prototype

public GridLayout create() 

Source Link

Document

Creates a new GridLayout, and initializes it with values from the factory.

Usage

From source file:com.n1nja.eclipse.wst.sdt.ui.SasspathFacetInstallWizardPage.java

License:Open Source License

public void createControl(final Composite parent) {
    final Sasspath sasspath = this.config.getSasspath();
    if (sasspath == null || sasspath.isEmpty())
        throw new IllegalStateException();
    final Sasspath.Entry entry = sasspath.get(0);
    final GridLayoutFactory pageLayout = GridLayoutFactory.swtDefaults().numColumns(1);
    final GridDataFactory primaryData = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true,
            true);//  w w  w .  j a  v  a  2 s .c o m
    final GridDataFactory secondaryData = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
            false);
    final Composite page = new Composite(parent, SWT.NONE);
    page.setLayoutData(primaryData.create());
    page.setLayout(pageLayout.create());
    final Label inputLabel = new Label(page, SWT.NONE);
    inputLabel.setLayoutData(secondaryData.create());
    inputLabel.setText("Input path:");
    final Text inputField = new Text(page, SWT.BORDER);
    inputField.setLayoutData(secondaryData.create());
    inputField.setText(entry.getInput().toString());
    inputField.addModifyListener(new ModifyListener() {
        public void modifyText(final ModifyEvent e) {
            entry.setInput(Path.fromOSString(inputField.getText()));
        }
    });
    final Label outputLabel = new Label(page, SWT.NONE);
    outputLabel.setLayoutData(secondaryData.create());
    outputLabel.setText("Output path:");
    final Text outputField = new Text(page, SWT.BORDER);
    outputField.setLayoutData(secondaryData.create());
    outputField.setText(sasspath.getDefaultOutput().toString());
    outputField.addModifyListener(new ModifyListener() {
        public void modifyText(final ModifyEvent e) {
            sasspath.setDefaultOutput(Path.fromOSString(outputField.getText()));
        }
    });
    this.setControl(page);
}

From source file:com.n1nja.eclipse.wst.sdt.ui.SasspathPropertyPage.java

License:Open Source License

@Override
protected Control createContents(final Composite parent) {
    final GridLayoutFactory pageLayout = GridLayoutFactory.swtDefaults().numColumns(2);
    final GridDataFactory primaryData = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true,
            true);//ww  w  . java  2s. com
    final GridDataFactory secondaryData = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
            false);
    final Composite page = new Composite(parent, SWT.NONE);
    page.setLayout(pageLayout.create());
    final SasspathTree tree = new SasspathTree(this.sasspath, page, SWT.BORDER);
    tree.getComposite().setLayoutData(primaryData.create());
    final GridLayoutFactory buttonLayout = GridLayoutFactory.fillDefaults().numColumns(1);
    final Composite buttons = new Composite(page, SWT.NONE);
    buttons.setLayoutData(primaryData.create());
    buttons.setLayout(buttonLayout.create());
    final Button addButton = new Button(buttons, SWT.NONE);
    addButton.setLayoutData(secondaryData.create());
    addButton.setText("Add Input\u2026");
    addButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            tree.add();
        }
    });
    final Button editButton = new Button(buttons, SWT.NONE);
    editButton.setLayoutData(secondaryData.create());
    editButton.setText("Edit\u2026");
    editButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            tree.edit();
        }
    });
    final Button removeButton = new Button(buttons, SWT.NONE);
    removeButton.setLayoutData(secondaryData.create());
    removeButton.setText("Remove");
    removeButton.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            tree.remove();
        }
    });
    tree.getComposite().addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent e) {
        }

        public void widgetSelected(final SelectionEvent e) {
            final boolean selected = tree.getComposite().getSelection().length != 1;
            editButton.setGrayed(selected);
            removeButton.setGrayed(selected);
        }
    });
    final Button enableButton = new Button(page, SWT.CHECK);
    enableButton.setLayoutData(secondaryData.create());
    enableButton.setText("Allow individual output folders");
    enableButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(final SelectionEvent e) {
            SasspathPropertyPage.this.sasspath.setEntryOutputEnabled(enableButton.getSelection());
            tree.update();
        }

        public void widgetDefaultSelected(final SelectionEvent e) {
        }
    });
    final Label defoutLabel = new Label(page, SWT.NONE);
    defoutLabel.setLayoutData(secondaryData.copy().span(2, 1).create());
    defoutLabel.setText("Default output folder:");
    final Text defoutField = new Text(page, SWT.BORDER);
    defoutField.setLayoutData(secondaryData.copy().span(2, 1).create());
    defoutField.setText(this.sasspath.getDefaultOutput().toString());
    defoutField.addModifyListener(new ModifyListener() {
        public void modifyText(final ModifyEvent e) {
            SasspathPropertyPage.this.sasspath.setDefaultOutput(Path.fromOSString(defoutField.getText()));
        }
    });
    return page;
}

From source file:com.schmeedy.relaxng.eclipse.ui.internal.preferences.EditRngSchemaBindingDialog.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    errorReportColor = new Color(parent.getDisplay(), 200, 0, 0);
    warningReportColor = new Color(parent.getDisplay(), 204, 102, 0);
    browseImage = RngUiPlugin.getDefault().getIcon("file_expand.gif").createImage();

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.createFrom(new GridLayout(3, false)).margins(10, 7).create());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label labelNamespace = new Label(composite, SWT.NONE);
    labelNamespace.setText("Namespace: ");

    GridData inputLayoutData = new GridData(GridData.FILL_HORIZONTAL);
    inputLayoutData.widthHint = 270;//from w w  w. j  av  a  2  s .  c om

    namespaceText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    namespaceText.setLayoutData(GridDataFactory.createFrom(inputLayoutData).span(2, 1).create());

    Label labelSchemaLocation = new Label(composite, SWT.NONE);
    labelSchemaLocation.setText("Schema Location: ");

    schemaLocationText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    schemaLocationText.setLayoutData(inputLayoutData);

    Button browseControl = createBrowseButton(composite);
    browseControl.addSelectionListener(new DropDownSelectionListener(schemaLocationText));

    Label labelSchemaType = new Label(composite, SWT.NONE);
    labelSchemaType.setText("Schema Syntax: ");

    schemaTypeCombo = new Combo(composite, SWT.READ_ONLY);
    schemaTypeCombo.setLayoutData(GridDataFactory.createFrom(inputLayoutData).span(2, 1).create());
    schemaTypeCombo.add("XML", SCHEMA_TYPE_XML_COMBO_IDX);
    schemaTypeCombo.add("Compact", SCHEMA_TYPE_COMPACT_COMBO_IDX);

    errorReportArea = new Label(composite, SWT.NONE);
    errorReportArea.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(3, 1).create());

    Composite buttonComposite = new Composite(composite, SWT.NONE);
    buttonComposite.setLayout(new GridLayout(2, false));
    buttonComposite
            .setLayoutData(GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).span(3, 1).create());

    okButton = createButton(buttonComposite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    okButton.setEnabled(false);
    createButton(buttonComposite, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    if (binding != null) {
        initEditedValues();
    }

    revalidate();

    ModifyListener validationListener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            revalidate();
        }
    };

    namespaceText.addModifyListener(validationListener);
    schemaLocationText.addModifyListener(validationListener);
    schemaTypeCombo.addModifyListener(validationListener);

    return composite;
}

From source file:de.fzi.skillpro.order.dialogs.CreateNewOrderDialog.java

License:Open Source License

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

    Composite container = new Composite(area, SWT.NONE);
    GridLayoutFactory gridLayoutDouble = GridLayoutFactory.swtDefaults().numColumns(2);

    GridDataFactory gd = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER);
    GridDataFactory gdGrab = gd.copy().grab(true, false);

    container.setLayoutData(gdGrab.create());
    container.setLayout(gridLayoutDouble.create());
    createContainerItems(container, gdGrab);

    return area;/*from   www.  ja  v  a 2  s . c  o m*/
}

From source file:masterviews.composite.abstracts.TableComposite.java

License:Open Source License

/**
 * Constructs a new {@link TableComposite}.
 * /*ww  w  . j  a va 2s . c om*/
 * @param parent
 *            this {@link TableComposite} will be draw based on this
 *            {@link Composite}
 * @param style
 *            not used.
 */
public TableComposite(Composite parent, int style) {
    super(parent, SWT.NONE);
    if (style == SWT.MULTI) {
        GridLayoutFactory singleLayoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
                .spacing(1, 1).numColumns(1);
        GridLayoutFactory tripleLayoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
                .spacing(1, 1).numColumns(3);

        this.setLayout(tripleLayoutFactory.create());
        Composite leftToolbar = new Composite(this, SWT.NONE);
        leftToolbar.setLayoutData(GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.FILL)
                .hint(SWT.DEFAULT, SWT.DEFAULT).grab(false, false).create());
        leftToolbar.setLayout(singleLayoutFactory.create());

        addCoolbarItems(leftToolbar);

        Label separator = new Label(this, SWT.SEPARATOR | SWT.VERTICAL);
        separator.setLayoutData(
                GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.FILL).grab(false, true).create());

        Composite mainView = new Composite(this, SWT.NONE);
        mainView.setLayout(singleLayoutFactory.create());
        mainView.setLayoutData(
                GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).create());
        mainView.setLayoutData(
                GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).create());
        createTableViewer(mainView);
    } else {
        GridLayoutFactory layoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
                .spacing(1, 1);
        this.setLayout(layoutFactory.create());
        this.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
        Composite mainView = new Composite(this, SWT.NONE);
        mainView.setLayout(layoutFactory.create());
        mainView.setLayoutData(
                GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).create());
        createTableViewer(mainView);
    }
}

From source file:masterviews.composite.abstracts.TreeComposite.java

License:Open Source License

/**
 * Constructs a new {@link TreeComposite}.
 * /*  www .j a v  a2 s .c o  m*/
 * @param parent
 *            this {@link TreeComposite} will be draw based on this
 *            {@link Composite}
 * @param style
 *            not used.
 */
public TreeComposite(Composite parent, int style) {
    super(parent, SWT.NONE);

    GridLayoutFactory singleLayoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
            .spacing(1, 1).numColumns(1);
    GridLayoutFactory doubleLayoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
            .spacing(1, 1).numColumns(2);
    GridLayoutFactory tripleLayoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
            .spacing(1, 1).numColumns(3);

    this.setLayout(tripleLayoutFactory.create());

    Composite leftToolbar = new Composite(this, SWT.NONE);
    leftToolbar.setLayoutData(GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.FILL)
            .hint(SWT.DEFAULT, SWT.DEFAULT).grab(false, false).create());
    leftToolbar.setLayout(singleLayoutFactory.create());
    ToolBar coolToolBar = new ToolBar(leftToolbar, SWT.VERTICAL);

    // the default cool bar items.
    createToolItem(coolToolBar, SWT.VERTICAL, "R",
            Activator.getImageDescriptor("icons/refresh.png").createImage(), "Refreshes the Viewer",
            refreshSelectionListener());
    createToolItem(coolToolBar, SWT.VERTICAL, "+",
            Activator.getImageDescriptor("icons/expandall.png").createImage(), "Expands the branches in viewer",
            expandSelectionListener());
    createToolItem(coolToolBar, SWT.VERTICAL, "-",
            Activator.getImageDescriptor("icons/collapseall.png").createImage(),
            "Collapses the branches in viewer", collapseSelectionListener());
    addCoolbarItems(leftToolbar);

    Label separator = new Label(this, SWT.SEPARATOR | SWT.VERTICAL);
    separator.setLayoutData(
            GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.FILL).grab(false, true).create());

    Composite mainView = new Composite(this, SWT.NONE);
    mainView.setLayout(doubleLayoutFactory.create());
    mainView.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).create());
    createTreeViewer(mainView, style);
}

From source file:masterviews.composite.abstracts.TreeTableComposite.java

License:Open Source License

public TreeTableComposite(Composite parent, int style, boolean visibleHeaders) {
    super(parent, SWT.NONE);

    GridLayoutFactory singleLayoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
            .spacing(1, 1).numColumns(1);
    GridLayoutFactory doubleLayoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
            .spacing(1, 1).numColumns(2);
    GridLayoutFactory trippleLayoutFactory = GridLayoutFactory.fillDefaults().extendedMargins(1, 1, 1, 1)
            .spacing(1, 1).numColumns(3);

    this.setLayout(trippleLayoutFactory.create());

    createHeaderMenu();//www  .j a va 2  s .c o m

    Composite leftToolbar = new Composite(this, SWT.NONE);
    leftToolbar.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.FILL).hint(25, SWT.DEFAULT)
            .grab(false, false).create());
    leftToolbar.setLayout(singleLayoutFactory.create());
    ToolBar coolToolBar = new ToolBar(leftToolbar, SWT.VERTICAL);

    // the default cool bar items.
    createToolItem(coolToolBar, SWT.VERTICAL, "R",
            Activator.getImageDescriptor("icons/refresh.png").createImage(), "Refreshes the Viewer",
            refreshSelectionListener());
    createToolItem(coolToolBar, SWT.VERTICAL, "+",
            Activator.getImageDescriptor("icons/expandall.png").createImage(), "Expands the branches in viewer",
            expandSelectionListener());
    createToolItem(coolToolBar, SWT.VERTICAL, "-",
            Activator.getImageDescriptor("icons/collapseall.png").createImage(),
            "Collapses the branches in viewer", collapseSelectionListener());
    addCoolbarItems(leftToolbar);

    Label separator = new Label(this, SWT.SEPARATOR | SWT.VERTICAL);
    separator.setLayoutData(
            GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.FILL).grab(false, true).create());

    Composite mainView = new Composite(this, SWT.NONE);
    mainView.setLayout(doubleLayoutFactory.create());
    mainView.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).create());
    createTreeViewer(mainView, style);
    viewer.getTree().setHeaderVisible(visibleHeaders);
}

From source file:org.eclipse.birt.report.designer.ui.dialogs.HighlightRuleBuilder.java

License:Open Source License

protected Control createDialogArea(Composite parent) {

    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gdata;/*from  w w  w . j a v  a  2  s.c o m*/
    GridLayout glayout;

    Composite contents = new Composite(composite, SWT.NONE);
    contents.setLayout(new GridLayout());
    contents.setLayoutData(new GridData(GridData.FILL_BOTH));

    // createApplyStyleArea( innerParent );

    condition = new Group(contents, SWT.NONE);
    gdata = new GridData(GridData.FILL_HORIZONTAL);
    condition.setLayoutData(gdata);
    glayout = GridLayoutFactory.createFrom(new GridLayout()).spacing(5, 0).numColumns(5).equalWidth(false)
            .create();
    condition.setLayout(glayout);
    condition.setText(Messages.getString("HighlightRuleBuilderDialog.text.Group.Condition")); //$NON-NLS-1$

    gdata = new GridData();
    gdata.widthHint = 150;
    if (exprControlType == EXPRESSION_CONTROL_COMBO) {
        expressionCombo = new Combo(condition, SWT.NONE);
        expressionCombo.setLayoutData(gdata);
        expressionCombo.setVisibleItemCount(30);
        expressionCombo.setItems(getDataSetColumns());
        fillExpression(expressionCombo);
        expressionCombo.addSelectionListener(expSelListener);
        expressionCombo.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                updateButtons();
            }
        });
    } else {
        expressionText = new Text(condition, SWT.BORDER | SWT.MULTI);
        gdata.heightHint = expressionText.computeSize(SWT.DEFAULT, SWT.DEFAULT).y
                - expressionText.getBorderWidth() * 2;
        expressionText.setLayoutData(gdata);
        if (handle != null) {
            expressionText.setText(handle.getTestExpression());
        }
        expressionText.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                updateButtons();
            }
        });
    }

    Listener listener = new Listener() {

        public void handleEvent(Event event) {
            updateButtons();
        }

    };
    ExpressionButtonUtil.createExpressionButton(condition, getExpressionControl(), getExpressionProvider(),
            designHandle, listener);

    operator = new Combo(condition, SWT.READ_ONLY);
    for (int i = 0; i < OPERATOR.length; i++) {
        operator.add(OPERATOR[i][0]);
    }
    operator.setVisibleItemCount(30);

    create2ValueComposite(condition);

    operator.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            operatorChange();
        }
    });

    createApplyStyleArea(contents);

    Label lb = new Label(contents, SWT.SEPARATOR | SWT.HORIZONTAL);
    lb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    return composite;

}

From source file:org.eclipse.birt.report.designer.ui.dialogs.MapRuleBuilder.java

License:Open Source License

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

    Composite contents = new Composite(composite, SWT.NONE);
    contents.setLayout(new GridLayout());
    contents.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label lb = new Label(contents, SWT.NONE);
    lb.setText(Messages.getString("MapRuleBuilderDialog.text.Condition")); //$NON-NLS-1$

    condition = new Composite(contents, SWT.NONE);
    GridData gdata = new GridData(GridData.FILL_HORIZONTAL);
    // gdata.heightHint = 180;
    condition.setLayoutData(gdata);//from   w  ww  .ja v a2  s .  c  om
    GridLayout glayout = GridLayoutFactory.createFrom(new GridLayout()).numColumns(5).equalWidth(false)
            .create();
    condition.setLayout(glayout);

    expression = new Combo(condition, SWT.NONE);
    gdata = new GridData();
    gdata.widthHint = 120;
    expression.setLayoutData(gdata);
    expression.setVisibleItemCount(30);
    expression.setItems(getDataSetColumns());
    fillExpression(expression);
    expression.addSelectionListener(expSelListener);
    expression.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            updateButtons();
        }
    });

    Listener listener = new Listener() {

        public void handleEvent(Event event) {
            updateButtons();
        }

    };

    ExpressionButtonUtil.createExpressionButton(condition, expression, getExpressionProvider(), designHandle,
            listener);

    operator = new Combo(condition, SWT.READ_ONLY);
    operator.setVisibleItemCount(30);
    for (int i = 0; i < OPERATOR.length; i++) {
        operator.add(OPERATOR[i][0]);
    }

    create2ValueComposite(condition);

    operator.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            operatorChange();
        }
    });

    lb = new Label(contents, SWT.NONE);
    lb.setText(Messages.getString("MapRuleBuilderDialog.text.Display")); //$NON-NLS-1$

    Composite format = new Composite(contents, SWT.NONE);
    format.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    glayout = new GridLayout();
    format.setLayout(glayout);

    display = new Text(format, SWT.BORDER);
    gdata = new GridData();
    gdata.widthHint = 300;
    display.setLayoutData(gdata);

    createResourceKeyArea(contents);

    lb = new Label(contents, SWT.SEPARATOR | SWT.HORIZONTAL);
    lb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    return composite;
}

From source file:skillpro.product.dialogs.AddTransportSkillToProductDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    GridLayoutFactory gridLayoutDouble = GridLayoutFactory.swtDefaults().numColumns(2);

    GridDataFactory gd = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER);
    GridDataFactory gdGrab = gd.copy().grab(true, false);

    container.setLayoutData(gdGrab.create());
    container.setLayout(gridLayoutDouble.create());
    createContainerItems(container, gdGrab);

    return area;/*from   w  w w. j a v  a  2 s  . c  o  m*/
}