use of org.eclipse.jface.viewers.ColumnWeightData in project linuxtools by eclipse.
the class DockerRegistryAccountPreferencePage method createContents.
/**
* @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite page = createComposite(parent, 1, 2, false, null, -1, -1, GridData.FILL);
GridData gd = (GridData) page.getLayoutData();
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
// SystemWidgetHelpers.createLabel(page,
// SystemResources.RESID_PREF_SIGNON_DESCRIPTION, 2);
// Password table
pwdTable = new Table(page, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
pwdTable.setLinesVisible(true);
pwdTable.setHeaderVisible(true);
pwdTable.addListener(SWT.Selection, this);
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnWeightData(100, true));
tableLayout.addColumnData(new ColumnWeightData(100, true));
tableLayout.addColumnData(new ColumnWeightData(100, true));
pwdTable.setLayout(tableLayout);
gd = new GridData(GridData.FILL_BOTH);
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
pwdTable.setLayoutData(gd);
// Server Address column
TableColumn hostnameColumn = new TableColumn(pwdTable, SWT.NONE);
hostnameColumn.setText("Server Address");
// Username column
TableColumn sysTypeColumn = new TableColumn(pwdTable, SWT.NONE);
sysTypeColumn.setText("Username");
// Email column
TableColumn useridColumn = new TableColumn(pwdTable, SWT.NONE);
useridColumn.setText("Email");
pwdTableViewer = new TableViewer(pwdTable);
pwdTableViewer.setContentProvider(provider);
pwdTableViewer.setLabelProvider(provider);
pwdTableViewer.setInput(passwords);
// Create the Button bar for add, change and remove
Composite buttonBar = createComposite(page, 1, 1, false, null, -1, -1, GridData.FILL);
gd = (GridData) buttonBar.getLayoutData();
gd.grabExcessHorizontalSpace = false;
gd.grabExcessVerticalSpace = true;
addButton = createPushButton(buttonBar, this, "Add", "Add a new Docker registry account.");
changeButton = createPushButton(buttonBar, this, "Edit", "Edit an existing Docker registry account.");
removeButton = createPushButton(buttonBar, this, "Remove", "Remove an existing Docker registry account.");
changeButton.setEnabled(false);
removeButton.setEnabled(false);
return parent;
}
use of org.eclipse.jface.viewers.ColumnWeightData in project eclipse-pmd by acanda.
the class AddRuleSetConfigurationWizardPage method createControl.
@Override
public void createControl(final Composite parent) {
final Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new GridLayout(3, false));
final Label lblLocation = new Label(container, SWT.NONE);
lblLocation.setText("Location:");
location = new Text(container, SWT.BORDER);
location.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
SWTBotID.set(location, SWTBotID.LOCATION);
browse = new Button(container, SWT.NONE);
browse.setText("Browse...");
SWTBotID.set(browse, SWTBotID.BROWSE);
browse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
controller.browse(((Control) e.widget).getShell());
}
});
final Label lblName = new Label(container, SWT.NONE);
lblName.setText("Name:");
name = new Text(container, SWT.BORDER);
name.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
SWTBotID.set(name, SWTBotID.NAME);
// This button is only here to make this row the same height as the previous row.
// Without this button the distance between the text of this row and the text of
// the previous row is much larger than the distance between the text of this row
// and the table of the next row.
final Button button = new Button(container, SWT.NONE);
button.setEnabled(false);
button.setVisible(false);
final Label lblRules = new Label(container, SWT.NONE);
final GridData lblRulesGridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
lblRulesGridData.verticalIndent = 3;
lblRules.setLayoutData(lblRulesGridData);
lblRules.setText("Rules:");
final Composite tableComposite = new Composite(container, SWT.NONE);
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final TableColumnLayout tableCompositeTableColumnLayout = new TableColumnLayout();
tableComposite.setLayout(tableCompositeTableColumnLayout);
tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
final Table table = tableViewer.getTable();
table.setLinesVisible(true);
SWTBotID.set(table, SWTBotID.RULES);
final TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
final TableColumn tblclmnName = tableViewerColumn.getColumn();
tableCompositeTableColumnLayout.setColumnData(tblclmnName, new ColumnWeightData(1, 200, false));
tblclmnName.setText("Name");
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
initDataBindings();
}
use of org.eclipse.jface.viewers.ColumnWeightData in project yamcs-studio by yamcs.
the class CommandQueuedTableViewer method addFixedColumns.
private void addFixedColumns(TableColumnLayout tcl) {
TableViewerColumn nameColumn = new TableViewerColumn(this, SWT.NONE);
nameColumn.getColumn().setText(COL_QUEUE);
nameColumn.getColumn().setToolTipText("The queue which contains the command");
tcl.setColumnData(nameColumn.getColumn(), new ColumnWeightData(200));
TableViewerColumn userColumn = new TableViewerColumn(this, SWT.NONE);
userColumn.getColumn().setText(COL_USER);
userColumn.getColumn().setToolTipText("The user who submitted the command");
tcl.setColumnData(userColumn.getColumn(), new ColumnWeightData(200));
TableViewerColumn stringColumn = new TableViewerColumn(this, SWT.CENTER);
stringColumn.getColumn().setText(COL_STRING);
stringColumn.getColumn().setToolTipText("Command source code");
tcl.setColumnData(stringColumn.getColumn(), new ColumnWeightData(200));
TableViewerColumn timeColumn = new TableViewerColumn(this, SWT.LEFT);
timeColumn.getColumn().setText(COL_TIME);
timeColumn.getColumn().setToolTipText("Time");
tcl.setColumnData(timeColumn.getColumn(), new ColumnWeightData(200));
// Common properties to all columns
List<TableViewerColumn> columns = new ArrayList<>();
columns.add(nameColumn);
columns.add(userColumn);
columns.add(stringColumn);
columns.add(timeColumn);
for (TableViewerColumn column : columns) {
// prevent resize to 0
column.getColumn().addControlListener(new ControlListener() {
@Override
public void controlMoved(ControlEvent e) {
}
@Override
public void controlResized(ControlEvent e) {
if (column.getColumn().getWidth() < 5)
column.getColumn().setWidth(5);
}
});
}
}
use of org.eclipse.jface.viewers.ColumnWeightData in project yamcs-studio by yamcs.
the class ArgumentTableViewer method addFixedColumns.
private void addFixedColumns(TableColumnLayout tcl) {
TableViewerColumn nameColumn = new TableViewerColumn(this, SWT.NONE);
nameColumn.getColumn().setText(COL_NAME);
nameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
TelecommandArgument argument = (TelecommandArgument) element;
return argument.getName();
}
});
tcl.setColumnData(nameColumn.getColumn(), new ColumnWeightData(200));
TableViewerColumn valueColumn = new TableViewerColumn(this, SWT.NONE);
valueColumn.getColumn().setText(COL_VALUE);
valueColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
TelecommandArgument argument = (TelecommandArgument) element;
return argument.getValue();
}
});
tcl.setColumnData(valueColumn.getColumn(), new ColumnWeightData(200));
}
use of org.eclipse.jface.viewers.ColumnWeightData in project yamcs-studio by yamcs.
the class ConnectionsDialog method createServerPanel.
private Composite createServerPanel(Composite parent, ResourceManager resourceManager) {
Composite serverPanel = new Composite(parent, SWT.NONE);
GridData gd = new GridData(GridData.FILL_BOTH);
serverPanel.setLayoutData(gd);
TableColumnLayout tcl = new TableColumnLayout();
serverPanel.setLayout(tcl);
Image serverImage = resourceManager.createImage(RCPUtils.getImageDescriptor(ConnectionsDialog.class, "icons/obj16/server.gif"));
connViewer = new TableViewer(serverPanel, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
connViewer.getTable().setHeaderVisible(true);
connViewer.getTable().setLinesVisible(false);
TableViewerColumn nameColumn = new TableViewerColumn(connViewer, SWT.NONE);
nameColumn.getColumn().setText("Connection Name");
nameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return serverImage;
}
@Override
public String getText(Object element) {
YamcsConfiguration conf = (YamcsConfiguration) element;
return conf.getName();
}
});
tcl.setColumnData(nameColumn.getColumn(), new ColumnWeightData(400));
connViewer.setContentProvider(new ArrayContentProvider());
connViewer.addSelectionChangedListener(evt -> {
IStructuredSelection sel = (IStructuredSelection) evt.getSelection();
if (sel.getFirstElement() != null) {
YamcsConfiguration conf = (YamcsConfiguration) sel.getFirstElement();
yamcsInstanceText.setText(forceString(conf.getInstance()));
yamcsUserText.setText(forceString(conf.getUser()));
yamcsPasswordText.setText(forceString(conf.getPassword()));
savePasswordButton.setSelection(conf.isSavePassword());
yamcsPrimaryHostText.setText(forceString(conf.getPrimaryHost()));
yamcsPrimaryPortText.setText(forceString(conf.getPrimaryPort()));
yamcsFailoverHostText.setText(forceString(conf.getFailoverHost()));
yamcsFailoverPortText.setText(forceString(conf.getFailoverPort()));
nameText.setText(forceString(conf.getName()));
updateState();
}
});
connViewer.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object o1, Object o2) {
YamcsConfiguration c1 = (YamcsConfiguration) o1;
YamcsConfiguration c2 = (YamcsConfiguration) o2;
if (c1.getName() != null && c2.getName() != null)
return c1.getName().compareTo(c2.getName());
else
return 0;
}
});
return serverPanel;
}
Aggregations