diff options
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner')
-rw-r--r-- | Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend index 97fff9c6..f373d910 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/StandaloneScriptExecutor.xtend | |||
@@ -32,7 +32,7 @@ class StandaloneScriptExecutor { | |||
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | def static executeScript(String path){ | 35 | def static loadScript(String path) { |
36 | //Initialise extensions | 36 | //Initialise extensions |
37 | EMFPatternLanguageStandaloneSetup.doSetup | 37 | EMFPatternLanguageStandaloneSetup.doSetup |
38 | ApplicationConfigurationStandaloneSetup.doSetup | 38 | ApplicationConfigurationStandaloneSetup.doSetup |
@@ -49,8 +49,8 @@ class StandaloneScriptExecutor { | |||
49 | try{ | 49 | try{ |
50 | resource = resourceSet.getResource(URI.createURI(path),true) | 50 | resource = resourceSet.getResource(URI.createURI(path),true) |
51 | } catch(Exception e) { | 51 | } catch(Exception e) { |
52 | val message = '''Unable to load Configuration Script!''' | 52 | val message = '''Unable to load Configuration Script! «e.message»''' |
53 | return message | 53 | throw new IllegalArgumentException(message) |
54 | } | 54 | } |
55 | 55 | ||
56 | EcoreUtil::resolveAll(resource) | 56 | EcoreUtil::resolveAll(resource) |
@@ -58,11 +58,10 @@ class StandaloneScriptExecutor { | |||
58 | if(errors.empty) { | 58 | if(errors.empty) { |
59 | val content = resource.contents.head | 59 | val content = resource.contents.head |
60 | if(content instanceof ConfigurationScript) { | 60 | if(content instanceof ConfigurationScript) { |
61 | val executor = new ScriptExecutor | 61 | return content |
62 | executor.executeScript(content,new NullProgressMonitor) | ||
63 | } else { | 62 | } else { |
64 | val message = '''Content is not a Configuration Script! (Found : «content.class.simpleName»)''' | 63 | val message = '''Content is not a Configuration Script! (Found : «content.class.simpleName»)''' |
65 | return message | 64 | throw new IllegalArgumentException(message) |
66 | } | 65 | } |
67 | } else { | 66 | } else { |
68 | val message = ''' | 67 | val message = ''' |
@@ -71,11 +70,21 @@ class StandaloneScriptExecutor { | |||
71 | «"\t"»«error.message» | 70 | «"\t"»«error.message» |
72 | «ENDFOR» | 71 | «ENDFOR» |
73 | ''' | 72 | ''' |
74 | return message | 73 | throw new IllegalArgumentException(message) |
75 | } | 74 | } |
76 | } else { | 75 | } else { |
77 | val message = '''Unsupported file extension: «ext»''' | 76 | throw new IllegalArgumentException('''Unsupported file extension: «ext»''') |
78 | return message | 77 | } |
78 | } | ||
79 | |||
80 | def static executeScript(String path){ | ||
81 | val executor = new ScriptExecutor | ||
82 | try{ | ||
83 | val content = loadScript(path) | ||
84 | executor.executeScript(content,new NullProgressMonitor) | ||
85 | return null | ||
86 | } catch(Exception e) { | ||
87 | return e.message | ||
79 | } | 88 | } |
80 | } | 89 | } |
81 | } \ No newline at end of file | 90 | } \ No newline at end of file |