diff --git a/src/org/ntlab/deltaViewer/MagnetRONViewer.java b/src/org/ntlab/deltaViewer/MagnetRONViewer.java index 82d2d79..84808f0 100644 --- a/src/org/ntlab/deltaViewer/MagnetRONViewer.java +++ b/src/org/ntlab/deltaViewer/MagnetRONViewer.java @@ -83,14 +83,29 @@ } public void clear() { + mxgraph.getModel().beginUpdate(); + try { + System.out.println("Clear: "); + for (ObjectVertex ov: objectToVertexMap.values()) { + mxICell ovCell = (mxICell)ov.getCell(); + if (ovCell != null) { + if (!ovCell.getParent().equals(mxDefaultParent)) { + // If parent of ObjectVertex cell isn't mxDefaltParent, reset parent. + ovCell.getParent().remove(ovCell); + ovCell.setParent(mxDefaultParent); + } + } + } + } finally { + mxgraph.getModel().endUpdate(); + } objectToVertexMap.clear(); methodExecToVertexMap.clear(); edgeMap.clear(); curFrame = 0; - // TODO Fix bug all cells are not remove in ArgoUML Delete. mxgraph.getModel().beginUpdate(); try { - mxgraph.removeCells(mxgraph.getChildVertices(mxgraph.getDefaultParent())); + mxgraph.removeCells(mxgraph.getChildVertices(mxDefaultParent)); } finally { mxgraph.getModel().endUpdate(); }