Bug 269698 - [expressions] Allow extensions to Core Expression Framework
Summary: [expressions] Allow extensions to Core Expression Framework
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-23 10:56 EDT by Philipp Kursawe CLA
Modified: 2019-09-06 16:19 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Kursawe CLA 2009-03-23 10:56:33 EDT
Wouldn't it be nice if we could extend the defined core expression language by our own "verbs"? Recently I needed a new core expression to evaluate preferences using the IPreferencesService. It would be nice if I could just implement an Expression and define an extension to (the not-yet existing) "org.eclipse.core.expressions.expression". In my extension I would describe the name of my verb being "preference" and its attributes would be "qualifier" and "key".
As a further enhancement I could specify that "key" would have to be a String and that "qualifier" could have content assistant support where I would supply all the currently loaded bundles with their bundle-symbolicname as possible values for "qualifier".

<expression name="preference" compound="true">
  <attributes>
    <attribute name="qualifier">
      <values><class name="PreferenceQualifierResolver"/></values>
    </attribute>
  </attributes>
</expression>

By specifying "compound=true" PDE would allow me to add sub expressions to my expression. The "values" for an "attribute" could describe a list of String values, or a class that dynamically returns a list of strings during runtime.

PreferenceQualifierResolver would do something like this:
class PreferenceQualifierResolver {
  String[] resolve() {
    List ids;
    for all loaded bundles ids.add(bundle.symbolic name);
    return ids.toArray();
  }
}

An expression extension would also have to provide documentation that PDE can show to the user.
Comment 1 Dani Megert CLA 2009-03-23 11:16:13 EDT
Paul, what do you think?
Comment 2 John Arthorne CLA 2009-03-23 16:44:54 EDT
As a meta-question, where should we put core expressions bugs now? We can leave them in Platform Runtime with an "[expressions]" header if that makes sense for you Paul (and add you as CC and/or QA Contact).
Comment 3 Dani Megert CLA 2009-03-24 03:19:09 EDT
Would be fine for JDT.
Comment 4 Markus Keller CLA 2009-03-24 06:56:52 EDT
> As a meta-question, where should we put core expressions bugs now?
Bugs should be in the component who "owns" the plug-in. Currently, that's JDT/UI, but it's fine for me to move it to Platform/UI if you also move the map file entry to ui.map and take over the tagging for builds.
Comment 5 Paul Webster CLA 2009-03-24 09:56:14 EDT
(In reply to comment #2)
> As a meta-question, where should we put core expressions bugs now? We can leave
> them in Platform Runtime with an "[expressions]" header if that makes sense for
> you Paul (and add you as CC and/or QA Contact).
> 

I'm fine with that.

PW
Comment 6 Paul Webster CLA 2009-03-24 09:58:08 EDT
(In reply to comment #4)
> > As a meta-question, where should we put core expressions bugs now?
> Bugs should be in the component who "owns" the plug-in. Currently, that's
> JDT/UI, but it's fine for me to move it to Platform/UI if you also move the map
> file entry to ui.map and take over the tagging for builds.
> 

I'm fine with moving it to core runtime and the appropriate map (John and I had talked about this before).

PW
Comment 7 Paul Webster CLA 2009-03-24 10:18:37 EDT
I think there are 2 possibilities here for contributions.

Use an extension point and org.eclipse.core.expressions.ExpressionConverter to allow new structure to be read out of the IConfigurationElements.  I did something similar when experimenting with bug 248140.  The downside to this approach is the PDE tooling.  It's easy to get warnings or errors about elements that don't belong, and AFAIK it would be impossible to provide the new elements to the PDE editor content assist.

Use an extension point to plug in in new org.eclipse.core.expressions.IVariableResolvers.  Then you wouldn't have new structural elements, but would be able to provide new variables with <resolve/> but just like variables used with <with/> there's no direct PDE support for that either.

PW
Comment 8 Eclipse Webmaster CLA 2019-09-06 16:19:06 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.