Example usage for org.eclipse.jface.viewers CheckboxTableViewer CheckboxTableViewer

List of usage examples for org.eclipse.jface.viewers CheckboxTableViewer CheckboxTableViewer

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers CheckboxTableViewer CheckboxTableViewer.

Prototype

public CheckboxTableViewer(Table table) 

Source Link

Document

Creates a table viewer on the given table control.

Usage

From source file:nexcore.tool.uml.ui.realization.sequencediagram.dialog.AddCoveredLifelineDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from w w  w  . j  a  v  a 2 s  .c  om
@Override
protected Control createDialogArea(Composite parent) {

    Composite composite = (Composite) super.createDialogArea(parent);

    composite.getShell().setText(UMLMessage.LABEL_ADD_COVERED_LIFELINE);

    GridLayout layout = (GridLayout) composite.getLayout();
    layout.numColumns = 1;

    Table table = new Table(composite,
            SWT.BORDER | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.HIDE_SELECTION);
    TableColumn column = new TableColumn(table, SWT.NONE);
    column.setMoveable(false);
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(100));
    table.setLayout(tableLayout);
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.widthHint = 300;
    gd.heightHint = 200;
    table.setLayoutData(gd);

    lifelineTableViwer = new CheckboxTableViewer(table);
    lifelineTableViwer.setContentProvider(new CoveredLifelineContentProvider());
    lifelineTableViwer.setLabelProvider(new CoveredLifelineLabelProvider());

    lifelineTableViwer.setInput(lifelineList);
    lifelineTableViwer.setAllChecked(isSelectAll);

    Composite buttonComposit = new Composite(composite, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    buttonComposit.setLayout(gridLayout);
    buttonComposit.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    checkAllButton = new Button(buttonComposit, SWT.NONE);
    checkAllButton.setText(UMLMessage.LABEL_SELECT_ALL);
    checkAllButton.addSelectionListener(new SelectionListener() {
        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            lifelineTableViwer.setAllChecked(true);
        }

        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    unCheckAllButton = new Button(buttonComposit, SWT.NONE);
    unCheckAllButton.setText(UMLMessage.LABEL_UNSELECT_ALL);
    unCheckAllButton.addSelectionListener(new SelectionListener() {
        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            lifelineTableViwer.setAllChecked(false);
        }

        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    return composite;

}

From source file:nexcore.tool.uml.ui.realization.sequencediagram.dialog.AddMissedCoveredLifelineDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *//*from   w w w . j a v  a  2  s .  co  m*/
@Override
protected Control createDialogArea(Composite parent) {

    Composite composite = (Composite) super.createDialogArea(parent);

    composite.getShell().setText(UMLMessage.LABEL_INSERT_COVERED_LIFELINE);

    GridLayout layout = (GridLayout) composite.getLayout();
    layout.numColumns = 1;

    Table table = new Table(composite,
            SWT.BORDER | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.HIDE_SELECTION);
    TableColumn column = new TableColumn(table, SWT.NONE);
    column.setMoveable(false);
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(100));
    table.setLayout(tableLayout);
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.widthHint = 300;
    gd.heightHint = 200;
    table.setLayoutData(gd);

    lifelineTableViwer = new CheckboxTableViewer(table);
    lifelineTableViwer.setContentProvider(new CoveredLifelineContentProvider());
    lifelineTableViwer.setLabelProvider(new CoveredLifelineLabelProvider());

    lifelineTableViwer.setInput(lifelineList);
    lifelineTableViwer.setAllChecked(isSelectAll);

    Composite buttonComposit = new Composite(composite, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    buttonComposit.setLayout(gridLayout);
    buttonComposit.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    checkAllButton = new Button(buttonComposit, SWT.NONE);
    checkAllButton.setText(UMLMessage.LABEL_SELECT_ALL);
    checkAllButton.addSelectionListener(new SelectionListener() {
        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            lifelineTableViwer.setAllChecked(true);
        }

        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    unCheckAllButton = new Button(buttonComposit, SWT.NONE);
    unCheckAllButton.setText(UMLMessage.LABEL_UNSELECT_ALL);
    unCheckAllButton.addSelectionListener(new SelectionListener() {
        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            lifelineTableViwer.setAllChecked(false);
        }

        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    return composite;

}

From source file:nexcore.tool.uml.ui.realization.sequencediagram.dialog.RemoveCoveredLifelineDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from   w  w w.  ja  v  a 2  s  .  c  o  m
@Override
protected Control createDialogArea(Composite parent) {

    Composite composite = (Composite) super.createDialogArea(parent);

    composite.getShell().setText(UMLMessage.LABEL_REMOVE_COVERED_LIFELINE);

    GridLayout layout = (GridLayout) composite.getLayout();
    layout.numColumns = 1;

    Table table = new Table(composite,
            SWT.BORDER | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.HIDE_SELECTION);
    TableColumn column = new TableColumn(table, SWT.NONE);
    column.setMoveable(false);
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(100));
    table.setLayout(tableLayout);
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.widthHint = 300;
    gd.heightHint = 200;
    table.setLayoutData(gd);

    lifelineTableViwer = new CheckboxTableViewer(table);
    lifelineTableViwer.setContentProvider(new CoveredLifelineContentProvider());
    lifelineTableViwer.setLabelProvider(new CoveredLifelineLabelProvider());

    lifelineTableViwer.setInput(lifelineList);
    lifelineTableViwer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (lifelineList.size() == lifelineTableViwer.getCheckedElements().length) {
                getButton(IDialogConstants.OK_ID).setEnabled(false);
            } else {
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            }
        }
    });

    Composite buttonComposit = new Composite(composite, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    buttonComposit.setLayout(gridLayout);
    buttonComposit.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    unCheckAllButton = new Button(buttonComposit, SWT.NONE);
    unCheckAllButton.setText(UMLMessage.LABEL_UNSELECT_ALL);
    unCheckAllButton.addSelectionListener(new SelectionListener() {
        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            lifelineTableViwer.setAllChecked(false);
        }

        /**
         * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    return composite;

}

From source file:org.apache.directory.studio.aciitemeditor.widgets.ACIItemProtectedItemsComposite.java

License:Apache License

/**
 * This method initializes table and table viewer
 *
 *//*from   www  .  ja v a 2  s. co  m*/
private void createTable() {
    GridData tableGridData = new GridData();
    tableGridData.grabExcessHorizontalSpace = true;
    tableGridData.verticalAlignment = GridData.FILL;
    tableGridData.horizontalAlignment = GridData.FILL;
    //tableGridData.heightHint = 100;

    Table table = new Table(composite, SWT.BORDER | SWT.CHECK);
    table.setHeaderVisible(false);
    table.setLayoutData(tableGridData);
    table.setLinesVisible(false);
    tableViewer = new CheckboxTableViewer(table);
    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new ProtectedItemsLabelProvider());
    tableViewer.setInput(protectedItemWrappers);

    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            protectedItemSelected();
        }
    });
    tableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            protectedItemChecked();
        }
    });
    tableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            if (editButton.isEnabled()) {
                editProtectedItem();
            }
        }
    });
}

From source file:org.apache.directory.studio.aciitemeditor.widgets.ACIItemUserClassesComposite.java

License:Apache License

/**
 * This method initializes table and table viewer
 *
 *///www.  ja v  a 2 s . c  o m
private void createTable() {
    GridData tableGridData = new GridData();
    tableGridData.grabExcessHorizontalSpace = true;
    tableGridData.verticalAlignment = GridData.FILL;
    tableGridData.horizontalAlignment = GridData.FILL;

    Table table = new Table(composite, SWT.BORDER | SWT.CHECK);
    table.setHeaderVisible(false);
    table.setLayoutData(tableGridData);
    table.setLinesVisible(false);
    tableViewer = new CheckboxTableViewer(table);
    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new UserClassesLabelProvider());
    tableViewer.setInput(userClassWrappers);

    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            userClassSelected();
        }
    });

    tableViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            userClassChecked();
        }
    });

    tableViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(DoubleClickEvent event) {
            if (editButton.isEnabled()) {
                editUserClass();
            }
        }
    });
}

From source file:org.apache.directory.studio.apacheds.configuration.editor.KerberosServerPage.java

License:Apache License

/**
 * Creates the Kerberos Settings section
 *
 * @param toolkit the toolkit to use// w w w  .j  a  va2s. com
 * @param parent the parent composite
 */
private void createKerberosSettingsSection(FormToolkit toolkit, Composite parent) {
    // Creation of the section
    Section section = toolkit.createSection(parent, Section.TITLE_BAR);
    section.setText(Messages.getString("KerberosServerPage.KerberosSettings")); //$NON-NLS-1$
    section.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    Composite composite = toolkit.createComposite(section);
    toolkit.paintBordersFor(composite);
    GridLayout glayout = new GridLayout(2, false);
    composite.setLayout(glayout);
    section.setClient(composite);

    // SASL Principal Text
    toolkit.createLabel(composite, Messages.getString("KerberosServerPage.PrimaryKdcRealm")); //$NON-NLS-1$
    primaryKdcRealmText = toolkit.createText(composite, ""); //$NON-NLS-1$
    setGridDataWithDefaultWidth(primaryKdcRealmText, new GridData(SWT.FILL, SWT.NONE, true, false));
    Label defaultSaslPrincipalLabel = createDefaultValueLabel(toolkit, composite, "EXAMPLE.COM"); //$NON-NLS-1$
    defaultSaslPrincipalLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));

    // Search Base Dn Text
    toolkit.createLabel(composite, Messages.getString("KerberosServerPage.SearchBaseDn")); //$NON-NLS-1$
    kdcSearchBaseDnText = toolkit.createText(composite, ""); //$NON-NLS-1$
    setGridDataWithDefaultWidth(kdcSearchBaseDnText, new GridData(SWT.FILL, SWT.NONE, true, false));
    Label defaultSaslSearchBaseDnLabel = createDefaultValueLabel(toolkit, composite,
            "ou=users,dc=example,dc=com"); //$NON-NLS-1$
    defaultSaslSearchBaseDnLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));

    // Encryption Types Table Viewer
    Label encryptionTypesLabel = toolkit.createLabel(composite,
            Messages.getString("KerberosServerPage.EncryptionTypes")); //$NON-NLS-1$
    encryptionTypesLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false));
    encryptionTypesTableViewer = new CheckboxTableViewer(new Table(composite, SWT.BORDER | SWT.CHECK));
    encryptionTypesTableViewer.setContentProvider(new ArrayContentProvider());
    encryptionTypesTableViewer.setLabelProvider(new LabelProvider() {
        public String getText(Object element) {
            if (element instanceof EncryptionType) {
                EncryptionType encryptionType = (EncryptionType) element;

                return encryptionType.getName().toUpperCase();
            }

            return super.getText(element);
        }
    });
    encryptionTypesTableViewer.setInput(SUPPORTED_ENCRYPTION_TYPES);
    GridData encryptionTypesTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false);
    encryptionTypesTableViewerGridData.heightHint = 60;
    encryptionTypesTableViewer.getControl().setLayoutData(encryptionTypesTableViewerGridData);
}

From source file:org.apache.directory.studio.apacheds.configuration.editor.LdapLdapsServersPage.java

License:Apache License

/**
 * Creates the SSL/Start TLS Section. We will deal with the following parameters :
 * <ul>/*from  ww  w  . jav a2s .c  o  m*/
 * <li>needClientAuth</li>
 * <li>wantClientAuth</li>
 * <li>enabledProtocols</li>
 * <li>enabledCiphersSuite</li>
 * </ul>
 *
 * @param toolkit the toolkit to use
 * @param parent the parent composite
 */
private void createSslAdvancedSettingsSection(FormToolkit toolkit, Composite parent) {
    // Creation of the section, compacted
    Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.COMPACT);
    section.setText(Messages.getString("LdapLdapsServersPage.SslAdvancedSettings")); //$NON-NLS-1$
    section.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    Composite composite = toolkit.createComposite(section);
    toolkit.paintBordersFor(composite);
    GridLayout glayout = new GridLayout(4, false);
    composite.setLayout(glayout);
    section.setClient(composite);

    // Enable LDAPS needClientAuth Checkbox
    needClientAuthCheckbox = toolkit.createButton(composite,
            Messages.getString("LdapLdapsServersPage.NeedClientAuth"), SWT.CHECK); //$NON-NLS-1$
    needClientAuthCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1));

    // Enable LDAPS wantClientAuth Checkbox. As the WantClientAuth is dependent on
    // the NeedClientAuth, we move it one column to the right
    toolkit.createLabel(composite, TABULATION);
    wantClientAuthCheckbox = toolkit.createButton(composite,
            Messages.getString("LdapLdapsServersPage.WantClientAuth"), SWT.CHECK); //$NON-NLS-1$
    wantClientAuthCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));

    // Ciphers Suite label 
    Label ciphersLabel = toolkit.createLabel(composite, Messages.getString("LdapLdapsServersPage.CiphersSuite"), //$NON-NLS-1$
            SWT.WRAP);
    setBold(ciphersLabel);
    ciphersLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, glayout.numColumns, 1));

    // Ciphers Suites Table Viewer
    ciphersSuiteTableViewer = new CheckboxTableViewer(new Table(composite, SWT.BORDER | SWT.CHECK));
    ciphersSuiteTableViewer.setContentProvider(new ArrayContentProvider());
    ciphersSuiteTableViewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object cipher) {
            if (cipher instanceof SupportedCipher) {
                SupportedCipher supportedCipher = (SupportedCipher) cipher;

                return supportedCipher.getCipher();
            }

            return super.getText(cipher);
        }
    });

    List<SupportedCipher> supportedCiphers = new ArrayList<>();

    for (SupportedCipher supportedCipher : SupportedCipher.SUPPORTED_CIPHERS) {
        if (supportedCipher.isJava8Implemented()) {
            supportedCiphers.add(supportedCipher);
        }
    }

    ciphersSuiteTableViewer.setInput(supportedCiphers);
    GridData ciphersSuiteTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, glayout.numColumns,
            5);
    ciphersSuiteTableViewerGridData.heightHint = 60;
    ciphersSuiteTableViewer.getControl().setLayoutData(ciphersSuiteTableViewerGridData);

    // Enabled Protocols label 
    Label protocolsLabel = toolkit.createLabel(composite,
            Messages.getString("LdapLdapsServersPage.EnabledProtocols"), SWT.WRAP); //$NON-NLS-1$
    setBold(protocolsLabel);
    protocolsLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, glayout.numColumns, 1));

    // Enabled Protocols
    // SSL V3
    sslv3Checkbox = toolkit.createButton(composite, SSL_V3, SWT.CHECK); //$NON-NLS-1$
    sslv3Checkbox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    // TLS 1.0
    tlsv1_0Checkbox = toolkit.createButton(composite, TLS_V1_0, SWT.CHECK); //$NON-NLS-1$
    tlsv1_0Checkbox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    // TLS 1.1
    tlsv1_1Checkbox = toolkit.createButton(composite, TLS_V1_1, SWT.CHECK); //$NON-NLS-1$
    tlsv1_1Checkbox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    // TLS 1.2
    tlsv1_2Checkbox = toolkit.createButton(composite, TLS_V1_2, SWT.CHECK); //$NON-NLS-1$
    tlsv1_2Checkbox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}

From source file:org.apache.directory.studio.schemaeditor.view.widget.CoreSchemasSelectionWidget.java

License:Apache License

/**
 * Creates the widget./* w w  w.  j a v a 2s .  c  om*/
 * 
 * @param parent
 *            the parent Composite
 * @return
 *      the associated composite
 */
public Composite createWidget(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // Server Type Group
    Group serverTypeGroup = new Group(composite, SWT.NONE);
    serverTypeGroup.setText(Messages.getString("CoreSchemasSelectionWidget.ServerType")); //$NON-NLS-1$
    serverTypeGroup.setLayout(new GridLayout(2, false));
    serverTypeGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));

    // Type ApacheDS Button
    typeApacheDSButton = new Button(serverTypeGroup, SWT.RADIO);
    typeApacheDSButton.setText(Messages.getString("CoreSchemasSelectionWidget.ApacheDS")); //$NON-NLS-1$
    typeApacheDSButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            resetTableViewerWithCoreSchemasFromApacheDS();
        }
    });

    // Type OpenLDAP Button
    typeOpenLDAPButton = new Button(serverTypeGroup, SWT.RADIO);
    typeOpenLDAPButton.setText(Messages.getString("CoreSchemasSelectionWidget.OpenLDAP")); //$NON-NLS-1$
    typeOpenLDAPButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            resetTableViewerWithCoreSchemasFromOpenLdap();
        }
    });

    // Core Schemas Label
    Label coreSchemaslabel = new Label(composite, SWT.NONE);
    coreSchemaslabel.setText(Messages.getString("CoreSchemasSelectionWidget.ChooseCoreSchemas")); //$NON-NLS-1$
    coreSchemaslabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));

    // Core Schemas TableViewer
    coreSchemasTableViewer = new CheckboxTableViewer(
            new Table(composite, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION));
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
    gridData.heightHint = 127;
    coreSchemasTableViewer.getTable().setLayoutData(gridData);
    coreSchemasTableViewer.setContentProvider(new ArrayContentProvider());
    coreSchemasTableViewer.setLabelProvider(new LabelProvider() {
        public Image getImage(Object element) {
            return Activator.getDefault().getImage(PluginConstants.IMG_SCHEMA);
        }
    });

    Button coreSchemasTableSelectAllButton = new Button(composite, SWT.PUSH);
    coreSchemasTableSelectAllButton.setText(Messages.getString("CoreSchemasSelectionWidget.SelectAll")); //$NON-NLS-1$
    coreSchemasTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
    coreSchemasTableSelectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            coreSchemasTableViewer.setAllChecked(true);
        }
    });

    Button coreSchemasTableDeselectAllButton = new Button(composite, SWT.PUSH);
    coreSchemasTableDeselectAllButton.setText(Messages.getString("CoreSchemasSelectionWidget.DeselectAll")); //$NON-NLS-1$
    coreSchemasTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
    coreSchemasTableDeselectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            coreSchemasTableViewer.setAllChecked(false);
        }
    });

    return composite;
}

From source file:org.apache.directory.studio.schemaeditor.view.wizards.ExportProjectsWizardPage.java

License:Apache License

/**
 * {@inheritDoc}/*  w  w w  .  j  a  va2 s.  c o m*/
 */
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);

    // Projects Group
    Group schemaProjectsGroup = new Group(composite, SWT.NONE);
    schemaProjectsGroup.setText(Messages.getString("ExportProjectsWizardPage.SchemaProjects")); //$NON-NLS-1$
    schemaProjectsGroup.setLayout(new GridLayout(2, false));
    schemaProjectsGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    // Projects TableViewer
    Label projectsLabel = new Label(schemaProjectsGroup, SWT.NONE);
    projectsLabel.setText(Messages.getString("ExportProjectsWizardPage.SelectSchemaProjects")); //$NON-NLS-1$
    projectsLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));
    projectsTableViewer = new CheckboxTableViewer(
            new Table(schemaProjectsGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION));
    GridData projectsTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2);
    projectsTableViewerGridData.heightHint = 125;
    projectsTableViewer.getTable().setLayoutData(projectsTableViewerGridData);
    projectsTableViewer.setContentProvider(new ArrayContentProvider());
    projectsTableViewer.setLabelProvider(new LabelProvider() {
        public String getText(Object element) {
            if (element instanceof Project) {
                return ((Project) element).getName();
            }

            // Default
            return super.getText(element);
        }

        public Image getImage(Object element) {
            if (element instanceof Project) {
                ProjectType type = ((Project) element).getType();
                switch (type) {
                case OFFLINE:
                    return Activator.getDefault().getImage(PluginConstants.IMG_PROJECT_OFFLINE_CLOSED);
                case ONLINE:
                    return Activator.getDefault().getImage(PluginConstants.IMG_PROJECT_ONLINE_CLOSED);
                }
            }

            // Default
            return super.getImage(element);
        }
    });
    projectsTableViewer.addCheckStateListener(new ICheckStateListener() {
        /**
         * Notifies of a change to the checked state of an element.
         *
         * @param event
         *      event object describing the change
         */
        public void checkStateChanged(CheckStateChangedEvent event) {
            dialogChanged();
        }
    });
    projectsTableSelectAllButton = new Button(schemaProjectsGroup, SWT.PUSH);
    projectsTableSelectAllButton.setText(Messages.getString("ExportProjectsWizardPage.SelectAll")); //$NON-NLS-1$
    projectsTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
    projectsTableSelectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            projectsTableViewer.setAllChecked(true);
            dialogChanged();
        }
    });
    projectsTableDeselectAllButton = new Button(schemaProjectsGroup, SWT.PUSH);
    projectsTableDeselectAllButton.setText(Messages.getString("ExportProjectsWizardPage.DeselectAll")); //$NON-NLS-1$
    projectsTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
    projectsTableDeselectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            projectsTableViewer.setAllChecked(false);
            dialogChanged();
        }
    });

    // Export Destination Group
    Group exportDestinationGroup = new Group(composite, SWT.NULL);
    exportDestinationGroup.setText(Messages.getString("ExportProjectsWizardPage.ExportDestination")); //$NON-NLS-1$
    exportDestinationGroup.setLayout(new GridLayout(3, false));
    exportDestinationGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    exportDirectoryLabel = new Label(exportDestinationGroup, SWT.NONE);
    exportDirectoryLabel.setText(Messages.getString("ExportProjectsWizardPage.Directory")); //$NON-NLS-1$
    exportDirectoryText = new Text(exportDestinationGroup, SWT.BORDER);
    exportDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    exportDirectoryText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    exportDirectoryButton = new Button(exportDestinationGroup, SWT.PUSH);
    exportDirectoryButton.setText(Messages.getString("ExportProjectsWizardPage.Browse")); //$NON-NLS-1$
    exportDirectoryButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            chooseExportDirectory();
            dialogChanged();
        }
    });

    initFields();

    setControl(composite);
}

From source file:org.apache.directory.studio.schemaeditor.view.wizards.ExportSchemasAsOpenLdapWizardPage.java

License:Apache License

/**
 * {@inheritDoc}/*from  w  w w. j a  v a  2s  . c om*/
 */
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);

    // Schemas Group
    Group schemasGroup = new Group(composite, SWT.NONE);
    schemasGroup.setText(Messages.getString("ExportSchemasAsOpenLdapWizardPage.Schemas")); //$NON-NLS-1$
    schemasGroup.setLayout(new GridLayout(2, false));
    schemasGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    // Schemas TableViewer
    Label schemasLabel = new Label(schemasGroup, SWT.NONE);
    schemasLabel.setText(Messages.getString("ExportSchemasAsOpenLdapWizardPage.SelectSchemasToExport")); //$NON-NLS-1$
    schemasLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));
    schemasTableViewer = new CheckboxTableViewer(
            new Table(schemasGroup, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION));
    GridData schemasTableViewerGridData = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 2);
    schemasTableViewerGridData.heightHint = 125;
    schemasTableViewer.getTable().setLayoutData(schemasTableViewerGridData);
    schemasTableViewer.setContentProvider(new ArrayContentProvider());
    schemasTableViewer.setLabelProvider(new LabelProvider() {
        public String getText(Object element) {
            if (element instanceof Schema) {
                return ((Schema) element).getSchemaName();
            }

            // Default
            return super.getText(element);
        }

        public Image getImage(Object element) {
            if (element instanceof Schema) {
                return Activator.getDefault().getImage(PluginConstants.IMG_SCHEMA);
            }

            // Default
            return super.getImage(element);
        }
    });
    schemasTableViewer.addCheckStateListener(new ICheckStateListener() {
        /**
         * Notifies of a change to the checked state of an element.
         *
         * @param event
         *      event object describing the change
         */
        public void checkStateChanged(CheckStateChangedEvent event) {
            dialogChanged();
        }
    });
    schemasTableSelectAllButton = new Button(schemasGroup, SWT.PUSH);
    schemasTableSelectAllButton.setText(Messages.getString("ExportSchemasAsOpenLdapWizardPage.SelectAll")); //$NON-NLS-1$
    schemasTableSelectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
    schemasTableSelectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            schemasTableViewer.setAllChecked(true);
            dialogChanged();
        }
    });
    schemasTableDeselectAllButton = new Button(schemasGroup, SWT.PUSH);
    schemasTableDeselectAllButton.setText(Messages.getString("ExportSchemasAsOpenLdapWizardPage.DeselectAll")); //$NON-NLS-1$
    schemasTableDeselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false));
    schemasTableDeselectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            schemasTableViewer.setAllChecked(false);
            dialogChanged();
        }
    });

    // Export Destination Group
    Group exportDestinationGroup = new Group(composite, SWT.NULL);
    exportDestinationGroup.setText(Messages.getString("ExportSchemasAsOpenLdapWizardPage.ExportDestination")); //$NON-NLS-1$
    exportDestinationGroup.setLayout(new GridLayout(3, false));
    exportDestinationGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    exportDirectoryLabel = new Label(exportDestinationGroup, SWT.NONE);
    exportDirectoryLabel.setText(Messages.getString("ExportSchemasAsOpenLdapWizardPage.Directory")); //$NON-NLS-1$
    exportDirectoryText = new Text(exportDestinationGroup, SWT.BORDER);
    exportDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    exportDirectoryText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    exportDirectoryButton = new Button(exportDestinationGroup, SWT.PUSH);
    exportDirectoryButton.setText(Messages.getString("ExportSchemasAsOpenLdapWizardPage.Browse")); //$NON-NLS-1$
    exportDirectoryButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            chooseExportDirectory();
            dialogChanged();
        }
    });

    initFields();
    dialogChanged();

    setControl(composite);
}