Search in sources :

Example 46 with AgeDiagram

use of org.osate.ge.internal.diagram.runtime.AgeDiagram in project osate2 by osate.

the class ShowDefaultContentsHandler method execute.

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final List<DiagramElement> selectedDiagramElements = AgeHandlerUtil.getSelectedDiagramElements();
    final AgeDiagram diagram = UiUtil.getDiagram(selectedDiagramElements);
    if (diagram == null) {
        throw new RuntimeException("Unable to get diagram");
    }
    final DiagramType diagramType = diagram.getConfiguration().getDiagramType();
    final ContentFilterProvider contentFilterProvider = getContentFilterProvider();
    final Function<DiagramElement, ImmutableSet<ContentFilter>> getContentFilters = (diagramElement) -> DiagramTypeUtil.getApplicableDefaultContentFilters(diagramType, diagramElement.getBusinessObject(), contentFilterProvider);
    // Show elements matching the filter
    ShowContentsUtil.addContentsToSelectedElements(event, getContentFilters);
    return null;
}
Also used : DiagramElement(org.osate.ge.internal.diagram.runtime.DiagramElement) ExecutionEvent(org.eclipse.core.commands.ExecutionEvent) EclipseContextFactory(org.eclipse.e4.core.contexts.EclipseContextFactory) DiagramElement(org.osate.ge.internal.diagram.runtime.DiagramElement) ImmutableSet(com.google.common.collect.ImmutableSet) DiagramTypeUtil(org.osate.ge.internal.util.DiagramTypeUtil) ContentFilter(org.osate.ge.ContentFilter) ExtensionRegistryService(org.osate.ge.internal.services.ExtensionRegistryService) ExecutionException(org.eclipse.core.commands.ExecutionException) Function(java.util.function.Function) Objects(java.util.Objects) AgeDiagram(org.osate.ge.internal.diagram.runtime.AgeDiagram) List(java.util.List) UiUtil(org.osate.ge.internal.ui.util.UiUtil) DiagramType(org.osate.ge.DiagramType) AbstractHandler(org.eclipse.core.commands.AbstractHandler) Bundle(org.osgi.framework.Bundle) FrameworkUtil(org.osgi.framework.FrameworkUtil) ContentFilterProvider(org.osate.ge.internal.diagram.runtime.filtering.ContentFilterProvider) ImmutableSet(com.google.common.collect.ImmutableSet) AgeDiagram(org.osate.ge.internal.diagram.runtime.AgeDiagram) DiagramType(org.osate.ge.DiagramType) ContentFilterProvider(org.osate.ge.internal.diagram.runtime.filtering.ContentFilterProvider)

Aggregations

AgeDiagram (org.osate.ge.internal.diagram.runtime.AgeDiagram)46 DiagramElement (org.osate.ge.internal.diagram.runtime.DiagramElement)35 InternalDiagramEditor (org.osate.ge.internal.ui.editor.InternalDiagramEditor)20 IEditorPart (org.eclipse.ui.IEditorPart)18 List (java.util.List)16 Objects (java.util.Objects)16 Collectors (java.util.stream.Collectors)12 BusinessObjectContext (org.osate.ge.BusinessObjectContext)12 ExtensionRegistryService (org.osate.ge.internal.services.ExtensionRegistryService)11 DiagramNode (org.osate.ge.internal.diagram.runtime.DiagramNode)10 Collections (java.util.Collections)9 Adapters (org.eclipse.core.runtime.Adapters)9 DiagramUpdater (org.osate.ge.internal.diagram.runtime.updating.DiagramUpdater)9 Collection (java.util.Collection)8 LinkedList (java.util.LinkedList)8 Optional (java.util.Optional)8 Stream (java.util.stream.Stream)8 Point (org.osate.ge.graphics.Point)8 ArrayList (java.util.ArrayList)7 UiUtil (org.osate.ge.internal.ui.util.UiUtil)7