|
Re: How to keep IDs consistent [message #1776745 is a reply to message #1776197] |
Tue, 21 November 2017 04:50 |
Eclipse User |
|
|
|
I think you might be referring to the xmi:id values? Those are internal identifiers assigned by EMF and you should not use or rely upon them.
Most E4 model elements support an `elementId` attribute which is generally under your control and should be preserved. It is a significant attribute for a number of objects, like MCommand objects where it defines the ID of the command which is referenced elsewhere.
Alternatively you can define your own custom ID and store it in the persistedState map attribute, which is supported by most model elements.
Brian.
|
|
|
|
Re: How to keep IDs consistent [message #1776892 is a reply to message #1776834] |
Wed, 22 November 2017 14:59 |
Eclipse User |
|
|
|
Two approaches come to mind.
First, use IDs that are independent of their container (i.e., don't use the Bundle Symbolic Name as the prefix of your identifiers). Then you don't need to change your identifiers during refactorings.
Second, create unit tests that parse content and verify that elements can be found that match the IDs in the constants. E.g., Apply XPath expressions against your .xmi or plugin.xml etc. This is surprisingly effective!
Brian.
|
|
|
|
Re: How to keep IDs consistent [message #1777149 is a reply to message #1777060] |
Sat, 25 November 2017 02:49 |
Eclipse User |
|
|
|
Although the elementId field is a free-form string, consumers of particular model elements may impose requirements. The EPartService, for example, generally assumes that parts are singletons within a window, unless additional information is provided which is encoded in the elementId (an approach that was inherited from E3.x). You're of course free to not use the Part Service, in which case you could use free-form identifiers.
The `toolbar:` prefix, and its cousins `popup:` and `menu:`, are used by the EMenuService for targeting contributions.
Brian.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03883 seconds