Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] New Query API Questions; Migrating from my own ContextQuery

On Mon, Mar 1, 2010 at 12:07 PM, Thomas Hallgren <thomas@xxxxxxx> wrote:
> One more thing:
>
> If you are willing to sacrifice the IUPackage collection and instead use the
> query to search for specific packages, you can probably gain a lot of
> performance since the actual capability name will be indexed, i.e.
>
> IQuery query = QueryUtil.createMatchQuery("providedCapabilities.exists(p |
> p.name == $0 && p.namespace == 'java.package')", packageName);
>
> OR, first create an expression that can be reused multiple times with
> different parameters, i.e.
>
> IExpression expression = ExpressionUtil.parse("providedCapabilities.exists(p
> | p.name == $0 && p.namespace == 'java.package')");
> for(<each packageName>) {
>  IQuery query = QueryUtil.createMatchQuery(expression, packageName);
>  ...
> }

Thanks Thomas.

To display things to the UI, I need to create my own IUPackage object.
However, for resolving quickfixes and all that good stuff, I will
gladly use this expression to simplify things quite a bit. The query
API is pretty powerful and is helping me implement something I've
wanted to do for years in PDE.

Cheers,

-- 
Chris Aniszczyk | EclipseSource Austin | +1 860 839 2465
http://twitter.com/eclipsesource | http://twitter.com/caniszczyk


Back to the top