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

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

Introduction

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

Prototype

public static GridLayout copyLayout(GridLayout l) 

Source Link

Document

Copies the given GridLayout instance

Usage

From source file:com.astra.ses.spell.dev.wizards.procs.pages.ProcedureControlVersionWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    // Main composite
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, true);
    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    container.setLayout(layout);/* w  w  w .j a  v a  2 s.c  om*/
    container.setLayoutData(layoutData);

    // Control version group
    Group cvGroup = new Group(container, SWT.BORDER);
    cvGroup.setText("Control version options");
    GridLayout groupLayout = GridLayoutFactory.copyLayout(layout);
    cvGroup.setLayout(groupLayout);
    GridData groupData = GridDataFactory.copyData(layoutData);
    cvGroup.setLayoutData(groupData);

    // Add to control version button
    m_addButton = new Button(cvGroup, SWT.CHECK);
    m_addButton.setText("Add this file to version control after it has been created");
    m_addButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            Button add = (Button) e.widget;
            boolean selected = add.getSelection();
            m_commitButton.setEnabled(selected);
            m_needsLockButton.setEnabled(selected);
        }
    });

    // Commit button
    m_commitButton = new Button(cvGroup, SWT.CHECK);
    m_commitButton.setText("Commit this file after its creation");

    Group propertiesGroup = new Group(container, SWT.BORDER);
    propertiesGroup.setText("Control version options");
    GridLayout propLayout = GridLayoutFactory.copyLayout(groupLayout);
    propertiesGroup.setLayout(propLayout);
    GridData propData = new GridData(GridData.FILL_HORIZONTAL);
    propData.grabExcessHorizontalSpace = true;
    propertiesGroup.setLayoutData(propData);

    // Needs lock property button
    m_needsLockButton = new Button(propertiesGroup, SWT.CHECK);
    m_needsLockButton.setText("This file requires to be locked for its edition");

    Label descLabel = new Label(propertiesGroup, SWT.NONE);
    descLabel.setText("Version control properties can only be set if the procedure is added.\n"
            + "Properties setting will only be effective after the procedure has been committed.");

    //Initialize the values
    m_addButton.setSelection(false);
    m_needsLockButton.setSelection(false);
    m_commitButton.setSelection(true);
    m_commitButton.setEnabled(false);
    m_needsLockButton.setEnabled(false);

    // validate page
    validatePage();

    // set Control
    setControl(container);
}