use of eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService in project hale by halestudio.
the class AddIndexContextHandler method execute.
/**
* @see IHandler#execute(ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection) selection).getFirstElement();
if (element instanceof EntityDefinition) {
EntityDefinitionService eds = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
// TODO configure index
eds.addIndexContext((EntityDefinition) element, null);
}
}
return null;
}
use of eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService in project hale by halestudio.
the class PurgeConditionContextHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection) selection).getFirstElement();
if (element instanceof EntityDefinition) {
EntityDefinition entityDef = (EntityDefinition) element;
Condition condition = AlignmentUtil.getContextCondition(entityDef);
if (condition != null && condition.getFilter() != null) {
EntityDefinitionService eds = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
eds.editConditionContext((EntityDefinition) element, null);
}
}
}
return null;
}
use of eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService in project hale by halestudio.
the class ServiceSchemaExplorer method dispose.
/**
* Remove all service listeners.
*/
public void dispose() {
if (schemaListener != null) {
schemaService.removeSchemaServiceListener(schemaListener);
}
if (alignmentListener != null) {
AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
as.removeListener(alignmentListener);
}
if (entityListener != null) {
EntityDefinitionService eds = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
eds.removeListener(entityListener);
}
if (geometryListener != null) {
GeometrySchemaService gss = PlatformUI.getWorkbench().getService(GeometrySchemaService.class);
gss.removeListener(geometryListener);
}
if (populationListener != null) {
PopulationService ps = PlatformUI.getWorkbench().getService(PopulationService.class);
ps.removeListener(populationListener);
}
}
use of eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService in project hale by halestudio.
the class AddConditionAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
EntityDefinitionService eds = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
// create filter
if (combine) {
StringBuilder filterTerm = new StringBuilder();
boolean first = true;
for (String value : values) {
if (first) {
first = false;
} else {
filterTerm.append(" or ");
}
addSingleValueExpression(filterTerm, value);
}
Filter filter;
try {
filter = new FilterGeoCqlImpl(filterTerm.toString());
} catch (CQLException e) {
log.userError("Error creating condition", e);
return;
}
// add condition context
eds.addConditionContext(getContextEntity(), filter);
} else {
for (String value : values) {
StringBuilder filterTerm = new StringBuilder();
addSingleValueExpression(filterTerm, value);
Filter filter;
try {
filter = new FilterGeoCqlImpl(filterTerm.toString());
} catch (CQLException e) {
log.userError("Error creating condition", e);
return;
}
// add condition context
eds.addConditionContext(getContextEntity(), filter);
}
}
}
use of eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService in project hale by halestudio.
the class EntitySchemaExplorer method createContentProvider.
/**
* @see SchemaExplorer#createContentProvider(TreeViewer)
*/
@Override
protected IContentProvider createContentProvider(TreeViewer tree) {
EntityDefinitionService service = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
hierarchyProvider = new TreePathProviderAdapter(new EntityTypeIndexHierarchy(service, getSchemaSpace()));
listProvider = new TreePathProviderAdapter(new EntityTypeIndexContentProvider(service, getSchemaSpace()));
return listProvider;
}
Aggregations