diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.yakinduModelExtractor/src/hu/bme/mit/inf/yakinduModelExtractor/ModelManager.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.yakinduModelExtractor/src/hu/bme/mit/inf/yakinduModelExtractor/ModelManager.java | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/Domains/hu.bme.mit.inf.yakinduModelExtractor/src/hu/bme/mit/inf/yakinduModelExtractor/ModelManager.java b/Domains/hu.bme.mit.inf.yakinduModelExtractor/src/hu/bme/mit/inf/yakinduModelExtractor/ModelManager.java index 85fd208c..951e44a3 100644 --- a/Domains/hu.bme.mit.inf.yakinduModelExtractor/src/hu/bme/mit/inf/yakinduModelExtractor/ModelManager.java +++ b/Domains/hu.bme.mit.inf.yakinduModelExtractor/src/hu/bme/mit/inf/yakinduModelExtractor/ModelManager.java | |||
@@ -1,21 +1,21 @@ | |||
1 | package hu.bme.mit.inf.yakinduModelExtractor; | 1 | package hu.bme.mit.inf.yakinduModelExtractor; |
2 | 2 | ||
3 | import java.io.BufferedWriter; | 3 | import java.io.BufferedWriter; |
4 | import java.io.File; | 4 | import java.io.File; |
5 | import java.io.FileOutputStream; | 5 | import java.io.FileOutputStream; |
6 | import java.io.IOException; | 6 | import java.io.IOException; |
7 | import java.io.OutputStreamWriter; | 7 | import java.io.OutputStreamWriter; |
8 | import java.io.Writer; | 8 | import java.io.Writer; |
9 | import java.util.LinkedList; | 9 | import java.util.LinkedList; |
10 | import java.util.List; | 10 | import java.util.List; |
11 | 11 | ||
12 | import org.eclipse.emf.common.util.URI; | 12 | import org.eclipse.emf.common.util.URI; |
13 | import org.eclipse.emf.ecore.EObject; | 13 | import org.eclipse.emf.ecore.EObject; |
14 | import org.eclipse.emf.ecore.resource.Resource; | 14 | import org.eclipse.emf.ecore.resource.Resource; |
15 | import org.eclipse.emf.ecore.resource.ResourceSet; | 15 | import org.eclipse.emf.ecore.resource.ResourceSet; |
16 | import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; | 16 | import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; |
17 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; | 17 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; |
18 | import org.eclipse.gmf.runtime.notation.NotationPackage; | 18 | import org.eclipse.gmf.runtime.notation.NotationPackage; |
19 | import org.yakindu.sct.model.sgraph.SGraphPackage; | 19 | import org.yakindu.sct.model.sgraph.SGraphPackage; |
20 | 20 | ||
21 | public class ModelManager { | 21 | public class ModelManager { |
@@ -28,27 +28,27 @@ public class ModelManager { | |||
28 | public void init() { | 28 | public void init() { |
29 | SGraphPackage.eINSTANCE.eClass(); | 29 | SGraphPackage.eINSTANCE.eClass(); |
30 | NotationPackage.eINSTANCE.eClass(); | 30 | NotationPackage.eINSTANCE.eClass(); |
31 | resourceSet = new ResourceSetImpl(); | 31 | resourceSet = new ResourceSetImpl(); |
32 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); | 32 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); |
33 | } | 33 | } |
34 | 34 | ||
35 | public List<String> loadAllModelPathsInDirectory(String path) { | 35 | public List<String> loadAllModelPathsInDirectory(String path) { |
36 | File directory = new File(path); | 36 | File directory = new File(path); |
37 | if(directory.exists() && directory.isDirectory()) { | 37 | if(directory.exists() && directory.isDirectory()) { |
38 | List<String> filePaths = new LinkedList<>(); | 38 | List<String> filePaths = new LinkedList<>(); |
39 | for(File f : directory.listFiles()) { | 39 | for(File f : directory.listFiles()) { |
40 | if(f.isFile()) { | 40 | if(f.isFile()) { |
41 | String filePath = f.getPath(); | 41 | String filePath = f.getPath(); |
42 | if(filePath.endsWith("sct")) { | 42 | if(filePath.endsWith("sct")) { |
43 | filePaths.add(filePath); | 43 | filePaths.add(filePath); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | } | 46 | } |
47 | return filePaths; | 47 | return filePaths; |
48 | } else { | 48 | } else { |
49 | throw new IllegalArgumentException("invalid path"); | 49 | throw new IllegalArgumentException("invalid path"); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | public EObject loadModel(String path) { | 53 | public EObject loadModel(String path) { |
54 | Resource resource = this.resourceSet.getResource(URI.createFileURI(path), true); | 54 | Resource resource = this.resourceSet.getResource(URI.createFileURI(path), true); |