Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Trouble in loading model from Action Handler(Trouble in loading model from Action Handler)
Trouble in loading model from Action Handler [message #1699406] Wed, 24 June 2015 06:47 Go to next message
Babu M is currently offline Babu MFriend
Messages: 20
Registered: February 2012
Junior Member
Hi,

I have trouble in invoking the following code from an eclipse action handler. However, this code snippet is working fine if i launch it as standalone programme.

Any help on whats going wrong?


var FILE = "C:\\\\New\\AUTOSAR_ECUConfigurationParameters.arxml"
val vsmdUri = URI.createFileURI(FILE);
val inst = Autosar40Package.eINSTANCE
val relDesc = Autosar40ReleaseDescriptor.INSTANCE
val resFactory = new Autosar40ResourceFactoryImpl()
if (MetaModelDescriptorRegistry.INSTANCE.getDescriptor(relDesc.getIdentifier()) == null) {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("arxml", resFactory);
MetaModelDescriptorRegistry.INSTANCE.addDescriptor(relDesc);
}
resFactory.createResource(vsmdUri)
val resource = new AutosarStandaloneResourceSet().getResource(vsmdUri, true);
val auto = resource.getContents().get(0) as AUTOSAR;
println(auto)
Re: Trouble in loading model from Action Handler [message #1699407 is a reply to message #1699406] Wed, 24 June 2015 06:48 Go to previous messageGo to next message
Babu M is currently offline Babu MFriend
Messages: 20
Registered: February 2012
Junior Member
i do not wish to use any mwe2 workflow for this purpose. Please suggest.
Re: Trouble in loading model from Action Handler [message #1699409 is a reply to message #1699407] Wed, 24 June 2015 06:58 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12243
Registered: July 2009
Senior Member
once more this is a question to ask at autosar (or at least at sphinx) and not here
In a handler you should not need that ?!?

val IFile file = ....
val IProject project = file.getProject();

				ModelLoadManager::INSTANCE.loadProject(project, true, Autosar40ReleaseDescriptor.INSTANCE, false, null);
				val TransactionalEditingDomain editingDomain = WorkspaceEditingDomainUtil.
					getEditingDomain(project, Autosar40ReleaseDescriptor.INSTANCE);

				val resource = EcorePlatformUtil.loadResource(editingDomain, file, null)
				EcoreUtil2.resolveAll(resource)


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Method to save and edit values in ACCELEO templates
Next Topic:MoDisco Model to Java Source Code
Goto Forum:
  


Current Time: Tue Sep 25 22:30:55 GMT 2018

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

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

Back to the top