use of org.eclipse.jface.viewers.ICheckStateProvider in project bndtools by bndtools.
the class ProjectListControl method createTableLayout.
private void createTableLayout(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// Add TableColumnLayout
TableColumnLayout layout = new TableColumnLayout();
composite.setLayout(layout);
// Instantiate TableViewer
projects = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
projects.setHeaderVisible(true);
projects.setLinesVisible(true);
projects.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
selectionListener.widgetSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
selectionListener.widgetDefaultSelected(e);
}
});
tableViewer = new CheckboxTableViewer(projects);
tableViewer.setUseHashlookup(true);
// Project
TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
TableColumn tableCol = tableViewerColumn.getColumn();
layout.setColumnData(tableCol, new ColumnWeightData(60, 100, true));
tableCol.setText(Messages.project1);
// Repository
tableViewerColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
tableCol = tableViewerColumn.getColumn();
layout.setColumnData(tableCol, new ColumnWeightData(26, 80, true));
tableCol.setText(Messages.repository);
tableViewerColumn.setEditingSupport(new InlineComboEditingSupport(tableViewer));
// Bundles
tableViewerColumn = new TableViewerColumn(tableViewer, SWT.CENTER);
tableCol = tableViewerColumn.getColumn();
layout.setColumnData(tableCol, new ColumnWeightData(14, 35, true));
tableCol.setText(Messages.bundles);
contentProvider = new ContentProvider();
tableViewer.setContentProvider(contentProvider);
tableViewer.setLabelProvider(new TableLabelProvider());
tableViewer.setColumnProperties(columnNames);
tableViewer.setCheckStateProvider(new ICheckStateProvider() {
public boolean isGrayed(Object element) {
return false;
}
public boolean isChecked(Object element) {
ProjectDiff diff = (ProjectDiff) element;
return diff.isRelease();
}
});
projects.pack();
TableSortingEnabler.applyTableColumnSorting(tableViewer);
}
use of org.eclipse.jface.viewers.ICheckStateProvider in project dbeaver by serge-rider.
the class DiagramCreateWizardPage method createControl.
@Override
public void createControl(Composite parent) {
Composite placeholder = UIUtils.createPlaceholder(parent, 1);
Composite configGroup = UIUtils.createControlGroup(placeholder, ERDMessages.wizard_page_diagram_create_group_settings, 2, GridData.FILL_BOTH, 0);
//$NON-NLS-1$
final Text projectNameText = UIUtils.createLabelText(configGroup, "Name", null);
projectNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
diagram.setName(projectNameText.getText());
updateState();
}
});
Label contentLabel = UIUtils.createControlLabel(configGroup, ERDMessages.wizard_page_diagram_create_label_init_content);
GridData gd = new GridData(GridData.BEGINNING);
gd.horizontalSpan = 2;
contentLabel.setLayoutData(gd);
final DBNProject rootNode = DBeaverCore.getInstance().getNavigatorModel().getRoot().getProject(DBeaverCore.getInstance().getProjectRegistry().getActiveProject());
if (rootNode == null) {
setControl(placeholder);
return;
}
contentTree = new DatabaseNavigatorTree(configGroup, rootNode.getDatabases(), SWT.SINGLE | SWT.CHECK);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
gd.heightHint = 400;
contentTree.setLayoutData(gd);
CheckboxTreeViewer viewer = (CheckboxTreeViewer) contentTree.getViewer();
viewer.setCheckStateProvider(new ICheckStateProvider() {
@Override
public boolean isChecked(Object element) {
return false;
}
@Override
public boolean isGrayed(Object element) {
if (element instanceof DBNDatabaseNode && !(element instanceof DBNDataSource)) {
DBSObject object = ((DBNDatabaseNode) element).getObject();
if (object instanceof DBSTable) {
return false;
}
}
return true;
}
});
setControl(placeholder);
}
Aggregations