Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Improved handling of ID's - Suggestion for discussion

On Fri, Feb 3, 2012 at 5:44 AM, Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx> wrote:
Looks like you've read my mind - this was my next question.

I think the other way round is easier to manage. Make the model editor
generate a Java-Class with static fields because what I still like is to
let me inject ModelElements by their ID using

-----------8<-----------
@Inject
@ElementId(ModelIds.MY_PART)
private MPart part;
-----------8<-----------

or a more generic annotation which accepts an XPath would look like this

-----------8<-----------
@Inject
@ElementPath("//id("+ModelIds.MY_PART+")")
private MPart part;
-----------8<-----------


I suspect that in the general case just the ID won't be effective, as for most IDs there are multiple model elements that have the same ID.   I like the idea of using XPath, although that sounds like it could get pretty complicated pretty quickly (how would you scope yourself to your MWindow, how would it know to look in the MPartStack in Eclipse4 apps but in the shared parts area for 4.2 workbench apps, etc?).

Later,
PW


--
Paul Webster
Hi floor.  Make me a sammich! - GIR

Back to the top