Java Code Examples for org.eclipse.jface.viewers.CheckboxTableViewer#addCheckStateListener()
The following examples show how to use
org.eclipse.jface.viewers.CheckboxTableViewer#addCheckStateListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PathsProvider.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
protected PathsProvider(TableViewer viewer, FindbugsPropertyPage propertyPage) { this.propertyPage = propertyPage; this.paths = new ArrayList<>(); this.viewer = viewer; if (viewer instanceof CheckboxTableViewer) { CheckboxTableViewer tv = (CheckboxTableViewer) viewer; tv.setCheckStateProvider(this); tv.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { boolean checked = event.getChecked(); IPathElement element = (IPathElement) event.getElement(); element.setEnabled(checked); handleContendChanged(); } }); } this.control = viewer.getTable(); listeners = new ListenerList(); viewer.setContentProvider(this); }
Example 2
Source File: TraceExplorerComposite.java From tlaplus with MIT License | 6 votes |
/** * This creates the table viewer. It should be called * within {@link TraceExplorerComposite#sectionInitialize(FormToolkit)}. * @param table * @return */ protected CheckboxTableViewer createTableViewer(Table table) { // create final CheckboxTableViewer tableViewer = new CheckboxTableViewer(table); // represent formulas in the view tableViewer.setContentProvider(new FormulaContentProvider()); // on changed selection change button enablement tableViewer.addSelectionChangedListener(m_formulaEnablementListener); // edit on double-click on a formula tableViewer.addDoubleClickListener((event) -> { doEdit(); }); // save the input when an element is checked or unchecked tableViewer.addCheckStateListener((event) -> { view.getModel().save(new NullProgressMonitor()); }); tableViewer.setInput(new Vector<Formula>()); return tableViewer; }
Example 3
Source File: CheckedCamelDependenciesPanel.java From tesb-studio-se with Apache License 2.0 | 6 votes |
@Override protected TableViewer createTableViewer() { final CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.setCheckStateProvider(checkStateProvider); viewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (((ManifestItem) event.getElement()).isBuiltIn()) { viewer.setChecked(event.getElement(), !event.getChecked()); } else { ((ManifestItem) event.getElement()).setOptional(!event.getChecked()); fireDependenciesChangedListener(); } } }); return viewer; }
Example 4
Source File: CheckedListDialogField.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected TableViewer createTableViewer(Composite parent) { Table table= new Table(parent, SWT.CHECK | getListStyle()); table.setFont(parent.getFont()); CheckboxTableViewer tableViewer= new CheckboxTableViewer(table); tableViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent e) { doCheckStateChanged(e); } }); return tableViewer; }
Example 5
Source File: ConfigureWorkingSetAssignementAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected CheckboxTableViewer createTableViewer(Composite parent) { final CheckboxTableViewer result= CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI); result.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { GrayedCheckedModelElement element= (GrayedCheckedModelElement)event.getElement(); result.setGrayed(element, false); if (event.getChecked()) { element.select(); } else { element.deselect(); } result.update(element, null); } }); GridData data= new GridData(GridData.FILL_BOTH); data.heightHint= convertHeightInCharsToPixels(20); data.widthHint= convertWidthInCharsToPixels(50); result.getTable().setLayoutData(data); result.addFilter(new Filter()); result.setLabelProvider(new GrayedCheckedModelLabelProvider()); result.setSorter(new GrayedCheckModelElementSorter()); result.setContentProvider(new GrayedCheckedModelContentProvider()); result.setInput(fModel); result.setCheckedElements(fModel.getChecked()); result.setGrayedElements(fModel.getGrayed()); return result; }
Example 6
Source File: FileSetEditDialog.java From eclipse-cs with GNU Lesser General Public License v2.1 | 4 votes |
private Control createFileMatchPatternPart(Composite parent) { Group composite = new Group(parent, SWT.NONE); composite.setText(Messages.FileSetEditDialog_titlePatternsTable); composite.setLayout(new FormLayout()); final Composite buttons = new Composite(composite, SWT.NULL); FormData fd = new FormData(); fd.top = new FormAttachment(0, 3); fd.right = new FormAttachment(100, -3); fd.bottom = new FormAttachment(100, -3); buttons.setLayoutData(fd); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; buttons.setLayout(layout); final Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(0, 3); fd.right = new FormAttachment(buttons, -3, SWT.LEFT); fd.bottom = new FormAttachment(100, -3); table.setLayoutData(fd); TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); table.setHeaderVisible(true); table.setLinesVisible(true); TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(Messages.FileSetEditDialog_colInclude); tableLayout.addColumnData(new ColumnWeightData(11)); TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(Messages.FileSetEditDialog_colRegex); tableLayout.addColumnData(new ColumnWeightData(89)); mPatternViewer = new CheckboxTableViewer(table); mPatternViewer.setLabelProvider(new FileMatchPatternLabelProvider()); mPatternViewer.setContentProvider(new ArrayContentProvider()); mPatternViewer.addDoubleClickListener(mController); mPatternViewer.addCheckStateListener(mController); // // Build the buttons. // mAddButton = createPushButton(buttons, Messages.FileSetEditDialog_btnAdd); mAddButton.addSelectionListener(mController); mEditButton = createPushButton(buttons, Messages.FileSetEditDialog_btnEdit); mEditButton.addSelectionListener(mController); mRemoveButton = createPushButton(buttons, Messages.FileSetEditDialog_btnRemove); mRemoveButton.addSelectionListener(mController); mUpButton = createPushButton(buttons, Messages.FileSetEditDialog_btnUp); mUpButton.addSelectionListener(mController); mDownButton = createPushButton(buttons, Messages.FileSetEditDialog_btnDown); mDownButton.addSelectionListener(mController); return composite; }
Example 7
Source File: ShowSummaryFieldDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
private void createSummaryFiledViewer( Composite dialogArea ) { Table table = new Table( dialogArea, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.CHECK ); table.setLinesVisible( true ); table.setHeaderVisible( true ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.heightHint = 250; table.setLayoutData( gd ); summaryFieldViewer = new CheckboxTableViewer( table ); SummaryFieldProvider provider = new SummaryFieldProvider( ); for ( int i = 0; i < columnNames.length; i++ ) { TableColumn column = new TableColumn( table, SWT.LEFT ); column.setText( columnNames[i] ); column.setWidth( columnWidth[i] ); } ComboBoxCellEditor comboCell = new ComboBoxCellEditor( table, new String[0], SWT.READ_ONLY ); // TextCellEditor textCell = new TextCellEditor(table, SWT.NONE); cellEditor = new CellEditor[]{ null, comboCell }; summaryFieldViewer.setColumnProperties( columnNames ); summaryFieldViewer.setCellEditors( cellEditor ); summaryFieldViewer.setCellModifier( cellModifier ); summaryFieldViewer.setUseHashlookup( true ); summaryFieldViewer.setContentProvider( provider ); summaryFieldViewer.setLabelProvider( provider ); summaryFieldViewer.addCheckStateListener( new ICheckStateListener( ) { public void checkStateChanged( CheckStateChangedEvent event ) { MeasureInfo info = (MeasureInfo) event.getElement( ); if ( event.getChecked( ) ) { info.setShow( true ); } else { info.setShow( false ); } checkOKButtonStatus( ); } } ); }
Example 8
Source File: MOOSETreePropertySection.java From ice with Eclipse Public License 1.0 | 4 votes |
/** * Adds the default and additional columns to the provided * <code>TableViewer</code>. This should only be invoked on * CheckboxTableViewers. */ @Override protected void addTableViewerColumns(TableViewer tableViewer) { if (tableViewer != null) { TableColumn column; ICellContentProvider contentProvider; // // ---- Create the placeholder CheckBox column. ---- // checkColumn = new TableViewerColumn(tableViewer, SWT.LEFT); column = checkColumn.getColumn(); column.setText("Enabled"); column.setToolTipText("If checked, the parameter will be written " + "to the input file.\n" + "If unchecked, the parameter " + "will be commented out in the input file."); column.setResizable(true); // Create the check state manager. It also functions as the cell // content provider for the first column. TableCheckStateManager checkStateManager = new TableCheckStateManager( tableViewer) { @Override public boolean setValue(Object element, Object value) { boolean changed = super.setValue(element, value); // If the value changed, mark the associated ICEFormEditor // as dirty. if (changed && getFormEditor() != null) { getFormEditor().setDirty(true); } return changed; } }; // Create a MOOSECheckStateProvider which sets the FormEditor as // dirty when the checkbox's value is changed. contentProvider = checkStateManager; // Add a blank label provider. Nothing should appear in the first // column except for the checkboxes. checkColumn.setLabelProvider( new CellColumnLabelProvider(contentProvider)); // Set the content provider and listener for the CheckBox column CheckboxTableViewer checkedTableViewer = (CheckboxTableViewer) tableViewer; checkedTableViewer.setCheckStateProvider(checkStateManager); checkedTableViewer.addCheckStateListener(checkStateManager); // Create the default columns. super.addTableViewerColumns(tableViewer); // ---- Create the description/comments column. ---- // descriptionColumn = new TableViewerColumn(tableViewer, SWT.LEFT); column = descriptionColumn.getColumn(); column.setText("Comments"); column.setToolTipText("Comments about the property. These are " + "stored as comments in the input file."); column.setResizable(true); // Create an ICellContentProvider for a column that shows the // descriptions of Entries. Then hook it up as a label provider and // for editing support. contentProvider = new DescriptionCellContentProvider() { @Override public boolean setValue(Object element, Object value) { boolean changed = super.setValue(element, value); // If the value changed, mark the associated ICEFormEditor // as dirty. if (changed && getFormEditor() != null) { getFormEditor().setDirty(true); } return changed; } }; descriptionColumn.setLabelProvider( new CellColumnLabelProvider(contentProvider)); descriptionColumn.setEditingSupport( new TextCellEditingSupport(tableViewer, contentProvider)); // ------------------------------------------------- // } return; }