use of org.eclipse.wb.swt.layout.grouplayout.GroupLayout in project core by jcryptool.
the class CommonPropertyDialog method createDialogArea.
/**
* Create contents of the dialog.
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(area, SWT.NONE);
TableColumnLayout tclComposite = new TableColumnLayout();
composite.setLayout(tclComposite);
TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL);
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
StructuredSelection selection = (StructuredSelection) event.getSelectionProvider().getSelection();
TableEntry tableEntry = (TableEntry) selection.getFirstElement();
final Clipboard cb = new Clipboard(Display.getCurrent());
cb.setContents(new Object[] { tableEntry.getValue() }, new Transfer[] { TextTransfer.getInstance() });
}
});
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableViewerColumn tableViewerNameColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewerNameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
TableEntry entry = (TableEntry) element;
return entry == null ? "" : entry.getName();
}
});
TableColumn tblclmnNameColumn = tableViewerNameColumn.getColumn();
tclComposite.setColumnData(tblclmnNameColumn, new ColumnWeightData(1, 2));
// $NON-NLS-1$
tblclmnNameColumn.setText(Messages.getString("AbstractKeyDialog.tblclmnNameColumn.text"));
TableViewerColumn tableViewerValueColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewerValueColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
TableEntry entry = (TableEntry) element;
return entry == null ? "" : entry.getValue();
}
});
TableColumn tblclmnValueColumn = tableViewerValueColumn.getColumn();
tclComposite.setColumnData(tblclmnValueColumn, new ColumnWeightData(2, 2));
// $NON-NLS-1$
tblclmnValueColumn.setText(Messages.getString("AbstractKeyDialog.tblclmnValueColumn.text"));
tableViewer.setContentProvider(getContentProvider());
tableViewer.setInput(treeNode);
Label lblTableLabel = new Label(area, SWT.NONE);
// $NON-NLS-1$
lblTableLabel.setText(Messages.getString("AbstractKeyDialog.lblTableLabel.text"));
GroupLayout glArea = new GroupLayout(area);
glArea.setHorizontalGroup(glArea.createParallelGroup(GroupLayout.LEADING).add(glArea.createSequentialGroup().addContainerGap().add(glArea.createParallelGroup(GroupLayout.LEADING).add(lblTableLabel).add(composite, GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE)).addContainerGap()));
glArea.setVerticalGroup(glArea.createParallelGroup(GroupLayout.LEADING).add(glArea.createSequentialGroup().addContainerGap().add(lblTableLabel).addPreferredGap(LayoutStyle.RELATED).add(composite, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE).addContainerGap()));
area.setLayout(glArea);
return area;
}
Aggregations