use of eu.esdihumboldt.hale.common.align.model.condition.TypeCondition in project hale by halestudio.
the class TypeParameter method createConditions.
private static List<TypeCondition> createConditions(IConfigurationElement conf) {
List<TypeCondition> result = new ArrayList<TypeCondition>();
IConfigurationElement[] children = conf.getChildren();
if (children != null) {
for (IConfigurationElement child : children) {
String name = child.getName();
if (name.equals("typeCondition")) {
try {
TypeCondition condition = (TypeCondition) child.createExecutableExtension("class");
result.add(condition);
} catch (CoreException e) {
log.error("Error creating property condition from extension", e);
}
} else {
// ignore
// log.error("Unrecognized property condition");
}
}
}
return result;
}
use of eu.esdihumboldt.hale.common.align.model.condition.TypeCondition in project hale by halestudio.
the class TypeEntitySelector method createFilters.
private static ViewerFilter[] createFilters(TypeParameterDefinition field) {
if (field == null) {
return null;
}
List<TypeCondition> conditions = field.getConditions();
if (conditions == null)
return new ViewerFilter[0];
ViewerFilter[] filters = new ViewerFilter[conditions.size()];
int i = 0;
for (final TypeCondition condition : conditions) {
filters[i] = new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof TypeEntityDefinition) {
Type property = new DefaultType((TypeEntityDefinition) element);
return condition.accept(property);
} else
return false;
}
};
}
return filters;
}
Aggregations