[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[gef-dev] [patch] fail fast in AbstractEditPart.refreshChildren()
|
- From: Carlo Salinari <carlo.salinari@xxxxxxxxx>
- Date: Wed, 10 Nov 2010 23:40:10 +0100
- Delivered-to: gef-dev@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=8LLAjrWlzs3+9xLXlnQ+y4+s5xokIRN29irCuaowC9Q=; b=vBeuAzl7H9NvUf88Iovuo18dt4ugIUmnvpyRr9IR0HOw5l4OOI0qQQghZPt35w8m7e CkIq4WhT6r0CiAYdHCHRaCLvY0hmcHBAs+IDaSmeVQfmX8p7PCs1FbrwLCg7FvNU6ytD 3mrWz8Ysy8vcimyYBEclotXHJr8HS9C+myZ4k=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=RINAqguDqLWvB3A7/t08mHcWsNIquu0uzwXE7B7WRZZI5GtWWVRa5rDhg5lG7yqkLc +oo0LOPpYq6C4Buv2amfOSfWJ9v4Jwb+oB053d9BCp9227Y8KHRMjZX28s9VnJoB//ai h9546inmtEEIaL8iEwNhs4okMZbMB1OuIpUrg=
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6
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);