Search in sources :

Example 1 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class TypeEntityDefinitionTester method test.

/**
 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
 *      java.lang.String, java.lang.Object[], java.lang.Object)
 */
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if (receiver == null)
        return false;
    if (property.equals(PROPERTY_TYPE_ALLOW_MARK_UNMAPPABLE) && receiver instanceof TypeEntityDefinition) {
        AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
        TypeEntityDefinition entityDef = (TypeEntityDefinition) receiver;
        return as.getAlignment().getCells(entityDef.getType(), entityDef.getSchemaSpace()).isEmpty();
    }
    return false;
}
Also used : TypeEntityDefinition(eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService)

Example 2 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService 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 3 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class TransformationView method dispose.

/**
 * @see WorkbenchPart#dispose()
 */
@Override
public void dispose() {
    if (alignmentListener != null) {
        AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
        as.removeListener(alignmentListener);
    }
    if (instanceSampleObserver != null) {
        InstanceSampleService iss = PlatformUI.getWorkbench().getService(InstanceSampleService.class);
        iss.deleteObserver(instanceSampleObserver);
    }
    super.dispose();
}
Also used : AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) InstanceSampleService(eu.esdihumboldt.hale.ui.service.instance.sample.InstanceSampleService)

Example 4 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class SetPriorityContribution method fill.

/**
 * @see AbstractFunctionWizardContribution#fill(Menu, int)
 */
@Override
public void fill(Menu menu, int index) {
    if (getOriginalCell() == null)
        return;
    AlignmentService alignmentService = PlatformUI.getWorkbench().getService(AlignmentService.class);
    Cell cell = getOriginalCell();
    Priority oldPriority = cell.getPriority();
    for (Priority priority : Priority.values()) {
        if (priority != oldPriority) {
            SetPriorityAction setPriorityAction = new SetPriorityAction(priority, cell.getId(), alignmentService);
            IContributionItem item = new ActionContributionItem(setPriorityAction);
            item.fill(menu, index++);
        }
    }
}
Also used : SetPriorityAction(eu.esdihumboldt.hale.ui.function.contribution.internal.SetPriorityAction) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) Priority(eu.esdihumboldt.hale.common.align.model.Priority) IContributionItem(org.eclipse.jface.action.IContributionItem) Cell(eu.esdihumboldt.hale.common.align.model.Cell)

Example 5 with AlignmentService

use of eu.esdihumboldt.hale.ui.service.align.AlignmentService in project hale by halestudio.

the class TypeCellSelectionDialog method setupViewer.

/**
 * @see eu.esdihumboldt.hale.ui.util.selector.AbstractViewerSelectionDialog#setupViewer(org.eclipse.jface.viewers.StructuredViewer,
 *      java.lang.Object)
 */
@Override
protected void setupViewer(final GraphViewer viewer, Cell initialSelection) {
    // content and label provider
    viewer.setContentProvider(new ReverseCellGraphContentProvider());
    viewer.setLabelProvider(new GraphLabelProvider(viewer, HaleUI.getServiceProvider()));
    // layout
    final TreeLayoutAlgorithm layout = new TreeLayoutAlgorithm(TreeLayoutAlgorithm.RIGHT_LEFT);
    viewer.getControl().addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            int width = viewer.getControl().getSize().x;
            layout.setNodeSpace(new Dimension((width - 10) / 3, 30));
        }
    });
    viewer.setLayoutAlgorithm(layout, true);
    viewer.applyLayout();
    // input and selection
    AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
    viewer.setInput(as.getAlignment().getTypeCells());
    if (initialSelection != null)
        viewer.setSelection(new StructuredSelection(initialSelection));
}
Also used : ControlAdapter(org.eclipse.swt.events.ControlAdapter) TreeLayoutAlgorithm(org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) GraphLabelProvider(eu.esdihumboldt.hale.ui.common.graph.labels.GraphLabelProvider) ReverseCellGraphContentProvider(eu.esdihumboldt.hale.ui.common.graph.content.ReverseCellGraphContentProvider) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Dimension(org.eclipse.draw2d.geometry.Dimension) ControlEvent(org.eclipse.swt.events.ControlEvent)

Aggregations

AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)43 Cell (eu.esdihumboldt.hale.common.align.model.Cell)16 Alignment (eu.esdihumboldt.hale.common.align.model.Alignment)11 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ArrayList (java.util.ArrayList)8 DefaultCell (eu.esdihumboldt.hale.common.align.model.impl.DefaultCell)6 ISelection (org.eclipse.jface.viewers.ISelection)6 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)5 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)5 AlignmentServiceAdapter (eu.esdihumboldt.hale.ui.service.align.AlignmentServiceAdapter)5 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)5 IContributionItem (org.eclipse.jface.action.IContributionItem)5 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)4 CompatibilityService (eu.esdihumboldt.hale.ui.common.service.compatibility.CompatibilityService)4 HashSet (java.util.HashSet)4 Display (org.eclipse.swt.widgets.Display)4 BaseAlignmentCell (eu.esdihumboldt.hale.common.align.model.BaseAlignmentCell)3 IAction (org.eclipse.jface.action.IAction)3 ControlAdapter (org.eclipse.swt.events.ControlAdapter)3 ControlEvent (org.eclipse.swt.events.ControlEvent)3