Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 123250 Details for
Bug 261854
adding/removing TreeItems can be very slow
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
latestPatch.txt (text/plain), 7.22 KB, created by
Grant Gayed
on 2009-01-21 11:37:53 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Grant Gayed
Created:
2009-01-21 11:37:53 EST
Size:
7.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java,v >retrieving revision 1.98 >diff -u -r1.98 Tree.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java 15 Jan 2009 17:30:11 -0000 1.98 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java 21 Jan 2009 16:33:58 -0000 >@@ -83,7 +83,7 @@ > int columnCount; > int sortDirection; > float /*double*/ levelIndent; >- boolean ignoreExpand, ignoreSelect; >+ boolean ignoreExpand, ignoreSelect, reloadPending; > > /** > * Constructs a new instance of this class given its parent >@@ -262,6 +262,12 @@ > if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); > } > >+void checkItems () { >+ if (!reloadPending) return; >+ reloadPending = false; >+ ((NSOutlineView)view).reloadItem (null); >+} >+ > void clear (TreeItem parentItem, int index, boolean all) { > TreeItem item = _getItem (parentItem, index, false); > if (item != null) { >@@ -578,8 +584,7 @@ > this.itemCount = count; > } > ignoreExpand = true; >- NSOutlineView widget = (NSOutlineView)view; >- widget.reloadItem(parentItem != null ? parentItem.handle : null, true); >+ reloadItem (parentItem, true); > ignoreExpand = false; > } > >@@ -778,12 +783,10 @@ > if (parentItem != null) { > parentItem.itemCount = count; > if (count == 0) parentItem.expanded = false; >- ((NSOutlineView) view).reloadItem (parentItem.handle, true); > } else { > this.itemCount = count; >- ((NSOutlineView) view).reloadItem (null); > } >- >+ reloadItem (parentItem, true); > // setScrollWidth (true); > // fixScrollBar (); > } >@@ -1281,6 +1284,7 @@ > public TreeItem getItem (Point point) { > checkWidget (); > if (point == null) error (SWT.ERROR_NULL_ARGUMENT); >+ checkItems (); > NSOutlineView widget = (NSOutlineView)view; > NSPoint pt = new NSPoint(); > pt.x = point.x; >@@ -1511,19 +1515,16 @@ > */ > public TreeItem getTopItem () { > checkWidget (); >-// //TODO - optimize >-// Rect rect = new Rect (); >-// int y = getBorder () + getHeaderHeight (); >-// for (int i=0; i<items.length; i++) { >-// TreeItem item = items [i]; >-// if (item != null) { >-// int columnId = (columnCount == 0) ? column_id : columns [0].id; >-// if (OS.GetDataBrowserItemPartBounds (handle, item.id, columnId, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) { >-// if (rect.top <= y && y <= rect.bottom) return item; >-// } >-// } >-// } >- return null; >+ //TODO - partial item at the top >+ NSRect rect = scrollView.documentVisibleRect (); >+ NSPoint point = new NSPoint (); >+ point.x = rect.x; >+ point.y = rect.y; >+ NSOutlineView outlineView = (NSOutlineView)view; >+ int /*long*/ index = outlineView.rowAtPoint (point); >+ if (index == -1) return null; /* empty */ >+ id item = outlineView.itemAtRow (index); >+ return (TreeItem)display.getWidget (item.id); > } > > void highlightSelectionInClipRect(int /*long*/ id, int /*long*/ sel, int /*long*/ rect) { >@@ -1880,6 +1881,19 @@ > sortColumn = null; > } > >+void reloadItem (TreeItem item, boolean recurse) { >+ if (drawCount == 0) { >+ NSOutlineView widget = (NSOutlineView)view; >+ if (item != null) { >+ widget.reloadItem (item.handle, recurse); >+ } else { >+ widget.reloadItem (null); >+ } >+ } else { >+ reloadPending = true; >+ } >+} >+ > /** > * Removes all of the items from the receiver. > * >@@ -1986,6 +2000,7 @@ > public void selectAll () { > checkWidget (); > if ((style & SWT.SINGLE) != 0) return; >+ checkItems (); > NSOutlineView widget = (NSOutlineView) view; > ignoreSelect = true; > widget.selectAll (null); >@@ -2013,6 +2028,7 @@ > checkWidget (); > if (item == null) error (SWT.ERROR_NULL_ARGUMENT); > if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); >+ checkItems (); > showItem (item); > NSOutlineView outlineView = (NSOutlineView) view; > int /*long*/ row = outlineView.rowForItem (item.handle); >@@ -2171,11 +2187,11 @@ > */ > public void setItemCount (int count) { > checkWidget (); >+ checkItems (); > count = Math.max (0, count); > setItemCount (null, count); > } > >- > void setItemCount (TreeItem parentItem, int count) { > int itemCount = getItemCount (parentItem); > if (count == itemCount) return; >@@ -2291,6 +2307,7 @@ > checkWidget (); > super.setRedraw (redraw); > if (redraw && drawCount == 0) { >+ checkItems (); > setScrollWidth (); > } > } >@@ -2384,6 +2401,7 @@ > public void setSelection (TreeItem [] items) { > checkWidget (); > if (items == null) error (SWT.ERROR_NULL_ARGUMENT); >+ checkItems (); > deselectAll (); > int length = items.length; > if (length == 0 || ((style & SWT.SINGLE) != 0 && length > 1)) return; >@@ -2500,6 +2518,7 @@ > checkWidget(); > if (item == null) error (SWT.ERROR_NULL_ARGUMENT); > if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); >+ checkItems (); > showItem (item, false); > NSOutlineView outlineView = (NSOutlineView) view; > //FIXME >@@ -2557,6 +2576,7 @@ > checkWidget (); > if (item == null) error (SWT.ERROR_NULL_ARGUMENT); > if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); >+ checkItems (); > showItem (item, true); > } > >@@ -2586,7 +2606,7 @@ > */ > public void showSelection () { > checkWidget (); >- //checkItems (false); >+ checkItems (); > //TODO - optimize > TreeItem [] selection = getSelection (); > if (selection.length > 0) showItem (selection [0], true); >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java,v >retrieving revision 1.38 >diff -u -r1.38 TreeItem.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java 15 Jan 2009 17:04:55 -0000 1.38 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java 21 Jan 2009 16:33:58 -0000 >@@ -495,6 +495,7 @@ > public Rectangle getBounds () { > checkWidget (); > if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); >+ parent.checkItems (); > NSOutlineView outlineView = (NSOutlineView) parent.view; > NSRect rect = outlineView.rectOfRow (outlineView.rowForItem (handle)); > return new Rectangle((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height); >@@ -519,6 +520,7 @@ > if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); > if (!(0 <= index && index < Math.max (1, parent.columnCount))) return new Rectangle (0, 0, 0, 0); > >+ parent.checkItems (); > NSOutlineView outlineView = (NSOutlineView) parent.view; > if (parent.columnCount == 0) { > index = (parent.style & SWT.CHECK) != 0 ? 1 : 0; >@@ -720,6 +722,7 @@ > if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); > if (!(0 <= index && index < Math.max (1, parent.columnCount))) return new Rectangle (0, 0, 0, 0); > >+ parent.checkItems (); > NSOutlineView outlineView = (NSOutlineView) parent.view; > Image image = index == 0 ? this.image : (images != null) ? images [index] : null; > if (parent.columnCount == 0) { >@@ -894,6 +897,7 @@ > if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); > if (!(0 <= index && index < Math.max (1, parent.columnCount))) return new Rectangle (0, 0, 0, 0); > >+ parent.checkItems (); > NSOutlineView outlineView = (NSOutlineView) parent.view; > Image image = index == 0 ? this.image : (images != null) ? images [index] : null; > if (parent.columnCount == 0) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261854
: 123250