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 108797 Details for
Bug 224692
Support SWT.VIRTUAL style in GalleryTreeViewer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Same as the last one, as a patch file
PseudoLazyTreeContentProvider.patch (text/plain), 3.64 KB, created by
Peter Centgraf
on 2008-07-30 17:52:19 EDT
(
hide
)
Description:
Same as the last one, as a patch file
Filename:
MIME Type:
Creator:
Peter Centgraf
Created:
2008-07-30 17:52:19 EDT
Size:
3.64 KB
patch
obsolete
>Index: src/org/eclipse/nebula/jface/galleryviewer/PseudoLazyTreeContentProvider.java >=================================================================== >RCS file: src/org/eclipse/nebula/jface/galleryviewer/PseudoLazyTreeContentProvider.java >diff -N src/org/eclipse/nebula/jface/galleryviewer/PseudoLazyTreeContentProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/nebula/jface/galleryviewer/PseudoLazyTreeContentProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,86 @@ >+package org.eclipse.nebula.jface.galleryviewer; >+ >+import org.eclipse.jface.viewers.ILazyTreeContentProvider; >+import org.eclipse.jface.viewers.ITreeContentProvider; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.SWT; >+ >+/** >+ * Decorator that turns an eager {@link ITreeContentProvider} into an >+ * {@link ILazyTreeContentProvider} by delegating the appropriate calls. This is >+ * guaranteed to have worse performance characteristics than using the delegate directly, >+ * but it enables the use of {@link SWT#VIRTUAL} for rendering labels and images. >+ * For {@link GalleryTreeViewer}, this is a net win in most cases, since rendering images >+ * is vastly slower than fetching the model objects. >+ * >+ * NOTE: This class relies on the IElementComparer set on the viewer to determine >+ * whether an element is equal to the viewer input. This determines whether >+ * {@link ITreeContentProvider#getChildren(Object)} or >+ * {@link ITreeContentProvider#getElements(Object)} is used for a particular request. >+ * >+ * @author pcentgraf >+ * @since Jul 30, 2008 >+ */ >+public class PseudoLazyTreeContentProvider implements ILazyTreeContentProvider { >+ >+ final protected ITreeContentProvider delegate; >+ protected GalleryTreeViewer viewer; >+ protected Object input; >+ >+ public PseudoLazyTreeContentProvider(ITreeContentProvider delegate) { >+ this.delegate = delegate; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ */ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ delegate.inputChanged(viewer, oldInput, newInput); >+ viewer = (GalleryTreeViewer) viewer; >+ input = newInput; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ILazyTreeContentProvider#getParent(java.lang.Object) >+ */ >+ public Object getParent(Object element) { >+ return delegate.getParent(element); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ILazyTreeContentProvider#updateChildCount(java.lang.Object, int) >+ */ >+ public void updateChildCount(Object element, int currentChildCount) { >+ if (viewer.getComparer().equals(element, input)) { >+ viewer.setChildCount(element, delegate.getElements(element).length); >+ } >+ else { >+ viewer.setChildCount(element, delegate.getChildren(element).length); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ILazyTreeContentProvider#updateElement(java.lang.Object, int) >+ */ >+ public void updateElement(Object parent, int index) { >+ Object[] children; >+ if (viewer.getComparer().equals(parent, input)) { >+ children = delegate.getElements(parent); >+ viewer.replace(parent, index, children[index]); >+ viewer.setChildCount(children[index], delegate.getChildren(children[index]).length); >+ } >+ else { >+ children = delegate.getChildren(parent); >+ viewer.replace(parent, index, children[index]); >+ viewer.setChildCount(children[index], 0); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.IContentProvider#dispose() >+ */ >+ public void dispose() { >+ delegate.dispose(); >+ } >+ >+}
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 Raw
Actions:
View
Attachments on
bug 224692
:
108725
|
108796
| 108797 |
108958