[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Subclassing SWT Tree

Hi,

I have a need to access certain bits of tree control functionality that aren't exposed by SWT Tree API. Specifically, I want to get notifications when the Tree control is scrolled, and find out the bounding rects of the currently visible items, so that I can draw decorations to the left of the tree that are related to each item and scroll when the tree scrolls. (The decorations have to be to the left of the disclosure controls, so they line up with each other.)

The easiest way for me to do this would be to subclass the SWT Tree control and add a few lines that use the package-internal SWT OS.* methods to call into the native OS tree control. (Yes, I understand that this means I have to write separate code on each platform, and that I will be susceptible to breakage in new versions of Eclipse. But let's assume I have no other alternative :))

Is there any way to do this? I tried creating a plug-in fragment for org.eclipse.swt that would sit alongside, say, the org.eclipse.swt.win32.win32.x86 fragment, but I couldn't make my fragment depend on that fragment. (I was actually able to get my code to compile if I manually set the Require-Bundle field in my MANIFEST.MF to be the win32 fragment, but Eclipse flagged that as an error in MANIFEST.MF.)

I know the "approved" method is to build my own wrapper for the native tree control without using the SWT OS.* methods. However, I really don't want to have to do that, since that would essentially mean rebuilding all the SWT tree functionality from scratch. Since I only really want a small set of extensions to the tree functionality, I'd like to leverage the existing code.

Thanks,

nj