return;
}
if (!(arg instanceof XPDLElementChangeInfo)) {
return;
}
XPDLElementChangeInfo info = (XPDLElementChangeInfo) arg;
XMLElement changedElement = info.getChangedElement();
int action = info.getAction();
if (info.getSource() == this || (changedElement == null && action != XPDLElementChangeInfo.SELECTED)) {
return;
}
if (!(action == XMLElementChangeInfo.UPDATED ||
action == XMLElementChangeInfo.INSERTED ||
action == XMLElementChangeInfo.REMOVED ||
action == XMLElementChangeInfo.REPOSITIONED ||
action == XPDLElementChangeInfo.SELECTED ||
action == XPDLElementChangeInfo.ADJUST_UNDOABLE_ACTION ||
action == XPDLElementChangeInfo.UNDO ||
action == XPDLElementChangeInfo.REDO ||
action == XPDLElementChangeInfo.COPY ||
action == XPDLElementChangeInfo.CUT)) {
return;
}
long start = System.currentTimeMillis();
JaWEManager.getInstance().getLoggingManager().info(
"GraphController -> update for event " + info + " started ...");
updateInProgress = true;
try {
if (action == XPDLElementChangeInfo.COPY || action == XPDLElementChangeInfo.CUT) {
copyOrCutInfo = null;
if (selectedGraph != null) {
GraphManager gm = selectedGraph.getGraphManager();
Map actRectangles = new HashMap();
Iterator it = info.getChangedSubElements().iterator();
while (it.hasNext()) {
XMLElement toCopyOrCut = (XMLElement) it.next();
if (!(toCopyOrCut instanceof Activity)) {
continue;
}
Activity a = (Activity) toCopyOrCut;
GraphActivityInterface ga = gm.getGraphActivity(a);
if (ga != null) {
CopiedActivityInfo ai = new CopiedActivityInfo(
GraphUtilities.getParticipantId(a),
GraphUtilities.getOffsetPoint(a));
Rectangle rect = gm.getBounds(ga, new HashMap());
actRectangles.put(ai, rect);
}
}
if (actRectangles.size() > 0) {
Rectangle[] rarr = new Rectangle[actRectangles.size()];
actRectangles.values().toArray(rarr);
Point referencePoint = gm.getUnionBounds(rarr).getLocation();
copyOrCutInfo = new CopyOrCutInfo(referencePoint, actRectangles);
}
}
} else if (action == XPDLElementChangeInfo.UNDO || action == XPDLElementChangeInfo.REDO || action == XPDLElementChangeInfo.ADJUST_UNDOABLE_ACTION) {
if (action == XPDLElementChangeInfo.ADJUST_UNDOABLE_ACTION) {
GraphUtilities.adjustPackageOnUndoableChangeEvent(info.getChangedSubElements());
} else {
GraphUtilities.adjustPackageOnUndoOrRedoEvent(info.getChangedSubElements());
}
} else {
update(info);
}
} finally {