Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] Question about p2 UI policies and categories

                Hi all,


                Apologies in advance if this question has been answered before but so far my searching hasn’t found much. I have a product based on the Eclipse CDT (Helios) which is using the regular Eclipse Install New Software… dialogs to connect to an internal repository. What I would like to do is filter the list of available features shown to the user based on some custom criteria. Using a simple example let’s say that the repo has 2 features “FeatureA” and “FeatureB” and I want to write a custom policy that only displays FeatureB to the user. I’ve written a class that extends org.eclipse.equinox.p2.ui.Policy and overrides getVisiableAvailableUIQuery() as follows:


      public IQuery<IInstallableUnit> getVisibleAvailableIUQuery() {

            IQuery<IInstallableUnit> query = QueryUtil.createQuery(

                        "select(x | == $0)",

                        "" );

            return query;



                When I fire up Eclipse and open the Available Software dialog pointed to my repo I only see FeatureB in the list. So far so good. If I then enable “Group items by category” I then see both FeatureA and FeatureB. Stepping through the code in QueryProvider.getQueryDescriptor() it looks as if my IQuery is ignored and all features are displayed regardless. My assumption was that grouping by category was purely a display option that wouldn’t impact the actual data retrieved but this doesn’t seem to be the case.


                Is there any way to accomplish what I’m trying to do here? Any pointers would be much appreciated.




Back to the top