use of org.eclipse.jface.viewers.TableViewerColumn in project linuxtools by eclipse.
the class RunImagePortsTab method createTableViewerColumn.
private TableViewerColumn createTableViewerColumn(final TableViewer tableViewer, final String title, final int width) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
if (title != null) {
column.setText(title);
}
column.setWidth(width);
return viewerColumn;
}
use of org.eclipse.jface.viewers.TableViewerColumn in project linuxtools by eclipse.
the class RunImageVolumesTab method addTableViewerColumn.
private TableViewerColumn addTableViewerColumn(final TableViewer tableViewer, final String title, final int width) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
if (title != null) {
column.setText(title);
}
column.setWidth(width);
return viewerColumn;
}
use of org.eclipse.jface.viewers.TableViewerColumn in project linuxtools by eclipse.
the class VagrantBoxView method createTableViewer.
private void createTableViewer(final Composite container) {
search = new Text(container, SWT.SEARCH | SWT.ICON_SEARCH);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(search);
search.addModifyListener(onSearch());
Composite tableArea = new Composite(container, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).applyTo(tableArea);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tableArea);
final TableColumnLayout tableLayout = new TableColumnLayout();
tableArea.setLayout(tableLayout);
this.viewer = new TableViewer(tableArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
this.viewer.setContentProvider(new VagrantBoxContentProvider());
final Table table = viewer.getTable();
GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).applyTo(table);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(table);
table.setLinesVisible(true);
table.setHeaderVisible(true);
// 'NAME' column
final TableViewerColumn idColumn = createColumn(DVMessages.getString(// $NON-NLS-1$
"NAME"));
setLayout(idColumn, tableLayout, 150);
idColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(final Object element) {
if (element instanceof IVagrantBox) {
return ((IVagrantBox) element).getName();
}
return super.getText(element);
}
});
// 'PROVIDER' column
final TableViewerColumn tagsColumn = createColumn(DVMessages.getString(// $NON-NLS-1$
"PROVIDER"));
setLayout(tagsColumn, tableLayout, 150);
tagsColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(final Object element) {
if (element instanceof IVagrantBox) {
return ((IVagrantBox) element).getProvider();
}
return super.getText(element);
}
});
// 'VERSION' column
final TableViewerColumn creationDateColumn = createColumn(DVMessages.getString(// $NON-NLS-1$
"VERSION"));
setLayout(creationDateColumn, tableLayout, 150);
creationDateColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(final Object element) {
if (element instanceof IVagrantBox) {
return ((IVagrantBox) element).getVersion().toString();
}
return super.getText(element);
}
});
// comparator
final VagrantBoxComparator comparator = new VagrantBoxComparator(this.viewer);
viewer.setComparator(comparator);
// apply search filter
this.viewer.addFilter(getImagesFilter());
setConnection(VagrantService.getInstance());
connection.addBoxListener(this);
// get the current selection in the tableviewer
getSite().setSelectionProvider(viewer);
}
use of org.eclipse.jface.viewers.TableViewerColumn in project linuxtools by eclipse.
the class MassifViewPart method createPartControl.
@Override
public void createPartControl(Composite parent) {
chartInputs = new ArrayList<>();
top = new Composite(parent, SWT.NONE);
stackLayout = new StackLayout();
top.setLayout(stackLayout);
top.setLayoutData(new GridData(GridData.FILL_BOTH));
viewer = new TableViewer(top, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
Table table = viewer.getTable();
table.setLayoutData(new GridData(GridData.FILL_BOTH));
String[] columnTitles = { TITLE_NUMBER, TITLE_TIME, TITLE_TOTAL, TITLE_USEFUL, TITLE_EXTRA, TITLE_STACKS };
for (int i = 0; i < columnTitles.length; i++) {
TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
column.getColumn().setText(columnTitles[i]);
column.getColumn().setWidth(COLUMN_SIZE);
column.getColumn().setResizable(true);
column.getColumn().addSelectionListener(getHeaderListener());
}
table.setHeaderVisible(true);
table.setLinesVisible(true);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new MassifLabelProvider());
treeViewer = new MassifTreeViewer(top);
treeViewer.getViewer().getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
viewer.addDoubleClickListener(event -> {
MassifSnapshot snapshot = (MassifSnapshot) ((IStructuredSelection) event.getSelection()).getFirstElement();
if (snapshot.getType() != SnapshotType.EMPTY) {
treeAction.setChecked(true);
setTopControl(treeViewer.getViewer().getControl());
treeViewer.getViewer().setSelection(new StructuredSelection(snapshot.getRoot()), true);
treeViewer.getViewer().expandToLevel(snapshot.getRoot(), AbstractTreeViewer.ALL_LEVELS);
}
});
stackLayout.topControl = viewer.getControl();
top.layout();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project linuxtools by eclipse.
the class ImageRunResourceVolumesVariablesPage method addTableViewerColum.
private TableViewerColumn addTableViewerColum(final TableViewer tableViewer, final String title, final int width) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
if (title != null) {
column.setText(title);
}
column.setWidth(width);
return viewerColumn;
}
Aggregations