Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java')
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java
new file mode 100644
index 00000000..ab1e117c
--- /dev/null
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java
@@ -0,0 +1,56 @@
+/*
+ * <copyright>
+ *
+ * Copyright (c) 2005-2006 Sven Efftinge (http://www.efftinge.de) 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:
+ * Sven Efftinge (http://www.efftinge.de) - Initial API and implementation
+ *
+ * </copyright>
+ */
+package org.eclipse.xtend.typesystem.emf;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.mwe.core.ConfigurationException;
+import org.eclipse.xtend.typesystem.MetaModel;
+
+public class EmfMetaModel extends EmfRegistryMetaModel implements MetaModel {
+ private EPackage metamodel;
+
+ public EmfMetaModel() {
+ }
+
+ public EmfMetaModel(final EPackage metamodel) {
+ this.metamodel = metamodel;
+ }
+
+ public void setMetaModelDescriptor(final String ePackageDescriptor) {
+ metamodel = EcoreUtil2.getEPackageByDescriptorClassName(ePackageDescriptor);
+ if (metamodel == null) {
+ throw new ConfigurationException("Couldn't find ePackage Descriptor '" + ePackageDescriptor);
+ }
+ }
+
+ public void setMetaModelPackage(final String ePackage) {
+ metamodel = EcoreUtil2.getEPackageByClassName(ePackage);
+ if (metamodel == null) {
+ throw new ConfigurationException("Couldn't find ePackage '" + ePackage);
+ }
+ }
+
+ public void setMetaModelFile(final String metaModelFile) {
+ metamodel = EcoreUtil2.getEPackage(metaModelFile);
+ if (metamodel == null) {
+ throw new ConfigurationException("Couldn't load ecore file '" + metaModelFile);
+ }
+ }
+
+ @Override
+ protected EPackage[] allPackages() {
+ return new EPackage[]{metamodel};
+ }
+} \ No newline at end of file

Back to the top