use of org.eclipse.emf.ecore.resource.Resource in project tdi-studio-se by Talend.
the class JSONRepositoryContentHandler method create.
@Override
public Resource create(IProject project, Item item, int classifierID, IPath path) throws PersistenceException {
Resource itemResource = null;
ERepositoryObjectType type;
switch(classifierID) {
case JsonPackage.JSON_FILE_CONNECTION_ITEM:
if (item != null && item instanceof JSONFileConnectionItem) {
type = JSONRepositoryNodeType.JSON;
itemResource = create(project, (JSONFileConnectionItem) item, path, type);
return itemResource;
}
default:
return itemResource;
}
}
use of org.eclipse.emf.ecore.resource.Resource in project benchmarx by eMoflon.
the class MediniQVTFamiliesToPersonsConfig method saveModels.
/**
* Allows to save the current state of the source and target models
*
* @param name : Filename
*/
public void saveModels(String name) {
ResourceSet set = new ResourceSetImpl();
set.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
URI srcURI = URI.createFileURI(RESULTPATH + "/" + name + "Family.xmi");
URI trgURI = URI.createFileURI(RESULTPATH + "/" + name + "Person.xmi");
Resource resSource = set.createResource(srcURI);
Resource resTarget = set.createResource(trgURI);
EObject colSource = EcoreUtil.copy(getSourceModel());
EObject colTarget = EcoreUtil.copy(getTargetModel());
resSource.getContents().add(colSource);
resTarget.getContents().add(colTarget);
try {
resSource.save(null);
resTarget.save(null);
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.eclipse.emf.ecore.resource.Resource in project benchmarx by eMoflon.
the class EMoflonFamiliesToPersons method initiateSynchronisationDialogue.
@Override
public void initiateSynchronisationDialogue() {
BasicConfigurator.configure();
helper = new F2PSyncHelper();
Resource r = helper.getResourceSet().createResource(URI.createURI("sourceModel"));
FamilyRegister familiesRoot = FamiliesFactory.eINSTANCE.createFamilyRegister();
r.getContents().add(familiesRoot);
// Fix default preferences (which can be overwritten)
setConfigurator(new Configurator<Decisions>().makeDecision(Decisions.PREFER_CREATING_PARENT_TO_CHILD, true).makeDecision(Decisions.PREFER_EXISTING_FAMILY_TO_NEW, true));
// perform batch to establish consistent starting state
helper.setSrc(familiesRoot);
helper.integrateForward();
helper.setMute(true);
}
Aggregations