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

Bug 368087

Summary: [open type] Allow access to IType during filtering
Product: [Eclipse Project] JDT Reporter: Francis Upton IV <francisu>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert
Version: 3.6.1Keywords: needinfo
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Francis Upton IV CLA 2012-01-07 12:29:06 EST
My use case is that I want to filter types that implement a certain interface, I can't do this now because the only think I can look at is the name of the type (using the filter extension mechanism). However in looking at the code, the IType is actually available and could easily be passed to the filter extension.
Comment 1 Dani Megert CLA 2012-01-09 03:59:18 EST
You are talking about a/your custom 'Open Type' dialog, right? And you are referring to 'ITypeInfoRequestor'?

>My use case is that I want to filter types that implement a certain interface
Do you want to "filter" those or actually only "show" those?
Comment 2 Francis Upton IV CLA 2012-01-09 04:17:53 EST
(In reply to comment #1)
> You are talking about a/your custom 'Open Type' dialog, right? And you are
> referring to 'ITypeInfoRequestor'?
I'm using only the documented API, getting the dialog from JavaUI.createTypeDialog(), and I'm providing an implementation of TypeSelectionExtension which has a getFilterExtension() method and in that it gets an ITypeInfoFilterTextension whose select() method uses the ITypeInfoRequestor.

> 
> >My use case is that I want to filter types that implement a certain interface
> Do you want to "filter" those or actually only "show" those?
I want to show them and exclude everything that does not implement the interfaces.

I noticed that the open type used to PDE is able to do that (to get classes where certain interfaces are implemented), though I did not look at their source code to find out what's going on. So I'm hoping there is some API that allows me to do this.
Comment 3 Dani Megert CLA 2012-01-09 04:29:41 EST
They create a hierarchy scope and pass it in when creating the dialog.

See org.eclipse.pde.internal.ui.util.PDEJavaHelperUI.selectType(IResource, int, String, String) for example.