diff --git a/src/org/ntlab/deltaViewer/CollaborationLayout.java b/src/org/ntlab/deltaViewer/CollaborationLayout.java index 30f331b..45ea389 100644 --- a/src/org/ntlab/deltaViewer/CollaborationLayout.java +++ b/src/org/ntlab/deltaViewer/CollaborationLayout.java @@ -151,6 +151,26 @@ } } } + } else if (a.getAliasType() == AliasType.FORMAL_PARAMETER) { + MethodExecution methodExec = a.getOccurrencePoint().getMethodExecution(); + if (methodExec.isStatic()) { + // For calls to a static method. + String dstClassName = methodExec.getThisClassName(); + String srcClassName = methodExec.getCallerMethodExecution().getThisClassName(); + String dstObjId = methodExec.getThisObjId() + ":" + dstClassName; + String srcObjId = null; + if (!methodExec.getCallerMethodExecution().isStatic()) { + srcObjId = methodExec.getCallerMethodExecution().getThisObjId(); + } else { + srcObjId = methodExec.getCallerMethodExecution().getThisObjId() + ":" + srcClassName; + } + Reference r = new Reference(srcObjId, dstObjId, srcClassName, dstClassName); + idx = references.indexOf(r); + if (idx < 0) { + references.add(r); + idx = references.indexOf(r); + } + } } if (idx >= 0) { Reference r = references.get(idx); diff --git a/src/org/ntlab/deltaViewer/CollaborationViewer.java b/src/org/ntlab/deltaViewer/CollaborationViewer.java index 10fc087..1a7ce0f 100644 --- a/src/org/ntlab/deltaViewer/CollaborationViewer.java +++ b/src/org/ntlab/deltaViewer/CollaborationViewer.java @@ -421,6 +421,17 @@ mxICell vertex = (mxICell) mxgraph.insertDeltaVertex(getMxDefaultParent(), thisObjId, thisClassName, 0, 0, objecVertexWidth, ObjectVertexHeight, "fillColor=white"); //creates a white vertex. objectToVertexMap.put(thisObjId, new ObjectVertex(thisClassName, vertex, 0, 0)); } + } else if (alias.getAliasType() == Alias.AliasType.FORMAL_PARAMETER) { + String thisClassName = alias.getMethodExecution().getThisClassName(); + String thisObjId = alias.getMethodExecution().getThisObjId(); + if (thisObjId.matches("0")) { + thisObjId += ":" + thisClassName; + } + if (!objectToVertexMap.containsKey(thisObjId)) { + // When the called method are static. + mxICell vertex = (mxICell) mxgraph.insertDeltaVertex(getMxDefaultParent(), thisObjId, thisClassName, 0, 0, objecVertexWidth, ObjectVertexHeight, "fillColor=white"); //creates a white vertex. + objectToVertexMap.put(thisObjId, new ObjectVertex(thisClassName, vertex, 0, 0)); + } } } } finally { diff --git a/src/org/ntlab/deltaViewer/MagnetRONViewer.java b/src/org/ntlab/deltaViewer/MagnetRONViewer.java index 3c62966..81e5760 100644 --- a/src/org/ntlab/deltaViewer/MagnetRONViewer.java +++ b/src/org/ntlab/deltaViewer/MagnetRONViewer.java @@ -915,11 +915,10 @@ methodSignature = formatMethodSignature(methodSignature, methodExecution.getThisClassName()); } - // Why is the following code needed? - if (methodExecution.isStatic() && !objectId.startsWith("0")) { - objectId = methodExecution.getCallerMethodExecution().getThisObjId(); + if (methodExecution.isStatic() && !objectId.startsWith("0")) { // Check the object id is a formal parameter's one. + objectId = methodExecution.getThisObjId(); if (objectId.matches("0")) { - objectId += ":" + methodExecution.getCallerMethodExecution().getThisClassName(); + objectId += ":" + methodExecution.getThisClassName(); } }