use of org.eclipse.jface.viewers.CheckboxTableViewer in project linuxtools by eclipse.
the class ImageRunSelectionPage method createPortSettingsTable.
private CheckboxTableViewer createPortSettingsTable(final Composite container) {
final Table table = new Table(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.CHECK);
final CheckboxTableViewer tableViewer = new CheckboxTableViewer(table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
createTableViewerColum(tableViewer, WizardMessages.getString(// $NON-NLS-1$
"ImageRunSelectionPage.containerPortColumn"), 100);
createTableViewerColum(tableViewer, // $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.typeColumn"), 50);
createTableViewerColum(tableViewer, WizardMessages.getString(// $NON-NLS-1$
"ImageRunSelectionPage.hostAddressColumn"), 100);
createTableViewerColum(tableViewer, WizardMessages.getString(// $NON-NLS-1$
"ImageRunSelectionPage.hostPortColumn"), 100);
tableViewer.setContentProvider(new ObservableListContentProvider());
return tableViewer;
}
use of org.eclipse.jface.viewers.CheckboxTableViewer in project linuxtools by eclipse.
the class ImageRunSelectionPage method createPortSettingsSection.
private void createPortSettingsSection(final Composite container) {
final Button publishAllPortsButton = new Button(container, SWT.CHECK);
publishAllPortsButton.setText(WizardMessages.getString(// $NON-NLS-1$
"ImageRunSelectionPage.publishAllPorts"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS, 1).grab(true, false).applyTo(publishAllPortsButton);
dbc.bindValue(WidgetProperties.selection().observe(publishAllPortsButton), BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.PUBLISH_ALL_PORTS).observe(model));
// specify ports
final Label portSettingsLabel = new Label(container, SWT.NONE);
portSettingsLabel.setText(// $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.portSettings"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(COLUMNS, 1).indent(INDENT, 0).applyTo(portSettingsLabel);
final CheckboxTableViewer exposedPortsTableViewer = createPortSettingsTable(container);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).span(COLUMNS - 1, 1).indent(INDENT, 0).hint(200, 70).applyTo(exposedPortsTableViewer.getTable());
// buttons
final Composite buttonsContainers = new Composite(container, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(false, false).applyTo(buttonsContainers);
GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(SWT.DEFAULT, 0).applyTo(buttonsContainers);
final Button addButton = new Button(buttonsContainers, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(addButton);
addButton.setText(WizardMessages.getString(// $NON-NLS-1$
"ImageRunSelectionPage.addButton"));
addButton.addSelectionListener(onAddPort(exposedPortsTableViewer));
final Button editButton = new Button(buttonsContainers, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(editButton);
editButton.setText(// $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.editButton"));
editButton.setEnabled(false);
editButton.addSelectionListener(onEditPort(exposedPortsTableViewer));
final Button removeButton = new Button(buttonsContainers, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(removeButton);
removeButton.setText(// $NON-NLS-1$
WizardMessages.getString("ImageRunSelectionPage.remove"));
removeButton.addSelectionListener(onRemovePorts(exposedPortsTableViewer));
BeanProperties.value(ImageRunSelectionModel.class, ImageRunSelectionModel.PUBLISH_ALL_PORTS).observe(model).addValueChangeListener(onPublishAllPortsChange(exposedPortsTableViewer.getTable(), addButton, removeButton));
ViewerSupport.bind(exposedPortsTableViewer, model.getExposedPorts(), BeanProperties.values(ExposedPortModel.class, ExposedPortModel.CONTAINER_PORT, ExposedPortModel.PORT_TYPE, ExposedPortModel.HOST_ADDRESS, ExposedPortModel.HOST_PORT));
dbc.bindSet(ViewersObservables.observeCheckedElements(exposedPortsTableViewer, ExposedPortModel.class), BeanProperties.set(ImageRunSelectionModel.SELECTED_PORTS).observe(model));
checkAllElements(exposedPortsTableViewer);
// disable the edit and removeButton if the table is empty
exposedPortsTableViewer.addSelectionChangedListener(onSelectionChanged(editButton, removeButton));
togglePortMappingControls(exposedPortsTableViewer.getTable(), addButton, removeButton);
}
use of org.eclipse.jface.viewers.CheckboxTableViewer in project erlide_eclipse by erlang.
the class CheckedListDialogField method createTableViewer.
/*
* @see ListDialogField#createTableViewer
*/
@Override
protected TableViewer createTableViewer(final Composite parent) {
final Table table = new Table(parent, SWT.CHECK + getListStyle());
final CheckboxTableViewer tableViewer = new CheckboxTableViewer(table);
tableViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(final CheckStateChangedEvent e) {
doCheckStateChanged(e);
}
});
return tableViewer;
}
use of org.eclipse.jface.viewers.CheckboxTableViewer in project erlide_eclipse by erlang.
the class LiveExpressionsView method createPartControl.
/**
* This is a callback that will allow us to create the viewer and initialize it.
*/
@Override
public void createPartControl(final Composite parent) {
label = new Label(parent, SWT.NULL);
final Table t = new Table(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.CHECK);
viewer = new CheckboxTableViewer(t);
final GridData labelLData = new GridData();
labelLData.verticalAlignment = GridData.BEGINNING;
labelLData.horizontalAlignment = GridData.FILL;
labelLData.widthHint = 300;
labelLData.heightHint = 14;
labelLData.horizontalIndent = 0;
labelLData.horizontalSpan = 1;
labelLData.verticalSpan = 1;
labelLData.grabExcessHorizontalSpace = true;
labelLData.grabExcessVerticalSpace = false;
label.setLayoutData(labelLData);
label.setSize(new org.eclipse.swt.graphics.Point(319, 14));
final GridData viewerLData = new GridData();
viewerLData.verticalAlignment = GridData.FILL;
viewerLData.horizontalAlignment = GridData.FILL;
viewerLData.widthHint = 600;
viewerLData.heightHint = 150;
viewerLData.horizontalIndent = 0;
viewerLData.horizontalSpan = 1;
viewerLData.verticalSpan = 1;
viewerLData.grabExcessHorizontalSpace = true;
viewerLData.grabExcessVerticalSpace = true;
t.setLayoutData(viewerLData);
t.setSize(new org.eclipse.swt.graphics.Point(600, 200));
final GridLayout thisLayout = new GridLayout(1, true);
parent.setLayout(thisLayout);
thisLayout.marginWidth = 5;
thisLayout.marginHeight = 5;
thisLayout.numColumns = 1;
thisLayout.makeColumnsEqualWidth = false;
thisLayout.horizontalSpacing = 0;
thisLayout.verticalSpacing = 1;
t.setLinesVisible(true);
t.setHeaderVisible(true);
// t.setFont();
final TableColumn colExpr = new TableColumn(t, SWT.LEAD, 0);
colExpr.setText("Expression");
colExpr.setWidth(150);
final TableColumn colValue = new TableColumn(t, SWT.LEAD, 1);
colValue.setText("Value");
colValue.setWidth(t.getSize().x - 50);
viewer.setColumnProperties(new String[] { "expr", "val" });
viewer.setContentProvider(new ViewContentProvider());
viewer.setLabelProvider(new ViewLabelProvider());
if (!restoreState()) {
/* Fill LiveExpressions for first time */
exprs = new ArrayList<>(10);
addExpr(new LiveExpr(backend, "erlide_time_compat:timestamp()"));
}
viewer.setInput(exprs);
final TextCellEditor e = new TextCellEditor(t);
viewer.setCellEditors(new CellEditor[] { e, null });
viewer.setCellModifier(new LiveExprCellModifier(this));
makeActions();
hookContextMenu();
contributeToActionBars();
hookGlobalActions();
final Listener tableListener = new ListenerImplementation(t);
t.addListener(SWT.Dispose, tableListener);
t.addListener(SWT.KeyDown, tableListener);
t.addListener(SWT.MouseMove, tableListener);
t.addListener(SWT.MouseHover, tableListener);
// /////////////
}
use of org.eclipse.jface.viewers.CheckboxTableViewer in project tmdm-studio-se by Talend.
the class SelectImportedModulesDialog method createTableViewer.
CheckboxTableViewer createTableViewer(Composite parent, String columnName, IContentProvider contentProvider, ILabelProvider lableProvider) {
Composite com = new Composite(parent, SWT.NONE);
com.setLayout(new GridLayout(1, false));
final CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(com, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK | SWT.BORDER);
viewer.setCheckStateProvider(new ICheckStateProvider() {
public boolean isChecked(Object element) {
return true;
}
public boolean isGrayed(Object element) {
return false;
}
});
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl());
viewer.getTable().setLinesVisible(true);
viewer.setContentProvider(contentProvider);
viewer.getTable().setHeaderVisible(true);
TableLayout lay = new TableLayout();
TableColumn column = new TableColumn(viewer.getTable(), SWT.CENTER);
column.setText(columnName);
lay.addColumnData(new ColumnWeightData(200, 100));
viewer.getTable().setLayout(lay);
viewer.setLabelProvider(lableProvider);
ToolBar toolBar = new ToolBar(com, SWT.HORIZONTAL | SWT.FLAT);
createToolBarItem(toolBar, Messages.RepositoryCheckTreeViewer_SelectAll, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
viewer.setAllChecked(true);
}
});
createToolBarItem(toolBar, Messages.RepositoryCheckTreeViewer_DeselectAll, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
viewer.setAllChecked(false);
}
});
return viewer;
}
Aggregations