Search in sources :

Example 1 with BusinessObjectNode

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

the class ShowConnectedElementsHandler method isConnectedToSubcomponent.

private boolean isConnectedToSubcomponent(final Context context1, final BusinessObjectNode selectedNode, final ConnectedElement connectedElement1, final BusinessObjectNode parent, final Context context2, final ConnectedElement connectedElement2) {
    if (context1 == selectedNode.getBusinessObject()) {
        enableConnectedElements(selectedNode, connectedElement1);
        BusinessObjectNode context = parent;
        if (context2 != null) {
            // Enable context node
            final RelativeBusinessObjectReference srcContextRef = getRelativeBusinessObjectReference(context2);
            context = parent.getChild(srcContextRef);
            if (context == null) {
                context = createNode(parent, srcContextRef, context2);
            }
        }
        enableConnectedElements(context, connectedElement2);
        return true;
    }
    return false;
}
Also used : BusinessObjectNode(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode) RelativeBusinessObjectReference(org.osate.ge.RelativeBusinessObjectReference)

Example 2 with BusinessObjectNode

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

the class ShowConnectedElementsHandler method enableConnectedElements.

private void enableConnectedElements(BusinessObjectNode parent, ConnectedElement ce) {
    while (ce != null) {
        final ConnectionEnd connectionEnd = ce.getConnectionEnd();
        final RelativeBusinessObjectReference ceRef = getRelativeBusinessObjectReference(connectionEnd);
        final BusinessObjectNode ceNode = parent.getChild(ceRef);
        parent = ceNode == null ? createNode(parent, ceRef, connectionEnd) : ceNode;
        ce = ce.getNext();
    }
}
Also used : BusinessObjectNode(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode) RelativeBusinessObjectReference(org.osate.ge.RelativeBusinessObjectReference) ConnectionEnd(org.osate.aadl2.ConnectionEnd)

Example 3 with BusinessObjectNode

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

the class ShowConnectedElementsHandler method enabledConnectionEnds.

private boolean enabledConnectionEnds(final BusinessObjectNode selectedNode, final Context context1, final Context context2, final ConnectedElement connectedElement1, final ConnectedElement connectedElement2) {
    if (context1 == null || !(context1 instanceof Subcomponent)) {
        if (context2 != null) {
            final RelativeBusinessObjectReference contextRef = getRelativeBusinessObjectReference(context2);
            BusinessObjectNode contextNode = selectedNode.getChild(contextRef);
            if (contextNode == null) {
                contextNode = createNode(selectedNode, contextRef, context2);
            }
            enableConnectedElements(contextNode, connectedElement1);
        }
        enableConnectedElements(selectedNode, connectedElement2);
        return true;
    }
    return false;
}
Also used : BusinessObjectNode(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode) Subcomponent(org.osate.aadl2.Subcomponent) RelativeBusinessObjectReference(org.osate.ge.RelativeBusinessObjectReference)

Example 4 with BusinessObjectNode

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

the class ShowConnectedElementsHandler method getAncestor.

private BusinessObjectNode getAncestor(final Object ancestor, final BusinessObjectNode parent) {
    final RelativeBusinessObjectReference ref = getRelativeBusinessObjectReference(ancestor);
    final BusinessObjectNode node = parent.getChild(ref);
    // Enable ancestor node if necessary
    return node == null ? createNode(parent, ref, ancestor) : node;
}
Also used : BusinessObjectNode(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode) RelativeBusinessObjectReference(org.osate.ge.RelativeBusinessObjectReference)

Example 5 with BusinessObjectNode

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

the class ShowConnectedElementsHandler method getEnableAncestorNodes.

// Create ancestor nodes
private Map<Object, BusinessObjectNode> getEnableAncestorNodes(final BusinessObjectNode boTree, final Queue<Element> ancestors, final Element ancestor) {
    final Map<Object, BusinessObjectNode> boToAncestorNodes = new HashMap<Object, BusinessObjectNode>();
    BusinessObjectNode ancestorNode = boTree.getChild(getRelativeBusinessObjectReference(ancestor));
    boToAncestorNodes.put(ancestorNode.getBusinessObject(), ancestorNode);
    for (final Element ancestorToEnable : ancestors) {
        final RelativeBusinessObjectReference ancestorRef = getRelativeBusinessObjectReference(ancestorToEnable);
        final BusinessObjectNode tmpNode = ancestorNode.getChild(ancestorRef);
        ancestorNode = tmpNode == null ? createNode(ancestorNode, ancestorRef, ancestorToEnable) : tmpNode;
        boToAncestorNodes.put(ancestorNode.getBusinessObject(), ancestorNode);
    }
    return boToAncestorNodes;
}
Also used : BusinessObjectNode(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode) HashMap(java.util.HashMap) Element(org.osate.aadl2.Element) ConnectedElement(org.osate.aadl2.ConnectedElement) RelativeBusinessObjectReference(org.osate.ge.RelativeBusinessObjectReference) InstanceObject(org.osate.aadl2.instance.InstanceObject)

Aggregations

BusinessObjectNode (org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode)24 RelativeBusinessObjectReference (org.osate.ge.RelativeBusinessObjectReference)18 InstanceObject (org.osate.aadl2.instance.InstanceObject)7 LinkedList (java.util.LinkedList)6 List (java.util.List)5 IEditorPart (org.eclipse.ui.IEditorPart)5 ConnectionEnd (org.osate.aadl2.ConnectionEnd)5 Element (org.osate.aadl2.Element)5 BusinessObjectContext (org.osate.ge.BusinessObjectContext)5 AgeDiagram (org.osate.ge.internal.diagram.runtime.AgeDiagram)5 LayoutInfoProvider (org.osate.ge.internal.diagram.runtime.layout.LayoutInfoProvider)5 DiagramUpdater (org.osate.ge.internal.diagram.runtime.updating.DiagramUpdater)5 InternalDiagramEditor (org.osate.ge.internal.ui.editor.InternalDiagramEditor)5 Objects (java.util.Objects)4 UUID (java.util.UUID)4 Collectors (java.util.stream.Collectors)4 Adapters (org.eclipse.core.runtime.Adapters)4 ConnectedElement (org.osate.aadl2.ConnectedElement)4 Collections (java.util.Collections)3 HashMap (java.util.HashMap)3