[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[gef-dev] [patch] fail fast in AbstractEditPart.refreshChildren()
|
Hi,
I'm new, so please bear with me.
I was debugging a small test application creating many childless
EditPartS and got bored of having to step through the whole
AbstractEditPart.refreshChildren() even when there were no children to
refresh, so I came up with this little patch (see attachment).
cheers,
Carlo
Index: plugins/org.eclipse.gef/src/org/eclipse/gef/editparts/AbstractEditPart.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.gef/src/org/eclipse/gef/editparts/AbstractEditPart.java,v
retrieving revision 1.37
diff -u -r1.37 AbstractEditPart.java
--- plugins/org.eclipse.gef/src/org/eclipse/gef/editparts/AbstractEditPart.java 19 May 2010 20:27:54 -0000 1.37
+++ plugins/org.eclipse.gef/src/org/eclipse/gef/editparts/AbstractEditPart.java 10 Nov 2010 22:16:53 -0000
@@ -740,15 +740,20 @@
EditPart editPart;
Object model;
- Map modelToEditPart = new HashMap();
List children = getChildren();
+ List modelObjects = getModelChildren();
+
+ /* fail fast if both lists are set to Collections.EMPTY_LIST */
+ if (children == modelObjects)
+ return;
+
+ Map modelToEditPart = new HashMap();
for (i = 0; i < children.size(); i++) {
editPart = (EditPart) children.get(i);
modelToEditPart.put(editPart.getModel(), editPart);
}
- List modelObjects = getModelChildren();
for (i = 0; i < modelObjects.size(); i++) {
model = modelObjects.get(i);