Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [MWE2] Create projects in current workspace
[MWE2] Create projects in current workspace [message #633125] Fri, 15 October 2010 12:52 Go to next message
Jens von Pilgrim is currently offline Jens von PilgrimFriend
Messages: 313
Registered: July 2009
Senior Member
Hi,

I have written a MWE2 workflow component creating a genmodel (for a
given ecore model) and also for generating the Java code for the model.

I'm running the workflow from the Eclipse instance into which workspace
the generated artifacts are to be added, just as the Xtext workflow
generating all the nice code for a given grammar. It is working when the
project into which the code is to be generated already exists. However,
I don't know how to create new projects. As far as I understand, the MWE
workflow is running not within the JVM of the current Eclipse instance,
instead a new JVM is started executing the MWE workflow. This allows new
components to be added and debugged quite comfortable, however the
current workspace is not available to the MWE workflow. There are some
"hacks" for passing the current platform path to the workflow
components, but the workspace/platform is not available. Thus I don't
know how to create a new project and register it to the workspace.

Is it possible to run the MWE workflow within the current JVM in order
to have access to the current workspace?

Cheers,

Jens

P.S.: I have noticed that the Xtext project wizard automatically creates
the generator and ui project, even before anything has been generated
for the grammar. Could that be for the same reason? (Otherwise, the
workflow could create these projects on the fly)
Re: [MWE2] Create projects in current workspace [message #636287 is a reply to message #633125] Sat, 30 October 2010 12:41 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Jens,

please excuse the late response. Somehow, your message got lost in my
backlog ...
First of all (I don't seem to get tired by telling this everybody who
wants to hear it): Please make sure that you do not use a standalone
setup in your workflow as it is likely to mess with your package
registry and uri converters and everything ...
If you want to create new projects from an MWE workflow, you'll have to
use Eclipse's resource APIs. However, basically any other workflow
component uses the java.io.File APIs and both don't play together
nicely. That's why we use an own process for the Xtext generator and
refresh the workspace afterwards. The Xtext project wizard does not use
MWE, so we can use the resource APIs of Eclipse and show all this nice
things like progress monitors, ensure that we do not interfere with
running jobs in Eclipsee etc.
You can use MWE (even if strongly discouraged) in your current JVM but
you have to be very careful about the components that you use and you'll
have to provide a lot of context information from the outside. As there
is basically not a single workflow component available that uses
IResource and stuff, I'd recommend to skip MWE and assemble the stuff
for your usecase manually.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 15.10.10 14:52, schrieb Jens v.P.:
> Hi,
>
> I have written a MWE2 workflow component creating a genmodel (for a
> given ecore model) and also for generating the Java code for the model.
>
> I'm running the workflow from the Eclipse instance into which workspace
> the generated artifacts are to be added, just as the Xtext workflow
> generating all the nice code for a given grammar. It is working when the
> project into which the code is to be generated already exists. However,
> I don't know how to create new projects. As far as I understand, the MWE
> workflow is running not within the JVM of the current Eclipse instance,
> instead a new JVM is started executing the MWE workflow. This allows new
> components to be added and debugged quite comfortable, however the
> current workspace is not available to the MWE workflow. There are some
> "hacks" for passing the current platform path to the workflow
> components, but the workspace/platform is not available. Thus I don't
> know how to create a new project and register it to the workspace.
>
> Is it possible to run the MWE workflow within the current JVM in order
> to have access to the current workspace?
>
> Cheers,
>
> Jens
>
> P.S.: I have noticed that the Xtext project wizard automatically creates
> the generator and ui project, even before anything has been generated
> for the grammar. Could that be for the same reason? (Otherwise, the
> workflow could create these projects on the fly)
Re: [MWE2] Create projects in current workspace [message #636336 is a reply to message #633125] Sun, 31 October 2010 05:17 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Jens,

The inability of MWE(2) to access the workspace has lead to the following solution for us:

1) Drop MWE from the list of used technologies.
2) Write a UI plugin that contributes "Generate" actions to our model files.
3) Write a fluent API that calls Xpand directly. It's called by the above actions.
4) Write a WorkspaceOutlet class that automatically creates and initializes IProjects and refreshes itself after the generation phase.

We're planning to use this in CDO in the near future. If you're interested I could send you the code.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 15.10.2010 14:52, schrieb Jens v.P.:
> Hi,
>
> I have written a MWE2 workflow component creating a genmodel (for a given ecore model) and also for generating the Java code for the model.
>
> I'm running the workflow from the Eclipse instance into which workspace the generated artifacts are to be added, just as the Xtext workflow generating all the nice code for a given grammar. It is working when the project into which the code is to be generated already exists. However, I don't know how to create new projects. As far as I understand, the MWE workflow is running not within the JVM of the current Eclipse instance, instead a new JVM is started executing the MWE workflow. This allows new components to be added and debugged quite comfortable, however the current workspace is not available to the MWE workflow. There are some "hacks" for passing the current platform path to the workflow components, but the workspace/platform is not available. Thus I don't know how to create a new project and register it to the workspace.
>
> Is it possible to run the MWE workflow within the current JVM in order to have access to the current workspace?
>
> Cheers,
>
> Jens
>
> P.S.: I have noticed that the Xtext project wizard automatically creates the generator and ui project, even before anything has been generated for the grammar. Could that be for the same reason? (Otherwise, the workflow could create these projects on the fly)


Previous Topic:Generating java code from ecore by texo outside UI
Next Topic:[EMF + Tabbed Properties View] Framework to help such collaboration
Goto Forum:
  


Current Time: Thu Apr 25 08:07:15 GMT 2024

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

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

Back to the top