-
Notifications
You must be signed in to change notification settings - Fork 228
[E4 XPath] Add new API in EModelService to find elements via Xpath and deprecate E4-XPath bundle for removal #2789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[E4 XPath] Add new API in EModelService to find elements via Xpath and deprecate E4-XPath bundle for removal #2789
Conversation
bundles/org.eclipse.e4.emf.xpath/src/org/eclipse/e4/emf/xpath/XPathContextFactory.java
Outdated
Show resolved
Hide resolved
6ecf8b0 to
fbd8216
Compare
|
This pull request changes some projects for the first time in this development cycle. An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patchFurther information are available in Common Build Issues - Missing version increments. |
|
@ptziegler as you contributed test-cases and worked on the parent-context handling, I wonder if you are actually using it and therefore have objections against deprecating The same question applies to |
|
I know it is an "API break" but should we not mark |
I ask this question to myself as well. On one hand the Eclipse SDK only provide one specific implementation of that class that can only handle a specific type of model, while the interface is designed (maybe over-engineered) generic. So there could be a demand to have other implementations that can handle other type of models. The same question also applies to |
|
I think the only interesting use-case would be to query the Model programmatically with an xpath expression, maybe it was though of a way to be used with other EMF model, but tin this case it would have ben better be implemented/provided by emf itself. For this purpose, I would rather want to have a method in As all of this basically boils down to |
caf475f to
72caaab
Compare
There is also one other user in PDE, see e.g.
Adding something like
If we make the approach from above work, then we could deprecate the entire bundle and inline it's content to wherever the new API lands when the bundle is finally removed. |
cd38c71 to
c02a880
Compare
We could also add it as something internal in |
b63a75f to
d810b46
Compare
This also allows us to avoid the clean-up of the parameteriziation problem of |
d810b46 to
33cc9a7
Compare
bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/XPathHelper.java
Outdated
Show resolved
Hide resolved
5f90f87 to
7dfc567
Compare
|
I have looked at the usage in PDE of the new API and in general it looks good, the only thing that makes using this cumbersome is the fact that the new API is an instance method and not a class/static method and one needs an |
|
I'm not sure I found the right place but the only one I can found in PDE is
As it has the
if you want avoid an additional parameter. |
eef6bd6 to
b691369
Compare
|
I have now added the missing documentation and think this is ready for submission. @laeubi are you fine with this now? @merks do you also want to have a look?
I tried this but it looks like it doesn't work in all cases, because (at least in some cases) that actually an MApplication loaded from a resource/file of an Editor and not the 'active' application model of the running application. And in that case the context is not set to these model-elements and So for PDE I either need to get the context purely static (not sure if that's possible) or pass an |
Du to the nature of E4 this is not reliable possible but I think the case of an editor is rather special. But I think we have some cases:
|
laeubi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the method that is currently at XPathHelper maybe betterl ife in ModelServiceImpl or StringModelFragmentImpl?
| * {@link org.eclipse.e4.ui.workbench.modeling.EModelService#findMatchingElements(org.eclipse.e4.ui.model.application.MApplicationElement, String, Class)} | ||
| * instead. | ||
| */ | ||
| @Deprecated(forRemoval = true, since = "2025-03 (removal in 2027-03 or later)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need any deprecation here if we deprecate the bundle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the additional deprecation of some methods, but the explicit deprecation of the classes should be kept as one otherwise doesn't get a corresponding warning in the code. And from my experience warnings in Manifests are overlooked more easily than in code.
Furthermore the deprecation javadoc contains additional information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the explicit deprecation of the classes should be kept as one otherwise doesn't get a corresponding warning in the code.
You should already get a warning in the Manifest about the deprecation.
bundles/org.eclipse.e4.emf.xpath/src/org/eclipse/e4/emf/xpath/XPathContextFactory.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.e4.emf.xpath/src/org/eclipse/e4/emf/xpath/XPathNotFoundException.java
Show resolved
Hide resolved
bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/XPathHelper.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/XPathHelper.java
Outdated
Show resolved
Hide resolved
5ddec76 to
6c99753
Compare
Moving it to |
5ef6d8f to
bcfd112
Compare
|
@laeubi I would like to submit this PR this evening so that I can apply the new API/methods in PDE tomorrow after the next I-build. But I think that's fine. Everything else is internal and can be changed at any time later, if necessary. Do you have any critical points that should definitively be addressed? |
0e6dd1f to
28c5d5a
Compare
3fafed1 to
934235e
Compare
Ok, as discussed in a private conversion I have renamed it to |
laeubi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
New EModelService method should maybe mention in N&N
|
You are welcome. I'm happy if that whole XPath topic is finally reduced to the actually used minimum.
Yes. Together with the replacement of JXPath. That might be interesting for others as well. |
a984974 to
bfd0279
Compare
|

As found in #2290, these methods seem not to provide any real value and just complicate the implementation.
I'm contemplating to even remove XPathContext.getValue() as it also complicates the implementation and has no real usage in the SimRel:
eclipse.platform.ui/bundles/org.eclipse.e4.emf.xpath/src/org/eclipse/e4/emf/xpath/XPathContext.java
Lines 39 to 51 in c9f129d