use of eu.esdihumboldt.hale.ui.function.generic.pages.internal.PropertyField in project hale by halestudio.
the class PropertyEntitiesPage method createHeader.
/**
* @see EntitiesPage#createHeader(Composite)
*/
@Override
protected Control createHeader(Composite parent) {
Group typeSelectionGroup = new Group(parent, SWT.NONE);
typeSelectionGroup.setText("Type");
typeSelectionGroup.setLayout(new GridLayout());
sourceTargetSelector = new SourceTargetTypeSelector(typeSelectionGroup);
sourceTargetSelector.getControl().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
// set initial selection
sourceTargetSelector.setSelection(getInitialTypeSelection(SchemaSpaceID.SOURCE), SchemaSpaceID.SOURCE);
sourceTargetSelector.setSelection(getInitialTypeSelection(SchemaSpaceID.TARGET), SchemaSpaceID.TARGET);
// add selection listener
sourceTargetSelector.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
TypeEntityDefinition selectedType = sourceTargetSelector.getSelection(SchemaSpaceID.SOURCE);
for (PropertyField field : getFunctionFields()) {
if (field.getSchemaSpace() == SchemaSpaceID.SOURCE) {
field.setParentType(selectedType);
}
}
}
}, SchemaSpaceID.SOURCE);
sourceTargetSelector.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
TypeEntityDefinition selectedType = sourceTargetSelector.getSelection(SchemaSpaceID.TARGET);
for (PropertyField field : getFunctionFields()) if (field.getSchemaSpace() == SchemaSpaceID.TARGET)
field.setParentType(selectedType);
}
}, SchemaSpaceID.TARGET);
return typeSelectionGroup;
}
Aggregations