Search in sources :

Example 6 with StyledDefinitionLabelProvider

use of eu.esdihumboldt.hale.ui.common.definition.viewer.StyledDefinitionLabelProvider in project hale by halestudio.

the class PropertyEntityDialog method setupViewer.

/**
 * @see EntityDialog#setupViewer(TreeViewer, EntityDefinition)
 */
@Override
protected void setupViewer(TreeViewer viewer, EntityDefinition initialSelection) {
    viewer.setLabelProvider(new StyledDefinitionLabelProvider(viewer));
    EntityDefinitionService entityDefinitionService = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
    if (parentType != null) {
        viewer.setContentProvider(new TreePathProviderAdapter(new EntityTypePropertyContentProvider(entityDefinitionService, ssid)));
        viewer.setInput(parentType);
    } else {
        flatRelevantProvider = new TreePathProviderAdapter(new EntityTypeIndexContentProvider(entityDefinitionService, ssid, true, false));
        hierarchicalRelevantProvider = new TreePathProviderAdapter(new EntityTypeIndexHierarchy(entityDefinitionService, ssid, true, false));
        flatAllProvider = new TreePathProviderAdapter(new EntityTypeIndexContentProvider(entityDefinitionService, ssid, false, false));
        hierarchicalAllProvider = new TreePathProviderAdapter(new EntityTypeIndexHierarchy(entityDefinitionService, ssid, false, false));
        viewer.setContentProvider(flatRelevantProvider);
        SchemaService ss = PlatformUI.getWorkbench().getService(SchemaService.class);
        viewer.setInput(ss.getSchemas(ssid));
    }
    if (initialSelection != null) {
        viewer.setSelection(new StructuredSelection(initialSelection));
    }
}
Also used : StyledDefinitionLabelProvider(eu.esdihumboldt.hale.ui.common.definition.viewer.StyledDefinitionLabelProvider) EntityTypeIndexHierarchy(eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexHierarchy) SchemaService(eu.esdihumboldt.hale.ui.service.schema.SchemaService) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EntityTypeIndexContentProvider(eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexContentProvider) EntityTypePropertyContentProvider(eu.esdihumboldt.hale.ui.service.entity.util.EntityTypePropertyContentProvider) TreePathProviderAdapter(eu.esdihumboldt.hale.ui.util.viewer.tree.TreePathProviderAdapter) EntityDefinitionService(eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)

Example 7 with StyledDefinitionLabelProvider

use of eu.esdihumboldt.hale.ui.common.definition.viewer.StyledDefinitionLabelProvider in project hale by halestudio.

the class TypeEntityDialog method setupViewer.

/**
 * @see EntityDialog#setupViewer(TreeViewer, EntityDefinition)
 */
@Override
protected void setupViewer(TreeViewer viewer, EntityDefinition initialSelection) {
    viewer.setLabelProvider(new StyledDefinitionLabelProvider(viewer));
    EntityDefinitionService entityDefinitionService = PlatformUI.getWorkbench().getService(EntityDefinitionService.class);
    flatRelevantProvider = new TreePathProviderAdapter(new EntityTypeIndexContentProvider(entityDefinitionService, ssid, true, true));
    if (!onlyMappingRelevant) {
        hierarchicalRelevantProvider = new TreePathProviderAdapter(new EntityTypeIndexHierarchy(entityDefinitionService, ssid, true, true));
        flatAllProvider = new TreePathProviderAdapter(new EntityTypeIndexContentProvider(entityDefinitionService, ssid, false, true));
        hierarchicalAllProvider = new TreePathProviderAdapter(new EntityTypeIndexHierarchy(entityDefinitionService, ssid, false, true));
        viewer.setContentProvider(flatAllProvider);
    } else {
        viewer.setContentProvider(flatRelevantProvider);
    }
    SchemaService ss = PlatformUI.getWorkbench().getService(SchemaService.class);
    viewer.setInput(ss.getSchemas(ssid));
    if (initialSelection instanceof TypeEntityDefinition) {
        viewer.setSelection(new StructuredSelection(initialSelection));
    }
}
Also used : TypeEntityDefinition(eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition) StyledDefinitionLabelProvider(eu.esdihumboldt.hale.ui.common.definition.viewer.StyledDefinitionLabelProvider) EntityTypeIndexHierarchy(eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexHierarchy) SchemaService(eu.esdihumboldt.hale.ui.service.schema.SchemaService) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) 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

StyledDefinitionLabelProvider (eu.esdihumboldt.hale.ui.common.definition.viewer.StyledDefinitionLabelProvider)7 Label (org.eclipse.swt.widgets.Label)5 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 TableViewer (org.eclipse.jface.viewers.TableViewer)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 EntityDefinitionService (eu.esdihumboldt.hale.ui.service.entity.EntityDefinitionService)2 EntityTypeIndexContentProvider (eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexContentProvider)2 EntityTypeIndexHierarchy (eu.esdihumboldt.hale.ui.service.entity.util.EntityTypeIndexHierarchy)2 SchemaService (eu.esdihumboldt.hale.ui.service.schema.SchemaService)2 TreePathProviderAdapter (eu.esdihumboldt.hale.ui.util.viewer.tree.TreePathProviderAdapter)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 Button (org.eclipse.swt.widgets.Button)2 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)1