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 108958 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.
Bug fixes for last patch
PseudoLazyTreeContentProvider.patch (text/plain), 4.12 KB, created by
Peter Centgraf
on 2008-08-01 11:09:42 EDT
(
hide
)
Description:
Bug fixes for last patch
Filename:
MIME Type:
Creator:
Peter Centgraf
Created:
2008-08-01 11:09:42 EDT
Size:
4.12 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,106 @@ >+package org.eclipse.nebula.jface.galleryviewer; >+ >+import org.eclipse.jface.viewers.IElementComparer; >+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, or object identity (the "==" operator) >+ * if none is set. 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) { >+ this.viewer = (GalleryTreeViewer) viewer; >+ this.input = newInput; >+ delegate.inputChanged(viewer, oldInput, 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 (isInput(element)) { >+ 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 (isInput(parent)) { >+ 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(); >+ } >+ >+ /** >+ * Does the element match the root input for the viewer? This method uses the >+ * viewer.getComparer() if one exists. >+ * >+ * @param element >+ * @return >+ */ >+ protected boolean isInput(Object element) { >+ IElementComparer comparer = viewer.getComparer(); >+ >+ if (comparer != null) { >+ return comparer.equals(element, input); >+ } >+ else { >+ return element == input; >+ } >+ } >+ >+}
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