Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Loading and running a egl on a custom profile in java (standalone)
Loading and running a egl on a custom profile in java (standalone) [message #989106] Tue, 04 December 2012 10:46 Go to next message
Chrisy Pel is currently offline Chrisy Pel
Messages: 2
Registered: December 2012
Junior Member
Hi All,

I am trying to create a standalone that uses egl on a uml model which has a custom profile applied.
Am I able to do this successful when I run a EGLTemplate through run configuration.

But when I try to replicate this programmatically, using only the UML metamodel as a parameter to the function that creates the EmfModel, I get the PackageNotFoundException for a package with URI:...
I initially had this same issue when doing it with the EGL Template through the run configuration method, but that got resolved when I manually removed the extra metamodels entries automatically loaded from the model file in the run configuration, leaving just that for UML, applying the changes before running the configuration.

I believe that is the difference between the 2 approaches.

My question is, is it possible to programmatically load a model, without it trying to expand and resolve the whole tree as the package it cannot find, though is inside the model file, does not necessarily need to be loaded in my current case.
or at least is it possible to remove some of the metamodels its loads from the model file as I manually did through the run configurations before the EmfModel object is actually returned.
Re: Loading and running a egl on a custom profile in java (standalone) [message #989213 is a reply to message #989106] Wed, 05 December 2012 04:08 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
Senior Member
Could you post the code you are using to run the EGLTemplate, so we can have a look? The code for loading the models should be basically the same for a standalone application as for our launch configurations.
Re: Loading and running a egl on a custom profile in java (standalone) [message #990917 is a reply to message #989213] Fri, 14 December 2012 16:08 Go to previous messageGo to next message
Chrisy Pel is currently offline Chrisy Pel
Messages: 2
Registered: December 2012
Junior Member
The code am using is pretty mmuch the same from the standalone egl example.

models.add(createEmfModelByURI("Model-Tester", "Tester.uml", UMLPackage.eNS_URI, true, true));

I correctly register the UML package instance in the package registry before calling the code.

the code above calls the following code in the parent class
	protected EmfModel createEmfModelByURI(String name, String model, String metamodel, boolean readOnLoad, boolean storeOnDisposal) throws EolModelLoadingException, URISyntaxException {
		StringProperties properties = new StringProperties();
		properties.put(EmfModel.PROPERTY_NAME, name);
		properties.put(EmfModel.PROPERTY_METAMODEL_URI, metamodel);
		properties.put(EmfModel.PROPERTY_MODEL_URI, "file:/" + getFile(model).getAbsolutePath());
		properties.put(EmfModel.PROPERTY_IS_METAMODEL_FILE_BASED, "false");
		properties.put(EmfModel.PROPERTY_READONLOAD, readOnLoad + "");
		properties.put(EmfModel.PROPERTY_STOREONDISPOSAL, storeOnDisposal + "");
       		emfModel.load(properties, null);
		return modelG;
	}

I hope this can help in making my question more clearer.
thanks for the help.
Re: Loading and running a egl on a custom profile in java (standalone) [message #991492 is a reply to message #990917] Wed, 19 December 2012 09:05 Go to previous message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 829
Registered: July 2009
Senior Member
Hi,

Would adding the following line of code before loading the UML model help [1,2]?

UMLResourcesUtil.init(null);

Cheers,
Dimitris

[1] http://dev.eclipse.org/mhonarc/lists/mdt-papyrus.dev/msg01526.html
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=364419
Previous Topic:[EMFatic] Reference problems in metamodel
Next Topic:[EGL] How to show in a static section different symbols?
Goto Forum:
  


Current Time: Thu Aug 21 06:18:00 EDT 2014

Powered by FUDForum. Page generated in 0.03090 seconds