use of org.osate.ge.RelativeBusinessObjectReference 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;
}
use of org.osate.ge.RelativeBusinessObjectReference 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();
}
}
use of org.osate.ge.RelativeBusinessObjectReference 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;
}
use of org.osate.ge.RelativeBusinessObjectReference 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;
}
use of org.osate.ge.RelativeBusinessObjectReference 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;
}
Aggregations