Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Efficient Development with a user plugin in JET2
Efficient Development with a user plugin in JET2 [message #53649] Wed, 03 December 2008 22:48 Go to next message
Paul Hammond is currently offline Paul HammondFriend
Messages: 17
Registered: July 2009
Junior Member
Hi,

Supposing you create your own taglibs for JET2, configure everything in
JET for it, and then export it into a plugin, drop it into your plugins
directory, and restart Eclipse with -clean. This all works but then you
discover there's a small bug in one of your tags. It's quite a lengthy
process to re-export and restart Eclipse with -clean.

Re-exporting is not so bad, but restarting Eclipse with -clean is a 5
minute turnaround.

Is there any more efficient way of working with JET here because I believe
there's no way of loading custom taglibs into JET2 but via the plugin
mechanism?

Thx.

Paul
Re: Efficient Development with a user plugin in JET2 [message #53674 is a reply to message #53649] Thu, 04 December 2008 14:49 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Paul:

Here are a couple of alternatives:

1) JET projects and JET tag libraries are plug-ins. Instead of
running/testing the JET Project in your development environment, create what
I still call a Runtime Workbench (Run > Run Configurations, then create an
new Eclipse Application). Then, simply do all your testing by first
launching that workbench, and running your JET transformation there.

Bonus tip: Launch the runtime workbench in Debug (using the Debug menu
instead of Run), and take advantage of the JVMs hot code replacement
capabilities. There are limits to this, but changing method bodies and
editing JET templates generally work quite well without requiring a
relaunch. You have the best chances of a code replacement working if the
code isn't active, so let the JET transformation finish, then make your code
edits in your development workspace, and the run the JET transformation
again from the runtime workbench - no relaunch needed! Only times you'd need
a relaunch are if you've changes manifest files (MANIFEST.MF, plugin.xml),
or if the JVM tells you so.

2) Continue with your current process, but try doing without -clean. I can't
remember the last time I used it - I typically use it only as a last resort.

Paul
Re: Efficient Development with a user plugin in JET2 [message #53698 is a reply to message #53674] Thu, 04 December 2008 20:33 Go to previous messageGo to next message
Paul Hammond is currently offline Paul HammondFriend
Messages: 17
Registered: July 2009
Junior Member
Thanks Paul, they sound like reasonable workarounds, I'll give them a go
and see how I fare.

Paul
Re: Efficient Development with a user plugin in JET2 [message #53775 is a reply to message #53698] Mon, 08 December 2008 09:54 Go to previous messageGo to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hey,

for XPath functions, it is very easy to setup a junit plugin test. I've
done the implementation of my xpath function in this way and this is,
imho, the best way to test an implementation. This works since the
method body doesn't try to collect information from the template via the
context object.

I know, that tag functionality requires more setup configuration, but i
think, this should be also possible in some situations. Correct me if i
am wrong, Paul.

Timothy

Pau schrieb:
> Thanks Paul, they sound like reasonable workarounds, I'll give them a go
> and see how I fare.
>
> Paul
>
>
>
Re: Efficient Development with a user plugin in JET2 [message #53802 is a reply to message #53775] Mon, 08 December 2008 13:44 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Timothy:

I is a bit of a task setup up JUnits on tags. I wonder whether this could be
made easier with the help of a transformation :-)

I have setup some (but not enough) JUnits of tags, were I actually run an
entire JET transform, and then look at the generated files to see if I get
what I thought I should. But, somehow, this runs a bit counter to the idea
of a JUnit.

Paul
Re: Efficient Development with a user plugin in JET2 [message #54047 is a reply to message #53674] Mon, 15 December 2008 18:08 Go to previous messageGo to next message
Paul Hammond is currently offline Paul HammondFriend
Messages: 17
Registered: July 2009
Junior Member
Hi Paul,

I tried this run a separate workbench thing. After I've created one, I'm
not sure what I do then? I can't see any of my previous projects as the
new workbench is completely empty. And there is no 'Open Project' option,
only 'New Project'. I don't really want to create a New Project, just run
one of my existing ones.

What exactly do I need to do there to achieve the desired affect of
developing in one workbench, and running/test in another so that changes
in my development workbench are immediately reflected in my runtime bench
without any restarting (of course I need to restart for plugin config
changes, that's fine)

Thx.

Paul
Re: Efficient Development with a user plugin in JET2 [message #54205 is a reply to message #54047] Tue, 16 December 2008 13:30 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Paul:

A 'runtime workbench' is an Eclipse instance, with the plug-in projeccts you
are working on installed. It is primarily used by Eclipse plug-in developers
to test and debug their changes. Since JET projects are Eclipse plug-ins, it
can also be used to test and debug them.

But, as you notices, the runtime workbench starts out with an empty
workspace. But, rest assured, your JET transformation is available. To run
your transformation:
1) create a project, and create some test input in it.
2) From the Run menu, choose Run > Run Configuration, then select JET
Transformation and click the 'new' icon. Browse for your input, and select
your JET transformation's id. Click Run.

Paul
Re: Efficient Development with a user plugin in JET2 [message #54441 is a reply to message #54205] Wed, 17 December 2008 15:58 Go to previous messageGo to next message
Paul Hammond is currently offline Paul HammondFriend
Messages: 17
Registered: July 2009
Junior Member
Paul,

Just so I understand this, once I have the Run workbench up in debug mode,
it will hot patch any change to my plugins I make, either the JET Project
and templates itself, or my custom tags Java plugin that my JET project
depends on? And I don't have to export these plugins to JARs each from my
dev environment? Can my JET project then purely have a project dependency
on my custom plugin as opposed to a plugin dependency? Or does it always
have to be a plugin dependency and in such case, is it always necessary to
push every change out to a JAR in the plugins directory so the runtime
workbench picks it up? Or can the workbench pick a change up say in my
local custom tags Java project without any export?

I notice you can close a plugin project, and when you do if you look at
the project dependencies on say the JET project which depends on the
project you closed, there's a dark arrow missing on the plugin icon if the
project is open, but is present if it's closed. Is this saying that if
open, it uses the local version in the workspace project folder, but if
it's closed, it uses the version in the JAR in the plugins directory? And
this relationship would then be maintained in the runtime workbench?

Paul
Re: Efficient Development with a user plugin in JET2 [message #54521 is a reply to message #54441] Wed, 17 December 2008 17:19 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Paul: answers in-line:

"Pau" <paul_hammond@hotmail.com> wrote in message
news:8a4eafc20f25f7f45b57b9fbdc25229d$1@www.eclipse.org...
> Paul,
>
> Just so I understand this, once I have the Run workbench up in debug mode,
> it will hot patch any change to my plugins I make, either the JET Project
> and templates itself, or my custom tags Java plugin that my JET project
> depends on(1)? And I don't have to export these plugins to JARs each from
> my dev environment (2)? Can my JET project then purely have a project
> dependency on my custom plugin as opposed to a plugin dependency (3)? Or
> does it always have to be a plugin dependency and in such case, is it
> always necessary to push every change out to a JAR in the plugins
> directory so the runtime workbench picks it up(4)? Or can the workbench
> pick a change up say in my local custom tags Java project without any
> export(5)?
>

(1)Yes, you can just change things w/o restart. The exceptions: changes to
plugin.xml and MANIFEST.MF don't get picked-up - you'd need to restart the
debug session.
(2) No, you don't need to export plug-in JARs to your local dev env if you
use a runtime workbench.
(3) No, don't use project dependencies. OSGi only understands plug-in
dependencies (I.e. those declared in the Plug-in Manifest editor)
(4) Always use plug-in dependencies. Don't bother exporting them to JARs.
(5) The JRE (assuming is hot-code replace enabled) will pick up any changes
to Java classes in plug-in projects in your workspace. No export required.

> I notice you can close a plugin project, and when you do if you look at
> the project dependencies on say the JET project which depends on the
> project you closed, there's a dark arrow missing on the plugin icon if the
> project is open, but is present if it's closed. Is this saying that if
> open, it uses the local version in the workspace project folder, but if
> it's closed, it uses the version in the JAR in the plugins directory(6)?
> And this relationship would then be maintained in the runtime workbench
> (7)?

(6) Haven't noticed that. But, that is a fair summary. The runtime work
bench uses the plug-ins specified in its launch configuration on the
Plug-ins tab. There are number of settings - I typically choose "plug-ins
selected below only", and list the workspace and target environment plug-in
explicitly. If you choose one of the other options, I believe (not 100%
sure) that the config would give preference to open workspace projects over
already installed plug-ins.
(7) Yes.


>
> Paul
>
>
>
Re: Efficient Development with a user plugin in JET2 [message #54601 is a reply to message #54521] Wed, 17 December 2008 19:29 Go to previous messageGo to next message
Paul Hammond is currently offline Paul HammondFriend
Messages: 17
Registered: July 2009
Junior Member
Ok, I tried it and launched an org.eclipse.ui.ide.workbench. JET2 0.9.1
btw.

But then I got an IllegalArgumentException when I tried to run my
transformation in the workbench having selecting my transform and input
sample.xml at /my plugin name/sample.xml

java.lang.IllegalArgumentException
at
org.eclipse.jet.internal.launch.JET2TransformationDelegate.g etSource(JET2TransformationDelegate.java:69)
at
org.eclipse.jet.internal.launch.JET2TransformationDelegate.l aunch(JET2TransformationDelegate.java:54)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:764)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:614)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:880)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlu gin.java:1083)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

So....

Line 69 JET2TransformationDelegate

String sourcePath =
configuration.getAttribute(JETLaunchConstants.SOURCE, (String)null);

and

public static final String SOURCE = JET2Platform.PLUGIN_ID + "." +
"source"; //$NON-NLS-1$ //$NON-NLS-2$

and

public static final String PLUGIN_ID = "org.eclipse.jet"; //$NON-NLS-1$


So it's trying to get some resource called org.eclipse.jet.source but
failing.

Any ideas what is happening here?

Paul
Re: Efficient Development with a user plugin in JET2 [message #54628 is a reply to message #54601] Thu, 18 December 2008 14:36 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Paul:

This is happening because the input/source file to the transformation cannot
be found. Click Run > Run Configurations, find your JET launch config in the
JET Transformations list, and use the Browse button to select your source
file. (And, of course, if it isn't there, create it).

Clearly a better error handling is in order. I've submitted
https://bugs.eclipse.org/bugs/show_bug.cgi?id=259258

Paul
Re: Efficient Development with a user plugin in JET2 [message #54654 is a reply to message #54628] Sun, 21 December 2008 09:17 Go to previous messageGo to next message
Paul Hammond is currently offline Paul HammondFriend
Messages: 17
Registered: July 2009
Junior Member
Hi Paul,

The file isn't there because runtime workbenches are created in their own
workspaces, so when I browse for the file, the new workspace is empty and
I can select nothing.

So I create an empty project, and create a simple sample.xml containing
just a root node and I'm able to run my JET transform.

But of course every ws:file or c:include reference now fails because these
are all relative to my original developer workspace and can't be seen in
my runtime workbench. The runtime workbench when it runs the transform
seems to interpret the paths relative to it, and not relative to the
development workspace which I thought would be the useful interpretation.

How can I get around this, a runtime workbench has to run in its own
private workspace?

Paul
Re: Efficient Development with a user plugin in JET2 [message #55416 is a reply to message #54654] Wed, 14 January 2009 16:30 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Paul:

Sorrying for taking so long...

A workspace may not be used simultaneously by two running Eclipse instances.
So, a runtime workbench must necessarily have a separate workspace than the
development one.

But, I'm confused as to how c:include's can be failing. Yes, the template
path's are relative to the JET project, but the compiled JET templates
contain all the information necessary to resolve these templates. Same goes
for the template attribute in ws:file.

Are you getting messages like:
Error: Could not find template templates/dumpX.jet

?

There are a number of tags that take relative paths for which the context
can be switched from the JET transformation to the current workspace. This
include c:load and ws:copyfile.

If you are using these and are copying out of the workspace, you'd need to
import these projects into your runtime workbench. There is an import wizard
that can import projects into a workspace (File > Import, then General >
Existing Project into workspace).

Paul
Previous Topic:Existing question
Next Topic:Nested packages in input ecore file
Goto Forum:
  


Current Time: Thu Apr 18 13:18:36 GMT 2024

Powered by FUDForum. Page generated in 0.03076 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top