use of eu.esdihumboldt.hale.common.align.extension.function.FunctionParameter in project hale by halestudio.
the class AbstractFunctionParameterSection method createControls.
/**
* @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite,
* org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
*/
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
Composite compparent = getWidgetFactory().createComposite(parent);
compparent.setLayout(new FormLayout());
Composite composite = getWidgetFactory().createComposite(compparent);
TableColumnLayout columnLayout = new TableColumnLayout();
composite.setLayout(columnLayout);
FormData data = new FormData();
data.width = 100;
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, -0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
data.bottom = new FormAttachment(100, -ITabbedPropertyConstants.VSPACE);
composite.setLayoutData(data);
tableViewer = new TableViewer(composite, SWT.FULL_SELECTION);
Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
TableViewerColumn nameviewercol = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn namecol = nameviewercol.getColumn();
columnLayout.setColumnData(namecol, new ColumnWeightData(20));
namecol.setText("Name");
nameviewercol.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
cell.setText(((FunctionParameter) cell.getElement()).getName());
}
});
TableViewerColumn lableviewercol = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn lablecol = lableviewercol.getColumn();
columnLayout.setColumnData(lablecol, new ColumnWeightData(20));
lablecol.setText("Label");
lableviewercol.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
cell.setText(((FunctionParameter) cell.getElement()).getDisplayName());
}
});
TableViewerColumn occurenceviewercol = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn occurencecol = occurenceviewercol.getColumn();
columnLayout.setColumnData(occurencecol, new ColumnWeightData(10));
occurencecol.setText("Occurence");
occurenceviewercol.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
FunctionParameter cellparameter = ((FunctionParameter) cell.getElement());
cell.setText(String.valueOf(cellparameter.getMinOccurrence()) + ".." + (String.valueOf(cellparameter.getMaxOccurrence())));
}
});
TableViewerColumn descriptionviewercol = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn descriptioncol = descriptionviewercol.getColumn();
columnLayout.setColumnData(descriptioncol, new ColumnWeightData(40));
descriptioncol.setText("Description");
descriptionviewercol.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
cell.setText(String.valueOf(((FunctionParameter) cell.getElement()).getDescription()));
}
});
}
Aggregations