diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-07-29 21:58:47 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-07-29 21:58:47 +0200 |
commit | 1d43c802f853b08f03c4b3954af242ad005c8afd (patch) | |
tree | 9a98da19c07fc587b6a3e2283aca707ad345e252 /subprojects/language-model/src/main/java | |
parent | build: clean up buildSrc scripts (diff) | |
download | refinery-1d43c802f853b08f03c4b3954af242ad005c8afd.tar.gz refinery-1d43c802f853b08f03c4b3954af242ad005c8afd.tar.zst refinery-1d43c802f853b08f03c4b3954af242ad005c8afd.zip |
refactor: simplify language project
* Move all utilities for language-model to language, since they do not
make sense on their own
* Convert xtend code into java
Diffstat (limited to 'subprojects/language-model/src/main/java')
-rw-r--r-- | subprojects/language-model/src/main/java/tools/refinery/language/model/ProblemEMFSetup.java | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/subprojects/language-model/src/main/java/tools/refinery/language/model/ProblemEMFSetup.java b/subprojects/language-model/src/main/java/tools/refinery/language/model/ProblemEMFSetup.java deleted file mode 100644 index 9383098b..00000000 --- a/subprojects/language-model/src/main/java/tools/refinery/language/model/ProblemEMFSetup.java +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | package tools.refinery.language.model; | ||
2 | |||
3 | import org.eclipse.emf.ecore.EPackage; | ||
4 | import org.eclipse.emf.ecore.resource.Resource; | ||
5 | |||
6 | import tools.refinery.language.model.problem.ProblemPackage; | ||
7 | import tools.refinery.language.model.problem.impl.ProblemFactoryImpl; | ||
8 | |||
9 | public class ProblemEMFSetup { | ||
10 | public static final String XMI_RESOURCE_EXTENSION = "problem_xmi"; | ||
11 | |||
12 | private ProblemEMFSetup() { | ||
13 | throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); | ||
14 | } | ||
15 | |||
16 | // Here we can't rely on java.util.HashMap#putIfAbsent, because | ||
17 | // org.eclipse.emf.ecore.impl.EPackageRegistryImpl#containsKey is overridden | ||
18 | // without also overriding putIfAbsent. We must make sure to call the | ||
19 | // overridden containsKey implementation. | ||
20 | @SuppressWarnings("squid:S3824") | ||
21 | public static void doEMFRegistration() { | ||
22 | if (!EPackage.Registry.INSTANCE.containsKey(ProblemPackage.eNS_URI)) { | ||
23 | EPackage.Registry.INSTANCE.put(ProblemPackage.eNS_URI, ProblemPackage.eINSTANCE); | ||
24 | } | ||
25 | |||
26 | // This Resource.Factory is not actually used once | ||
27 | // tools.refinery.language.ProblemStandaloneSetup.createInjectorAndDoEMFRegistration() | ||
28 | // is called, because if will be replaced by | ||
29 | // tools.refinery.language.resource.ProblemXmiResourceFactory, which implements | ||
30 | // org.eclipse.xtext.resource.IResourceFactory as required by Xtext. | ||
31 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().putIfAbsent(XMI_RESOURCE_EXTENSION, | ||
32 | new ProblemFactoryImpl()); | ||
33 | } | ||
34 | } | ||