| Home » Modeling » M2T (model-to-text transformation) » c:include troubles
 Goto Forum:| 
| c:include troubles [message #60524] | Thu, 07 May 2009 04:10  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: nickmari77.yahoo.com 
 Hi,
 
 I'm having trouble using the "c:include" function, it keeps telling me:
 "Error: Could not find template templates/test2.jet"
 
 My template test.jet:
 
 <%@taglib prefix="c" id="org.eclipse.jet.controlTags"%>
 bla bla...
 <c:include template="templates/test2.jet"/>
 more bla bla...
 
 Templates test.jet and test2.jet are in the same templates folder.
 If I try including test.jet itself (in place of test2.jet) it works, but
 obviously it overflows.
 
 Why test2.jet is not found?
 
 Thanks!
 
 Nick
 |  |  |  |  | 
| Re: c:include troubles [message #60542 is a reply to message #60524] | Fri, 08 May 2009 13:44   |  | 
| Eclipse User  |  |  |  |  | Nick: 
 Some things to try:
 
 1) Take a look in the jet2java source folder of your JET project.
 Somewhere in there, you will see a _jet_transform.java class. Open this
 class, and see whether it has a string to templates/test2.jet. If it
 doesn't try rebuilding the JET project, or ensure that you have Auto
 Build on in the workspace.
 
 2) Assuming _jet_transform.java looks OK, my next guess is that you
 workbench already has an instance of the JET transformation installed as
 a plug-in...
 
 Go to Help > About. Click the Plug-ins button (or, with later Eclipse
 3.5 builds, click the Installation Details button, and then go to the
 plug-ins tab).
 
 Sort the list of plug-ins by ID, and look for the ID of your JET project
 (same as the project name be default). If you find it, then there is
 trouble...
 
 The reason this is trouble is that JET will not load a JET
 transformation from the workspace if there is already an installed
 instance of it.
 
 TO fix...
 a) If you are running in a runtime workbench (an Eclipse instanced
 launched from another Eclipse instance, generally for the purposes of
 debugging), check the launch configuration for the runtime workbench. It
 may be including your JET project from your development workspace or
 from your 'target' environment.
 
 b) Your JET project may have gotten 'stuck' because of a hard failure of
 your Eclipse workbench. When JET executes a transformation project, it
 temporarily installs the project as a plug-in, runs the templates and
 then uninstalls the plug-in. Should something particularly nasty happen,
 the plug-in may not get unloaded. You can manually unload it as follows:
 
 i) Exit Eclipse
 ii) Open the eclipse.ini file that is in the sample directory as your
 eclipse executable. On Windows, you might have to open this file with
 WordPad rather than Notepad, as the line separators in this file confuse
 Notepad.
 iii) On a new line at the top of the file, add the text:
 -console
 iv) save eclipse.ini, exit your text editor and start Eclipse
 v) in addition to your Eclipse workbench appearing, a console window
 will also appear. It should have a "osgi>" prompt.
 vi) At the "osgi>" prompt, type:
 
 bundles your-JET-project-name-here
 
 If you see your project in the listed output, type:
 
 uninstall your-JET-project-name-here
 
 Once this is complete, re-execute the above bundles command to confirm
 your JET project is not longer installed.
 
 You should now be able to execute the JET project that is in your workspace.
 
 Let me know if this helps,
 
 Paul
 |  |  |  |  | 
| Re: c:include troubles [message #60877 is a reply to message #60542] | Mon, 11 May 2009 05:28   |  | 
| Eclipse User  |  |  |  |  | Originally posted by: nickmari77.yahoo.com 
 Paul Elder wrote:
 
 > Nick:
 >
 > Some things to try:
 >
 > 1) Take a look in the jet2java source folder of your JET project.
 > Somewhere in there, you will see a _jet_transform.java class. Open this
 > class, and see whether it has a string to templates/test2.jet. If it
 > doesn't try rebuilding the JET project, or ensure that you have Auto
 > Build on in the workspace.
 
 _jet_transformation.java is ok, it contains:
 
 addTemplate("templates/common/test2.jet","my.jet.test.JetParticles.test2 " ); //$NON-NLS-1$ //$NON-NLS-2$
 
 Maybe it's nothing, but I override the generation of the java file to
 generate it as "test2.java" and not "_jet_test2.java" and to a
 "JetParticles" folder and not to the standard "compiled" folder. May
 this cause any troubles?
 
 >
 > 2) Assuming _jet_transform.java looks OK, my next guess is that you
 > workbench already has an instance of the JET transformation installed as
 > a plug-in...
 >
 > Go to Help > About. Click the Plug-ins button (or, with later Eclipse
 > 3.5 builds, click the Installation Details button, and then go to the
 > plug-ins tab).
 >
 > Sort the list of plug-ins by ID, and look for the ID of your JET project
 > (same as the project name be default). If you find it, then there is
 > trouble...
 >
 > The reason this is trouble is that JET will not load a JET
 > transformation from the workspace if there is already an installed
 > instance of it.
 
 Actually, my runtime workbench (not the eclipse workspace from which I
 run my application) runs my transfromation plugin, but it's done on
 purpose.
 From my application I need to access the "generate" method in the
 generated jets (ie: test2.java), if I don't load the plugin I can't
 access it.
 
 You say: "JET will not load a JET transformation from the workspace
 if there is already an installed instance of it", but I don't want to
 load a jet transformation (intended as my whole transformation project),
 I wish only to include a jet template in another one (<c:include
 template="templates/test2.jet"/>)
 
 Maybe I'm just misunderstanding your explaination.
 
 >
 > TO fix...
 > a) If you are running in a runtime workbench (an Eclipse instanced
 > launched from another Eclipse instance, generally for the purposes of
 > debugging), check the launch configuration for the runtime workbench. It
 > may be including your JET project from your development workspace or
 > from your 'target' environment.
 
 As said, I need to load the transfromation project as a plug in.
 To be more precise (hopefully): I have an eclipse workspace that
 contains some emf models, my application project and the
 transformation jet project (with the templates and the generated java
 files), then I run my application, which loads the models and the jet
 project, from which I need the jet generated java classes.
 
 >
 > b) Your JET project may have gotten 'stuck' because of a hard failure of
 > your Eclipse workbench. When JET executes a transformation project, it
 > temporarily installs the project as a plug-in, runs the templates and
 > then uninstalls the plug-in. Should something particularly nasty happen,
 > the plug-in may not get unloaded. You can manually unload it as follows:
 >
 -- cut --
 
 > vi) At the "osgi>" prompt, type:
 >
 >         bundles your-JET-project-name-here
 
 I've done , but I don't see my project.
 
 >
 > If you see your project in the listed output, type:
 >
 >         uninstall your-JET-project-name-here
 >
 > Once this is complete, re-execute the above bundles command to confirm
 > your JET project is not longer installed.
 >
 > You should now be able to execute the JET project that is in your workspace.
 >
 > Let me know if this helps,
 >
 > Paul
 
 Thanks for your patience,
 
 Nick
 |  |  |  |  | 
| Re: c:include troubles [message #60889 is a reply to message #60877] | Mon, 11 May 2009 08:34   |  | 
| Eclipse User  |  |  |  |  | Nick Mari wrote: >
 > _jet_transformation.java is ok, it contains:
 >
 > addTemplate("templates/common/test2.jet","my.jet.test.JetParticles.test2 " ); //$NON-NLS-1$ //$NON-NLS-2$
 >
 > Maybe it's nothing, but I override the generation of the java file to
 > generate it as "test2.java" and not "_jet_test2.java" and to a
 > "JetParticles" folder and not to the standard "compiled" folder. May
 > this cause any troubles?
 >
 
 That should be fine. I assume you can see
 my.jet.test.JetParticles.test2, too.
 
 
 >
 > Actually, my runtime workbench (not the eclipse workspace from which I
 > run my application) runs my transfromation plugin, but it's done on
 > purpose.
 > From my application I need to access the "generate" method in the
 > generated jets (ie: test2.java), if I don't load the plugin I can't
 > access it.
 >
 
 Hmmm. You are calling the generate methods directly? Then, I bet you are
 directly creating an instance of JET2Context, too. If I'm right, do this
 before you run your first template...
 
 TransformContextExtender.getInstance( your-jet2context-here
 ).setTemplateLoader(new _jet_transformation() );
 // _jet_transformation this is the class you inspected above..
 
 And, if you don't like the name of that class, open plugin.xml, and
 change the templateLoaderClass to something more appealing.
 
 Let me know if this helps.
 
 Paul
 |  |  |  |  |  |  |  |  | 
| Re: c:include troubles [message #61052 is a reply to message #61005] | Tue, 12 May 2009 08:14  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: nickmari77.yahoo.com 
 Thank you Paul,
 
 it works!
 
 
 
 Nick
 
 
 Paul Elder wrote:
 
 > Nick Mari wrote:
 >> Paul Elder wrote:
 >>> Hmmm. You are calling the generate methods directly? Then, I bet you are
 >>> directly creating an instance of JET2Context, too. If I'm right, do this
 >>> before you run your first template...
 >>>
 >>> TransformContextExtender.getInstance( your-jet2context-here
 >>> ).setTemplateLoader(new _jet_transformation() );
 >>> // _jet_transformation this is the class you inspected above..
 >>>
 >>
 >> I've done as you suggested:
 >>
 >> TransformContextExtender.getInstance(context)
 >> 						.setTemplateLoader(new _jet_transformation());
 >>
 >> But there's an error saying  "the method
 >> setTemplateLoader(_jet_transformation) is undefined for the type
 >> TransformContextExtender"
 >>
 >>
 >
 > It seems spell checkers don't check my Java code :-(. I meant:
 >
 > TransformContextExtender.getInstance(context).setLoader(
 >      new _jet_transformation());
 >
 >> This is what I do to be able to call the generate method directly:
 >>
 >> JET2Context context = new JET2Context(getSource());
 >> JET2Writer out = new BodyContentWriter();
 >> context.setTagFactory(new TagFactoryImpl(context));
 >>
 >> Thanks for your help
 >>
 >> Nick
 >
 > Paul
 |  |  |  | 
 
 
 Current Time: Fri Oct 31 17:11:20 EDT 2025 
 Powered by FUDForum . Page generated in 0.05162 seconds |