org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl Java Examples

The following examples show how to use org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IgnoreCaseLexerTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #2
Source File: Bug301935TestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #3
Source File: HiddenTerminalsTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #4
Source File: UnicodeStandaloneSetupGenerated.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #5
Source File: XtextTerminalsTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #6
Source File: TerminalRulesTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #7
Source File: EcoreTerminalsTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #8
Source File: EncodingTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #9
Source File: IndentationAwareTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #10
Source File: BacktrackingLexerTestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #11
Source File: Bug292245TestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #12
Source File: GamlStandaloneSetupGenerated.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #13
Source File: YangPackageImpl.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage()
{
  if (isLoaded) return;
  isLoaded = true;

  URL url = getClass().getResource(packageFilename);
  if (url == null)
  {
    throw new RuntimeException("Missing serialized package: " + packageFilename);
  }
  URI uri = URI.createURI(url.toString());
  Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
  try
  {
    resource.load(null);
  }
  catch (IOException exception)
  {
    throw new WrappedException(exception);
  }
  initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
  createResource(eNS_URI);
}
 
Example #14
Source File: Schema.java    From BIMserver with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("rawtypes")
public void loadEcore(String name, InputStream inputStream) {
       ResourceSet resourceSet = new ResourceSetImpl();
       resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
       Resource resource = resourceSet.createResource(URI.createURI(name));
       try {
		resource.load(inputStream, new HashMap());
		for (EObject eObject : resource.getContents()) {
			if (eObject instanceof EPackage) {
				EPackage ePackage = (EPackage)eObject;
				addEPackage(ePackage);
			}
		}
	} catch (IOException e) {
		LOGGER.error("", e);
	}
}
 
Example #15
Source File: GeometryPackageImpl.java    From BIMserver with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded)
		return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	} catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
	createResource(eNS_URI);
}
 
Example #16
Source File: LogPackageImpl.java    From BIMserver with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded)
		return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	} catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
	createResource(eNS_URI);
}
 
Example #17
Source File: StorePackageImpl.java    From BIMserver with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded)
		return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	} catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
	createResource(eNS_URI);
}
 
Example #18
Source File: Bpmn2PackageImpl.java    From fixflow with Apache License 2.0 6 votes vote down vote up
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
    if (isLoaded)
        return;
    isLoaded = true;

    URL url = getClass().getResource(packageFilename);
    if (url == null) {
        throw new RuntimeException("Missing serialized package: " + packageFilename);
    }
    URI uri = URI.createURI(url.toString());
    Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
    try {
        resource.load(null);
    } catch (IOException exception) {
        throw new WrappedException(exception);
    }
    initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
    createResource(eNS_URI);
}
 
Example #19
Source File: ModelPackageImpl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded) return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	}
	catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
	createResource(eNS_URI);
}
 
Example #20
Source File: XtypeStandaloneSetupGenerated.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #21
Source File: AbstractPortableURIsTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	globalStateMemento = GlobalRegistries.makeCopyOfGlobalState();
	EPackage.Registry.INSTANCE.put(XMLTypePackage.eNS_URI, XMLTypePackage.eINSTANCE);
	resourceSet = new XtextResourceSet();
	resourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
	resourceSet.getPackageRegistry().put(GenModelPackage.eNS_URI, GenModelPackage.eINSTANCE);
	resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("genmodel", new EcoreResourceFactoryImpl());
	resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
	resourceSet.getURIConverter().getURIMap().put(URI.createPlatformPluginURI("org.eclipse.xtext/", false), URI.createURI("classpath:/"));
	resourceSet.getURIConverter().getURIMap().put(URI.createPlatformPluginURI("org.eclipse.xtext.xbase/", false), URI.createURI("classpath:/"));
	resourceSet.getURIConverter().getURIMap().put(URI.createPlatformPluginURI("org.eclipse.xtext.common.types/", false), URI.createURI("classpath:/"));
	resourceSet.getURIConverter().getURIMap().put(URI.createPlatformResourceURI("org.eclipse.emf.ecore/", false), URI.createURI("classpath:/"));
	resourceSet.getURIConverter().getURIMap().put(URI.createPlatformResourceURI("org.eclipse.xtext.xbase/", false), URI.createURI("classpath:/"));
	resourceSet.getURIConverter().getURIMap().put(URI.createPlatformResourceURI("org.eclipse.xtext.common.types/", false), URI.createURI("classpath:/"));
	resourceSet.getLoadOptions().put(XMLResource.OPTION_URI_HANDLER, this);
	resourceSet.setClasspathURIContext(getClasspathURIContext());
}
 
Example #22
Source File: XtextLinkingService.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
private List<EObject> createPackage(GeneratedMetamodel generatedMetamodel, ILeafNode text) {
	final String nsURI = getMetamodelNsURI(text);
	final URI uri = URI.createURI(nsURI);
	if (uri == null || isReferencedByUsedGrammar(generatedMetamodel, nsURI))
		return Collections.emptyList();
	EPackage pack = ((GeneratedMetamodelImpl)generatedMetamodel).basicGetEPackage();
	if (pack != null && !pack.eIsProxy())
		return singletonList((EObject)pack);
	final EPackage generatedEPackage = EcoreFactory.eINSTANCE.createEPackage();
	generatedEPackage.setName(generatedMetamodel.getName());
	generatedEPackage.setNsPrefix(generatedMetamodel.getName());
	generatedEPackage.setNsURI(nsURI);
	final Resource generatedPackageResource = new EcoreResourceFactoryImpl().createResource(uri);
	XtextResourceSet resourceSet = (XtextResourceSet) generatedMetamodel.eResource().getResourceSet();
	if (!resourceSet.getURIResourceMap().containsKey(generatedPackageResource.getURI())) {
		generatedMetamodel.eResource().getResourceSet().getResources().add(generatedPackageResource);
	} else {
		generatedPackageResource.setURI(URI.createURI(nsURI+"_"+generatedMetamodel.hashCode()));
		generatedMetamodel.eResource().getResourceSet().getResources().add(generatedPackageResource);
	}
	generatedPackageResource.getContents().add(generatedEPackage);
	return Collections.<EObject>singletonList(generatedEPackage);
}
 
Example #23
Source File: TerminalsStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #24
Source File: CodetemplatesStandaloneSetupGenerated.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #25
Source File: EncodingUiTestLanguageStandaloneSetupGenerated.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #26
Source File: Bug303200TestLanguageStandaloneSetupGenerated.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #27
Source File: ContentAssistNoTerminalExtensionTestLanguageStandaloneSetupGenerated.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #28
Source File: Bug406914TestLanguageStandaloneSetupGenerated.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #29
Source File: XmlStandaloneSetupGenerated.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}
 
Example #30
Source File: Bug347012TestLanguageStandaloneSetupGenerated.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Injector createInjectorAndDoEMFRegistration() {
	// register default ePackages
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"ecore", new EcoreResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xmi", new XMIResourceFactoryImpl());
	if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xtextbin"))
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
			"xtextbin", new BinaryGrammarResourceFactoryImpl());
	if (!EPackage.Registry.INSTANCE.containsKey(XtextPackage.eNS_URI))
		EPackage.Registry.INSTANCE.put(XtextPackage.eNS_URI, XtextPackage.eINSTANCE);

	Injector injector = createInjector();
	register(injector);
	return injector;
}