Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to create standalone model from .edit project in EMF?
How to create standalone model from .edit project in EMF? [message #1815588] Sun, 06 October 2019 14:44 Go to next message
Gurvir Bawa is currently offline Gurvir BawaFriend
Messages: 3
Registered: October 2019
Junior Member
I want to run my model (.genmodel) outside Eclipse (i.e. as a standalone model). I have done an extensive search on this. I know Edit projects can run standalone. For now I am trying to achieve this through a new plugin project. Below is the code. I am just not sure what is the correct method to achieve this. Any suggestions will be much appreciated. I am new to EMF, so don't know where to put in the main class i have written. Should it go under the Edit project or as a separate plugin?

import java.util.Collections;

import org.eclipse.emf.common.util.URI;
//import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
//import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;

import asdl.asdlPackage;

public class UsingEMFModel {
/** Create Resource Manager**/
public static void startResourceManager() {

/** Register factory**/
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());

/** Register package**/

/**Create ResourceSet**/
public static ResourceSet createResourceSet() {
ResourceSet rs= new ResourceSetImpl();
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new EcoreResourceFactoryImpl());
return rs;


public static void main(String[] args) {
// TODO Auto-generated method stub
/**Initiate Resource Manager**/
ResourceSet rs=UsingEMFModel.createResourceSet();

/**Get URI for model**/
URI fileURI= URI.createPlatformPluginURI("platform:/resource/TestFullIntegration/DepartureIntegration/model/landingIntegration.ecore", false);

/**Load resource for the file**/
Resource resource=rs.getResource(fileURI,true);

try {, Collections.EMPTY_MAP);

catch(IOException e) {}
Re: How to create standalone model from .edit project in EMF? [message #1815592 is a reply to message #1815588] Sun, 06 October 2019 15:11 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33077
Registered: July 2009
Senior Member
It's best to ask about EMF on the EMF forum:

EMF will generate a simple example of how to use your generated model stand alone. Just invoke Generate Test Code and look for the; it's probably called This example shows how to load and save instances of your model and runs as a normal Java Application.

Ed Merks
Professional Support:
Previous Topic:Eclipse error [wont open]
Next Topic:Problem running Eclipse PHP with WAMP & Xdebug (port conflict?)
Goto Forum:

Current Time: Wed Feb 28 07:24:50 GMT 2024

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

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

Back to the top