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

Bug 259485

Summary: FilteredTree should provide information whether new filter look is used or not
Product: [Eclipse Project] Platform Reporter: Jacek Pospychala <jacek.pospychala>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 258881    

Description Jacek Pospychala CLA 2008-12-22 07:07:31 EST
This comes from bug 258881, where we're subclassing FilteredTree with custom setEnabled(boolean) method and we need to know whether filter has "new look" or old/OS look.

for now following check does the job:

if ((filterComposite.getStyle() & SWT.BORDER) != 0) {
  // new look is used
}

but it's awful :-(
Comment 1 Jacek Pospychala CLA 2008-12-22 07:14:47 EST
Eventually this bug could be fixed by implementing generic setEnabled(boolean) for FilteredTree. With current implementation, disabled and enabled FilteredTree look exactly the same. Preferred impl. would be to gray out Filter input field and tree viewer.
Comment 2 Jacek Pospychala CLA 2008-12-22 08:51:06 EST
Looking at this further, more flexible solution would be changing FilteredTree.useNewLook and FilteredTree.useNativeSearchField(Composite) visibility to protected.

Necessary e.g. when overriding createControl, as in bug 258953

Comment 3 Dani Megert CLA 2008-12-23 03:41:55 EST
The newLook field is set to exactly what you pass in and hence you know the value. If you really need it, simply cache it.

If you also need to know whether the native cancel and search field is used you can test this using filterText.getStyle() & SWT.CANCEL) == 0.