Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315075 - Collision of generated generator workflow and UI
Summary: Collision of generated generator workflow and UI
Status: CLOSED WONTFIX
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 0.7.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-31 09:27 EDT by Alexander Nittka CLA
Modified: 2012-11-14 04:06 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nittka CLA 2010-05-31 09:27:13 EDT
Build Identifier: I20090611-1540

A sensible step in plugin development based on Xtext is providing the User with a UI-action for generating from the currently open file. If this action is based on invoking the generated generator workflow, there is a clash of concepts.
The MWEReader component by default gets the StandaloneSetup class as parameter. The latter creates the injector and registers the Resource factory.
For a complete standalone invokation this is OK, however, if this method is called within the UI, a factory that is already registered gets overridden.

org.eclipse.xtext.resource.IResourceFactory resourceFactory = injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(fileExtesion, resourceFactory);

Now the question is, who is making the mistake: the developer who programmatically invokes the generated workflow (well, it is allowed, isn't it), rather than using the XPandFacade directly or the framework that assumes that a workflow is always invoked in a standalone environment (here again, is it a problem in the workflow definition or in the StandaloneSetup).

Reproducible: Always
Comment 1 Sven Efftinge CLA 2012-11-14 04:06:38 EST
The IGenerator interface should be used to implement code generators, that work from within Eclipse and in Standalone.