Search in sources :

Example 1 with EntityDefinitionService

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;
}
Also used : EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EntityDefinitionService(eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)

Example 2 with EntityDefinitionService

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;
}
Also used : Condition(eu.esdihumboldt.hale.common.align.model.Condition) EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EntityDefinitionService(eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)

Example 3 with EntityDefinitionService

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);
    }
}
Also used : AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) PopulationService(eu.esdihumboldt.hale.ui.common.service.population.PopulationService) GeometrySchemaService(eu.esdihumboldt.hale.ui.geometry.service.GeometrySchemaService) EntityDefinitionService(eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)

Example 4 with EntityDefinitionService

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);
        }
    }
}
Also used : Filter(eu.esdihumboldt.hale.common.instance.model.Filter) CQLException(org.geotools.filter.text.cql2.CQLException) FilterGeoCqlImpl(eu.esdihumboldt.hale.common.filter.FilterGeoCqlImpl) EntityDefinitionService(eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)

Example 5 with EntityDefinitionService

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;
}
Also used : EntityTypeIndexHierarchy(eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexHierarchy) EntityTypeIndexContentProvider(eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexContentProvider) TreePathProviderAdapter(eu.esdihumboldt.hale.ui.util.viewer.tree.TreePathProviderAdapter) EntityDefinitionService(eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)

Aggregations

EntityDefinitionService (eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)5 ISelection (org.eclipse.jface.viewers.ISelection)4 EntityTypeIndexContentProvider (eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexContentProvider)3 EntityTypeIndexHierarchy (eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexHierarchy)3 TreePathProviderAdapter (eu.esdihumboldt.hale.ui.util.viewer.tree.TreePathProviderAdapter)3 Condition (eu.esdihumboldt.hale.common.align.model.Condition)2 Filter (eu.esdihumboldt.hale.common.instance.model.Filter)2 StyledDefinitionLabelProvider (eu.esdihumboldt.hale.ui.common.definition.viewer.StyledDefinitionLabelProvider)2 SchemaService (eu.esdihumboldt.hale.ui.service.schema.SchemaService)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)1 FilterGeoCqlImpl (eu.esdihumboldt.hale.common.filter.FilterGeoCqlImpl)1 DefinitionComparator (eu.esdihumboldt.hale.ui.common.definition.viewer.DefinitionComparator)1 SchemaPatternFilter (eu.esdihumboldt.hale.ui.common.definition.viewer.SchemaPatternFilter)1 PopulationService (eu.esdihumboldt.hale.ui.common.service.population.PopulationService)1 FilterDialogDefinition (eu.esdihumboldt.hale.ui.filter.extension.FilterDialogDefinition)1 GeometrySchemaService (eu.esdihumboldt.hale.ui.geometry.service.GeometrySchemaService)1 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)1