[JET] How to load a java file with a fully qualified name?https://www.eclipse.org/forums/index.php/mv/msg/207429/664185/#msg_664185
I know we can use the c:load tag to load a (java) model, but the problem is that we have to specify its physical address (relative to workspace or a project). What if I have a fully qualified name, and I know this java file is somewhere in an Eclipse project? Its physical address in the project may be different from project to project, but it is on the classpath of the project.

Does anyone know how to do this?

Thanks,
William]]>yongjiezheng2011-04-07T18:50:08-00:00Re: [JET] How to load a java file with a fully qualified name?https://www.eclipse.org/forums/index.php/mv/msg/207429/664215/#msg_664215
JET has not tags to do this out of the box, but it would not be too difficult to create a custom JET tag that did what you want.

It might look something like:

<myjava:loadClass project="project name" fqn="..." var="varToSet"/>

The tag implementation would have to do a number of things:

1) resolve the project name into first an IProject and then a IJavaProject:

Paul]]>Paul Elder2011-04-07T20:56:17-00:00Re: [JET] How to load a java file with a fully qualified name?https://www.eclipse.org/forums/index.php/mv/msg/207429/664233/#msg_664233
Following what you suggested, I created a custom tag whose implementation is like this:

When I tried to execute the template, i got the error like "Variable root is not defined".

Any idea about what's wrong with this?

Many thanks,
William
]]>yongjiezheng2011-04-07T23:17:19-00:00Re: [JET] How to load a java file with a fully qualified name?https://www.eclipse.org/forums/index.php/mv/msg/207429/664240/#msg_664240
yongjiezheng2011-04-08T00:13:08-00:00Re: [JET] How to load a java file with a fully qualified name?https://www.eclipse.org/forums/index.php/mv/msg/207429/664949/#msg_664949
Several things might be going wrong.

1) The tag isn't imported into the template. Two ways to do this:
i) an <%@taglib %> directive, with the fully qualified id of the tag library (plugin-id + '.' + id-used-in-the-declaring-plug.xml)

ii) import the tag library (with the same id as above) via the hosting JET project's plugin.xml. Need an 'importLibrary' tag with the autoImport attribute set to 'true'.

2) You developed your tag in a separate plug-in project (from the JET project), and you are trying to run the JET project from the workspace. This won't work. JET does some magic to load the JET project out of the workspace - it does not extend this ability to referenced plug-ins. The solution? Launch a runtime workbench that includes both the JET project and the plug-in project defining the tag, and test from there. OR, declare the tag in the sample plug-in as the JET templates