Trouble in loading model from Action Handler [message #1699406] |
Wed, 24 June 2015 06:47  |
Eclipse User |
|
|
|
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 #1699409 is a reply to message #1699407] |
Wed, 24 June 2015 06:58  |
Eclipse User |
|
|
|
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)
|
|
|
Powered by
FUDForum. Page generated in 0.02640 seconds