Search in sources :

Example 36 with CheckboxTableViewer

use of org.eclipse.jface.viewers.CheckboxTableViewer in project webtools.servertools by eclipse.

the class OverviewEditorPart method createPublishSection.

protected void createPublishSection(Composite rightColumnComp, FormToolkit toolkit) {
    Section section = toolkit.createSection(rightColumnComp, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
    section.setText(Messages.serverEditorOverviewPublishSection);
    section.setDescription(Messages.serverEditorOverviewPublishDescription);
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
    Composite composite = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 5;
    layout.marginWidth = 10;
    layout.verticalSpacing = 5;
    layout.horizontalSpacing = 15;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
    IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
    whs.setHelp(composite, ContextIds.EDITOR_OVERVIEW_PAGE);
    toolkit.paintBordersFor(composite);
    section.setClient(composite);
    // auto-publish
    if (server != null) {
        final Server svr = (Server) server;
        int publishSetting = svr.getAutoPublishSetting();
        GridData data = new GridData(GridData.FILL_HORIZONTAL);
        autoPublishDisable = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishDisable, SWT.RADIO);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        autoPublishDisable.setLayoutData(data);
        autoPublishDisable.setSelection(publishSetting == Server.AUTO_PUBLISH_DISABLE);
        whs.setHelp(autoPublishDisable, ContextIds.EDITOR_AUTOPUBLISH_DISABLE);
        autoPublishEnableResource = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishEnabledResource, SWT.RADIO);
        autoPublishEnableResource.setSelection(publishSetting == Server.AUTO_PUBLISH_RESOURCE);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        autoPublishEnableResource.setLayoutData(data);
        whs.setHelp(autoPublishEnableResource, ContextIds.EDITOR_AUTOPUBLISH_ENABLE);
        autoPublishEnableBuild = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishEnabledBuild, SWT.RADIO);
        autoPublishEnableBuild.setSelection(publishSetting == Server.AUTO_PUBLISH_BUILD);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        autoPublishEnableBuild.setLayoutData(data);
        whs.setHelp(autoPublishEnableBuild, ContextIds.EDITOR_AUTOPUBLISH_BUILD);
        final Label autoPublishTimeLabel = createLabel(toolkit, composite, Messages.serverEditorOverviewAutoPublishEnabledInterval);
        data = new GridData();
        data.horizontalIndent = 20;
        autoPublishTimeLabel.setLayoutData(data);
        autoPublishTimeLabel.setEnabled(!autoPublishDisable.getSelection());
        autoPublishTime = new Spinner(composite, SWT.BORDER);
        autoPublishTime.setMinimum(0);
        autoPublishTime.setIncrement(5);
        autoPublishTime.setMaximum(MAX_SPINNER_TIME);
        autoPublishTime.setSelection(svr.getAutoPublishTime());
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        data.widthHint = SWT.DEFAULT;
        autoPublishTime.setLayoutData(data);
        autoPublishTime.setEnabled(!autoPublishDisable.getSelection());
        SWTUtil.setSpinnerTooltip(autoPublishTime);
        whs.setHelp(autoPublishTime, ContextIds.EDITOR_AUTOPUBLISH_INTERVAL);
        autoPublishEnableResource.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                if (updating || !autoPublishEnableResource.getSelection())
                    return;
                updating = true;
                execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_RESOURCE));
                updating = false;
                autoPublishTimeLabel.setEnabled(!autoPublishDisable.getSelection());
                autoPublishTime.setEnabled(!autoPublishDisable.getSelection());
                validate();
            }
        });
        autoPublishEnableBuild.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                if (updating || !autoPublishEnableBuild.getSelection())
                    return;
                updating = true;
                execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_BUILD));
                updating = false;
                autoPublishTimeLabel.setEnabled(!autoPublishDisable.getSelection());
                autoPublishTime.setEnabled(!autoPublishDisable.getSelection());
                validate();
            }
        });
        autoPublishDisable.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                if (updating || !autoPublishDisable.getSelection())
                    return;
                updating = true;
                execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_DISABLE));
                updating = false;
                autoPublishTimeLabel.setEnabled(!autoPublishDisable.getSelection());
                autoPublishTime.setEnabled(!autoPublishDisable.getSelection());
                validate();
            }
        });
        autoPublishTime.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                if (updating)
                    return;
                updating = true;
                execute(new SetServerAutoPublishTimeCommand(getServer(), autoPublishTime.getSelection()));
                SWTUtil.setSpinnerTooltip(autoPublishTime);
                updating = false;
                validate();
            }
        });
        // publishers
        Publisher[] pubs = ((Server) server).getAllPublishers();
        if (pubs != null && pubs.length > 0) {
            Label label = toolkit.createLabel(composite, Messages.serverEditorOverviewPublishers);
            data = new GridData(GridData.FILL_HORIZONTAL);
            data.horizontalSpan = 2;
            label.setLayoutData(data);
            publishersTable = toolkit.createTable(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.CHECK);
            publishersTable.setHeaderVisible(false);
            publishersTable.setLinesVisible(false);
            whs.setHelp(publishersTable, ContextIds.EDITOR_PUBLISHTASKS_CONFIGURATION);
            data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
            data.horizontalSpan = 2;
            data.heightHint = 80;
            publishersTable.setLayoutData(data);
            publishersViewer = new CheckboxTableViewer(publishersTable);
            publishersViewer.setColumnProperties(new String[] { "name" });
            publishersViewer.setContentProvider(new PublisherContentProvider(pubs));
            publishersViewer.setLabelProvider(new PublishLabelProvider());
            publishersViewer.setInput("root");
            Publisher[] pubs2 = ((Server) server).getEnabledPublishers();
            for (Publisher p : pubs2) publishersViewer.setChecked(p, true);
            publishersViewer.addCheckStateListener(new ICheckStateListener() {

                public void checkStateChanged(CheckStateChangedEvent event) {
                    Object element = event.getElement();
                    if (element == null || !(element instanceof Publisher))
                        return;
                    if (updating)
                        return;
                    updating = true;
                    execute(new SetPublisherEnablementCommand(getServer(), (Publisher) element, event.getChecked()));
                    updating = false;
                }
            });
        }
    }
}
Also used : CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) GridLayout(org.eclipse.swt.layout.GridLayout) IWorkbenchHelpSystem(org.eclipse.ui.help.IWorkbenchHelpSystem) GridData(org.eclipse.swt.layout.GridData) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent)

Example 37 with CheckboxTableViewer

use of org.eclipse.jface.viewers.CheckboxTableViewer in project tdq-studio-se by Talend.

the class TwoPartCheckSelectionDialog method createSecondPart.

// protected void checkElementChecked() {
// }
protected CheckboxTableViewer createSecondPart(Composite parent) {
    CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.BORDER);
    viewer.setLabelProvider(this.sLabelProvider);
    viewer.setContentProvider(this.sContentProvider);
    viewer.addSelectionChangedListener(this);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(viewer.getTable());
    return viewer;
}
Also used : CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer)

Example 38 with CheckboxTableViewer

use of org.eclipse.jface.viewers.CheckboxTableViewer in project archi-modelrepository-plugin by archi-contribs.

the class ConflictsDialog method createTableControl.

private void createTableControl(Composite parent) {
    Composite tableComp = new Composite(parent, SWT.BORDER);
    TableColumnLayout tableLayout = new TableColumnLayout();
    tableComp.setLayout(tableLayout);
    tableComp.setLayoutData(new GridData(GridData.FILL_BOTH));
    Table table = new Table(tableComp, SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
    table.setHeaderVisible(true);
    fTableViewer = new CheckboxTableViewer(table);
    fTableViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    fTableViewer.getTable().setLinesVisible(true);
    fTableViewer.setComparator(new ViewerComparator());
    // Columns
    TableViewerColumn column1 = new TableViewerColumn(fTableViewer, SWT.NONE, 0);
    column1.getColumn().setText(Messages.ConflictsDialog_5);
    tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(100, true));
    // Content Provider
    fTableViewer.setContentProvider(new IStructuredContentProvider() {

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

        public void dispose() {
        }

        public Object[] getElements(Object inputElement) {
            MergeResult result = fHandler.getMergeResult();
            return result.getConflicts().keySet().toArray();
        }
    });
    fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            String path = (String) ((StructuredSelection) event.getSelection()).getFirstElement();
            try {
                fFileViewerOurs.setText(fHandler.getArchiRepository().getFileContents(path, IGraficoConstants.HEAD));
                fFileViewerTheirs.setText(fHandler.getArchiRepository().getFileContents(path, IGraficoConstants.ORIGIN_MASTER));
                fFileViewerDiff.setText(fHandler.getArchiRepository().getWorkingTreeFileContents(path));
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    });
    // Label Provider
    fTableViewer.setLabelProvider(new LabelProvider());
    // Start the table
    // anything will do //$NON-NLS-1$
    fTableViewer.setInput("");
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) MergeResult(org.eclipse.jgit.api.MergeResult) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) Viewer(org.eclipse.jface.viewers.Viewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IOException(java.io.IOException) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) GridData(org.eclipse.swt.layout.GridData) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) LabelProvider(org.eclipse.jface.viewers.LabelProvider) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 39 with CheckboxTableViewer

use of org.eclipse.jface.viewers.CheckboxTableViewer in project jbosstools-hibernate by jbosstools.

the class UpDownListComposite method createTable.

/**
 * This method initializes table
 */
private void createTable() {
    GridData gridData1 = new org.eclipse.swt.layout.GridData();
    gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    gridData1.grabExcessHorizontalSpace = true;
    gridData1.grabExcessVerticalSpace = true;
    gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
    gridData1.heightHint = 20;
    gridData1.widthHint = 20;
    table = new Table(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI | (checkboxInTable ? SWT.CHECK : SWT.NONE));
    table.setHeaderVisible(false);
    table.setLayoutData(gridData1);
    table.setLinesVisible(false);
    createColumns(table);
    table.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
            handleTableSelectionChanged();
        }

        public void widgetSelected(SelectionEvent e) {
            handleTableSelectionChanged();
        }
    });
    tableView = checkboxInTable ? new CheckboxTableViewer(table) : new TableViewer(table);
    if (provider != null)
        tableView.setLabelProvider(provider);
    if (contentProvider != null)
        tableView.setContentProvider(contentProvider);
}
Also used : Table(org.eclipse.swt.widgets.Table) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 40 with CheckboxTableViewer

use of org.eclipse.jface.viewers.CheckboxTableViewer in project portfolio by buchen.

the class FilePickerDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(composite, SWT.None);
    GridDataFactory.fillDefaults().grab(true, true).hint(400, 300).applyTo(container);
    GridLayoutFactory.fillDefaults().numColumns(1).applyTo(container);
    Label label = new Label(container, SWT.None);
    label.setText(Messages.SaveHandlerTitle);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(label);
    Composite tableArea = new Composite(container, SWT.NONE);
    GridDataFactory.fillDefaults().grab(false, true).applyTo(tableArea);
    tableArea.setLayout(new FillLayout());
    TableColumnLayout layout = new TableColumnLayout();
    tableArea.setLayout(layout);
    Table table = new Table(tableArea, SWT.BORDER | SWT.CHECK | SWT.MULTI);
    tableViewer = new CheckboxTableViewer(table);
    table.setHeaderVisible(false);
    table.setLinesVisible(false);
    TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.None);
    layout.setColumnData(column.getColumn(), new ColumnWeightData(100));
    tableViewer.setLabelProvider(labelProvider);
    tableViewer.setContentProvider(ArrayContentProvider.getInstance());
    tableViewer.setInput(elements);
    tableViewer.setCheckedElements(elements);
    tableViewer.setComparator(new ViewerComparator());
    hookListener();
    return composite;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) Label(org.eclipse.swt.widgets.Label) FillLayout(org.eclipse.swt.layout.FillLayout) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

CheckboxTableViewer (org.eclipse.jface.viewers.CheckboxTableViewer)45 Composite (org.eclipse.swt.widgets.Composite)29 Table (org.eclipse.swt.widgets.Table)28 GridData (org.eclipse.swt.layout.GridData)24 GridLayout (org.eclipse.swt.layout.GridLayout)21 Label (org.eclipse.swt.widgets.Label)20 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)19 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)19 SelectionEvent (org.eclipse.swt.events.SelectionEvent)18 TableColumn (org.eclipse.swt.widgets.TableColumn)17 Button (org.eclipse.swt.widgets.Button)15 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)12 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)10 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)8 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)8 SelectionListener (org.eclipse.swt.events.SelectionListener)7 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)6 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)6 Viewer (org.eclipse.jface.viewers.Viewer)6 Event (org.eclipse.swt.widgets.Event)6