Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324078

Summary: [IDE] Cannot create a virtual TreeViewer in ContentOutlinePage
Product: [Eclipse Project] Platform Reporter: Jan Koehnlein <jan>
Component: UIAssignee: Paul Webster <pwebster>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: bokowski, remy.suen
Version: 3.6.1   
Target Milestone: 3.7 M5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
add getTreeStyle() to page none

Description Jan Koehnlein CLA 2010-08-31 07:50:46 EDT
org.eclipse.ui.views.contentoutline.ContentOutlinePage has a private field TreeViewer treeViewer, that is initialized in the createControl method. If you want to use a virtual tree viewer, you cannot do that by subclassing as it requires an additonal flag in the constructor call. As a consequence, you have to double all the code in your implementation.

Possible solutions 
- provide a protected setTreeViewer() method
- extract the initialization flags into a protected method
  protected int getFlags() { return SWT.MULTI | SWT.H_SCROLL
                | SWT.V_SCROLL; }
Comment 1 Paul Webster CLA 2011-01-06 13:50:08 EST
Created attachment 186208 [details]
add getTreeStyle() to page

Could override and return different styles as necessary.

Jan, could you please test and see that making it a virtual tree doesn't mean any other changes?

PW
Comment 2 Jan Koehnlein CLA 2011-01-07 03:49:50 EST
Thanks for the patch. It looks fine.

I don't see any more obstacles making an outline tree virtual apart from the general performance issue in #266189.
Comment 3 Remy Suen CLA 2011-01-07 08:42:44 EST
(In reply to comment #1)
> Created attachment 186208 [details]
> add getTreeStyle() to page

This patch makes sense to me, +1. Please update the copyright header to 2011 while you're at it and maybe put a note in the class-level javadoc about the new method for configuring the tree viewer's construction.
Comment 4 Paul Webster CLA 2011-01-07 13:39:18 EST
Updated the javadoc and released to HEAD
PW
Comment 5 Paul Webster CLA 2011-01-25 09:14:02 EST
new API in I20110124-1800
PW