use of eu.esdihumboldt.hale.ui.service.entity.util.ContentProviderAction in project hale by halestudio.
the class PropertyEntityDialog method addToolBarActions.
/**
* @see eu.esdihumboldt.hale.ui.function.common.EntityDialog#addToolBarActions(org.eclipse.jface.action.ToolBarManager)
*/
@Override
protected void addToolBarActions(ToolBarManager manager) {
// parent type is set, so do not offer other content providers
if (parentType != null)
return;
// MappingRelevant types only, flat
manager.add(new ContentProviderAction("Mapping relevant types as list", HALEUIPlugin.getImageDescriptor("icons/flat_relevant.png"), getViewer(), flatRelevantProvider, true));
// MappingRelevant types only, hierarchical
manager.add(new ContentProviderAction("Mapping relevant types hierarchical", HALEUIPlugin.getImageDescriptor("icons/hierarchical_relevant.png"), getViewer(), hierarchicalRelevantProvider, false));
// Mappable types, flat
manager.add(new ContentProviderAction("All types as list", HALEUIPlugin.getImageDescriptor("icons/flat_all.png"), getViewer(), flatAllProvider, false));
// Mappable types, hierarchical
manager.add(new ContentProviderAction("All types hierarchical", HALEUIPlugin.getImageDescriptor("icons/hierarchical_all.png"), getViewer(), hierarchicalAllProvider, false));
}
use of eu.esdihumboldt.hale.ui.service.entity.util.ContentProviderAction in project hale by halestudio.
the class TypeEntityDialog method addToolBarActions.
/**
* @see eu.esdihumboldt.hale.ui.function.common.EntityDialog#addToolBarActions(org.eclipse.jface.action.ToolBarManager)
*/
@Override
protected void addToolBarActions(ToolBarManager manager) {
// filter to only show mapped types
manager.add(new FilterAction("Hide unmapped types", "Show unmapped types", HALEUIPlugin.getImageDescriptor("icons/empty.gif"), getViewer(), new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
AlignmentService as = PlatformUI.getWorkbench().getService(AlignmentService.class);
Alignment alignment = as.getAlignment();
if (element instanceof TreePath)
element = ((TreePath) element).getLastSegment();
return isMapped((ITreeContentProvider) ((TreeViewer) viewer).getContentProvider(), element, alignment);
}
private boolean isMapped(ITreeContentProvider cp, Object element, Alignment align) {
if (element instanceof EntityDefinition) {
boolean mapped = AlignmentUtil.entityOrChildMapped((EntityDefinition) element, align);
if (mapped)
return true;
}
// recursively check children
Object[] children = cp.getChildren(element);
if (children != null)
for (Object child : children) if (isMapped(cp, child, align))
return true;
return false;
}
}, true, true));
// do not add choice if only mapping relevant types should be selected
if (onlyMappingRelevant)
return;
manager.add(new Separator());
// MappingRelevant types only, flat
manager.add(new ContentProviderAction("Mapping relevant types as list", HALEUIPlugin.getImageDescriptor("icons/flat_relevant.png"), getViewer(), flatRelevantProvider, false));
// MappingRelevant types only, hierarchical
manager.add(new ContentProviderAction("Mapping relevant types hierarchical", HALEUIPlugin.getImageDescriptor("icons/hierarchical_relevant.png"), getViewer(), hierarchicalRelevantProvider, false));
// Mappable types, flat
manager.add(new ContentProviderAction("All types as list", HALEUIPlugin.getImageDescriptor("icons/flat_all.png"), getViewer(), flatAllProvider, true));
// Mappable types, hierarchical
manager.add(new ContentProviderAction("All types hierarchical", HALEUIPlugin.getImageDescriptor("icons/hierarchical_all.png"), getViewer(), hierarchicalAllProvider, false));
}
use of eu.esdihumboldt.hale.ui.service.entity.util.ContentProviderAction in project hale by halestudio.
the class EntitySchemaExplorer method prependToolbarActions.
/**
* @see SchemaExplorer#prependToolbarActions(ToolBarManager)
*/
@Override
protected void prependToolbarActions(ToolBarManager manager) {
// structure
manager.add(new ContentProviderAction("Types as list", SchemasViewPlugin.getImageDescriptor("icons/flat_hierarchy.png"), getTreeViewer(), listProvider, true));
manager.add(new ContentProviderAction("Type hierarchy", SchemasViewPlugin.getImageDescriptor("icons/inheritance_hierarchy.png"), getTreeViewer(), hierarchyProvider, false));
manager.add(new Separator());
// type filters
ViewerFilter typeUnpopulated = new UnpopulatedTypesFilter();
manager.add(new FilterAction("Hide unpopulated types", "Show unpopulated types", SchemasViewPlugin.getImageDescriptor("icons/type_empty.gif"), getTreeViewer(), typeUnpopulated, true, true));
manager.add(new Separator());
// properties filters
ViewerFilter unpopulated = new UnpopulatedPropertiesFilter();
manager.add(new FilterAction("Hide unpopulated properties", "Show unpopulated properties", SchemasViewPlugin.getImageDescriptor("icons/empty.gif"), getTreeViewer(), unpopulated, true, true));
ViewerFilter inherited = new InheritedPropertiesFilter();
manager.add(new FilterAction("Hide inherited properties", "Show inherited properties", SchemasViewPlugin.getImageDescriptor("icons/inherited.gif"), getTreeViewer(), inherited, true, true));
ViewerFilter optional = new OptionalPropertiesFilter();
manager.add(new FilterAction("Hide optional properties", "Show optional properties", SchemasViewPlugin.getImageDescriptor("icons/mandatory.gif"), getTreeViewer(), optional, true, true));
manager.add(new Separator());
}
Aggregations