Is it possible to refer to java methods in a model?
For instance my model may look like this:
A = javaMethod(a);
//where java method (static or member) is defined in a class contained in a jar file in the same project.
I've tried to create an IScope from scratch, but it seems that I need an EMF representation for the .jar resources. Am I right?
Can someone help me with this?
I've tried to use my own IResourceServiceProvider for the .jar via an extension point like in this post:
but nothing happens, there is no implemented method that is called at runtime.
It seems that I have serious problems With scoping API.
Another alternative that I experimented was Xtend, but this is also very far for my understanding limits, so I rather prefer to implement my own scopes.
I don't Know what you mean by out of the box, "a class" ..."a certain class".
I'll try to explain better my problem, which by the way seemed to be trivial by means of xtext scopes...but...
My model.mydsl resource is contained in a project that has a particular nature: no classpath, no jdt nature, just Xtext nature and my own nature.
The project is also containing a list of Jar files as resources implementing some numerical methods.
I need that all those methods annotated in my own style be exported outside and visible in my model.mydsl. I've already implemented my own style provider for method names. The problem is that I'm not able to adapt these method names to an IEObjectDescription...for an IScope build from scratch.
My previous experience:
The IResourceServiceProvider solution has the same effect....
Building EObjects on the fly leads to dangling references...
JvmTypes is too hard to understand...
...I don't know what else to do...please help.
the basic problem is: give me a list of classes or classnames that should be searched.
if you have that you have won. if not it might be very tricky ( i have no idea so far)
so are you able to give me a list of classnames and method names?
is it discussable to turn the project to a java project and add the classes to the classpath of that project?
what do you do if there are two classes with the same method name?
thus we could make it working with jvmtypes.
if you build something on your own you have to solve the "dangling refs problem"
e.g. by building something similar to TypeResource
you should also consider to solve the problem by using a string and using a utility for check/contentassist/codegeneration to
find the real clas/method