diff options
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend')
-rw-r--r-- | Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend index c9ec68bb..3941179a 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptExecutor.xtend | |||
@@ -4,6 +4,7 @@ import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigRef | |||
4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification | 4 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigSpecification |
5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript | 5 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ConfigurationScript |
6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.CustomEntry | 6 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.CustomEntry |
7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.DocumentLevelSpecification | ||
7 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.DocumentationEntry | 8 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.DocumentationEntry |
8 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.EPackageImport | 9 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.EPackageImport |
9 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileReference | 10 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.FileReference |
@@ -24,19 +25,24 @@ import hu.bme.mit.inf.dslreasoner.application.execution.util.ApplicationConfigur | |||
24 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel | 25 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel |
25 | import java.util.LinkedHashMap | 26 | import java.util.LinkedHashMap |
26 | import java.util.Optional | 27 | import java.util.Optional |
27 | import org.eclipse.emf.common.util.URI | ||
28 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.DocumentLevelSpecification | ||
29 | import org.eclipse.core.runtime.jobs.Job | ||
30 | import org.eclipse.core.runtime.IProgressMonitor | 28 | import org.eclipse.core.runtime.IProgressMonitor |
31 | import org.eclipse.core.runtime.Status | 29 | import org.eclipse.core.runtime.Status |
30 | import org.eclipse.core.runtime.jobs.Job | ||
31 | import org.eclipse.emf.common.util.URI | ||
32 | import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor | ||
33 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ObjectiveSpecification | ||
34 | import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ObjectiveReference | ||
32 | 35 | ||
36 | @FinalFieldsConstructor | ||
33 | class ScriptExecutor { | 37 | class ScriptExecutor { |
34 | val parser = new ApplicationConfigurationParser | 38 | val parser = new ApplicationConfigurationParser |
35 | 39 | ||
40 | val ScriptConsole.Factory scriptConsoleFactory | ||
41 | |||
36 | /** | 42 | /** |
37 | * Executes a script | 43 | * Executes a script |
38 | */ | 44 | */ |
39 | public def executeScript(URI uri) { | 45 | def executeScript(URI uri) { |
40 | val job = new Job('''Model Generation: «uri.lastSegment»''') { | 46 | val job = new Job('''Model Generation: «uri.lastSegment»''') { |
41 | override protected run(IProgressMonitor monitor) { | 47 | override protected run(IProgressMonitor monitor) { |
42 | try{ | 48 | try{ |
@@ -53,7 +59,7 @@ class ScriptExecutor { | |||
53 | job.schedule(); | 59 | job.schedule(); |
54 | } | 60 | } |
55 | 61 | ||
56 | public def executeScript(ConfigurationScript script, IProgressMonitor monitor) { | 62 | def executeScript(ConfigurationScript script, IProgressMonitor monitor) { |
57 | script.activateAllEPackageReferences | 63 | script.activateAllEPackageReferences |
58 | val tasks = script.commands.filter(Task) | 64 | val tasks = script.commands.filter(Task) |
59 | 65 | ||
@@ -90,12 +96,12 @@ class ScriptExecutor { | |||
90 | // } | 96 | // } |
91 | } | 97 | } |
92 | 98 | ||
93 | def public dispatch execute(GenerationTask task, IProgressMonitor monitor) { | 99 | def dispatch void execute(GenerationTask task, IProgressMonitor monitor) { |
94 | val generationTaskExecutor = new GenerationTaskExecutor | 100 | val generationTaskExecutor = new GenerationTaskExecutor |
95 | generationTaskExecutor.executeGenerationTask(task,this,monitor) | 101 | generationTaskExecutor.executeGenerationTask(task,this,scriptConsoleFactory,monitor) |
96 | } | 102 | } |
97 | 103 | ||
98 | def public dispatch execute(Task task, IProgressMonitor monitor) { | 104 | def dispatch void execute(Task task, IProgressMonitor monitor) { |
99 | throw new IllegalArgumentException('''Unsupported task type: «task.class.simpleName»!''') | 105 | throw new IllegalArgumentException('''Unsupported task type: «task.class.simpleName»!''') |
100 | } | 106 | } |
101 | 107 | ||
@@ -170,6 +176,16 @@ class ScriptExecutor { | |||
170 | null | 176 | null |
171 | } | 177 | } |
172 | 178 | ||
179 | def dispatch getObjectiveSpecification(ObjectiveSpecification config) { | ||
180 | config | ||
181 | } | ||
182 | def dispatch getObjectiveSpecification(ObjectiveReference config) { | ||
183 | config.referred.specification | ||
184 | } | ||
185 | def dispatch getObjectiveSpecification(Void config) { | ||
186 | null | ||
187 | } | ||
188 | |||
173 | def dispatch getConfiguration(ConfigSpecification config) { | 189 | def dispatch getConfiguration(ConfigSpecification config) { |
174 | config | 190 | config |
175 | } | 191 | } |
@@ -234,4 +250,4 @@ class ScriptExecutor { | |||
234 | } | 250 | } |
235 | } | 251 | } |
236 | } | 252 | } |
237 | } \ No newline at end of file | 253 | } |