/**
 * Copyright (c) 2015 committers of YAKINDU and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 * 
 */
package org.yakindu.sct.model.resource;

import org.eclipse.emf.common.util.URI;
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.xmi.impl.XMIResourceFactoryImpl;
import org.yakindu.sct.domain.extension.DomainRegistry;
import org.yakindu.sct.domain.extension.IDomainDescriptor;

import com.google.inject.Injector;

/**
 * 
 * @author andreas muelder - Initial contribution and API
 * 
 */
public class SCTResourceFactory extends XMIResourceFactoryImpl {

	@Override
	public Resource createResource(URI uri) {
		String determinedDomainID = DomainRegistry.determineDomainID(uri);
		IDomainDescriptor domainDescriptor = DomainRegistry.getDomainDescriptor(determinedDomainID);
		Injector injector = domainDescriptor.getDomainInjectorProvider().getResourceInjector();
		Resource resource = injector.getInstance(Resource.class);
		ResourceSet set = new ResourceSetImpl();
		set.getResources().add(resource);
		resource.setURI(uri);
		return resource;
	}
}

@@ -563,16 +563,68 @@
 rceSet;%0A
+import org.eclipse.emf.ecore.resource.URIConverter;%0A
 import o
@@ -733,24 +733,87 @@
 actoryImpl;%0A
+import org.eclipse.gmf.runtime.emf.core.resources.GMFResource;%0A
 import org.y
@@ -956,20 +956,16 @@
 r;%0A%0A/**%0A
- * %0A
  * @auth
@@ -1014,20 +1014,16 @@
 and API%0A
- * %0A
  */%0Apubl
@@ -1138,16 +1138,206 @@
  uri) %7B%0A
+%0A%09%09// if file is not existing, AND no generic/default domain is available, resource creation will fail%0A%09%09if (!URIConverter.INSTANCE.exists(uri, null)) %7B%0A%09%09%09return new GMFResource(uri);%0A%09%09%7D%0A%0A
 %09%09String
@@ -1642,16 +1642,17 @@
 class);%0A
+%0A
 %09%09Resour

Create GMFResource if default/gernic domain does not exist and resource is not existing in filesystem (#785)