Search in sources :

Example 1 with FunctionParameter

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()));
        }
    });
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) TableColumn(org.eclipse.swt.widgets.TableColumn) ViewerCell(org.eclipse.jface.viewers.ViewerCell) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) TableViewer(org.eclipse.jface.viewers.TableViewer) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) CellLabelProvider(org.eclipse.jface.viewers.CellLabelProvider) FunctionParameter(eu.esdihumboldt.hale.common.align.extension.function.FunctionParameter)

Aggregations

FunctionParameter (eu.esdihumboldt.hale.common.align.extension.function.FunctionParameter)1 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)1 CellLabelProvider (org.eclipse.jface.viewers.CellLabelProvider)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)1 ViewerCell (org.eclipse.jface.viewers.ViewerCell)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Table (org.eclipse.swt.widgets.Table)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1