diff options
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application')
3 files changed, 18 insertions, 12 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend index 975da665..69365add 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend | |||
@@ -28,6 +28,7 @@ import org.eclipse.emf.common.util.URI | |||
28 | import hu.bme.mit.inf.dslreasoner.workspace.URIBasedWorkspace | 28 | import hu.bme.mit.inf.dslreasoner.workspace.URIBasedWorkspace |
29 | import java.util.LinkedList | 29 | import java.util.LinkedList |
30 | import java.io.File | 30 | import java.io.File |
31 | import org.eclipse.ui.console.ConsolePlugin | ||
31 | 32 | ||
32 | class GenerationTaskExecutor { | 33 | class GenerationTaskExecutor { |
33 | val metamodelLoader = new MetamodelLoader | 34 | val metamodelLoader = new MetamodelLoader |
@@ -64,7 +65,7 @@ class GenerationTaskExecutor { | |||
64 | val memoryLimit = scriptExecutor.getMemoryLimit(configSpecification) | 65 | val memoryLimit = scriptExecutor.getMemoryLimit(configSpecification) |
65 | 66 | ||
66 | // 2. create console | 67 | // 2. create console |
67 | val console = new ScriptConsole(false,true,false, | 68 | val console = new ScriptConsole(true,false, |
68 | if(messageFile!==null) URI.createURI(messageFile.path) else null, | 69 | if(messageFile!==null) URI.createURI(messageFile.path) else null, |
69 | if(debugFolder!==null) URI.createURI('''«debugFolder.path»/errors.txt''') else null, | 70 | if(debugFolder!==null) URI.createURI('''«debugFolder.path»/errors.txt''') else null, |
70 | if(statisticsFile!==null) URI.createURI(statisticsFile.path) else null | 71 | if(statisticsFile!==null) URI.createURI(statisticsFile.path) else null |
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend index 289bbe5c..91d3d286 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/ScriptConsole.xtend | |||
@@ -9,6 +9,8 @@ import java.util.LinkedHashSet | |||
9 | import java.util.LinkedList | 9 | import java.util.LinkedList |
10 | import java.util.List | 10 | import java.util.List |
11 | import java.util.Map | 11 | import java.util.Map |
12 | import java.util.concurrent.CompletableFuture | ||
13 | import javax.swing.text.BadLocationException | ||
12 | import org.eclipse.emf.common.util.URI | 14 | import org.eclipse.emf.common.util.URI |
13 | import org.eclipse.jface.text.DocumentEvent | 15 | import org.eclipse.jface.text.DocumentEvent |
14 | import org.eclipse.jface.text.IDocumentListener | 16 | import org.eclipse.jface.text.IDocumentListener |
@@ -17,9 +19,6 @@ import org.eclipse.ui.console.ConsolePlugin | |||
17 | import org.eclipse.ui.console.MessageConsole | 19 | import org.eclipse.ui.console.MessageConsole |
18 | import org.eclipse.ui.console.MessageConsoleStream | 20 | import org.eclipse.ui.console.MessageConsoleStream |
19 | import org.eclipse.xtend.lib.annotations.Data | 21 | import org.eclipse.xtend.lib.annotations.Data |
20 | import java.util.concurrent.CompletableFuture | ||
21 | import java.util.concurrent.Future | ||
22 | import javax.swing.text.BadLocationException | ||
23 | 22 | ||
24 | //import org.eclipse.ui.console.MessageConsole | 23 | //import org.eclipse.ui.console.MessageConsole |
25 | 24 | ||
@@ -44,7 +43,6 @@ class ScriptConsole { | |||
44 | static val empty = "" | 43 | static val empty = "" |
45 | 44 | ||
46 | public new( | 45 | public new( |
47 | boolean printToConsole, | ||
48 | boolean printToRuntimeConsole, | 46 | boolean printToRuntimeConsole, |
49 | boolean cleanFiles, | 47 | boolean cleanFiles, |
50 | URI messageConsoleURI, | 48 | URI messageConsoleURI, |
@@ -60,7 +58,7 @@ class ScriptConsole { | |||
60 | this.statisticsWorkspace = prepareWorkspace(statisticsConsoleURI,errorMessagesDuringInitialisation) | 58 | this.statisticsWorkspace = prepareWorkspace(statisticsConsoleURI,errorMessagesDuringInitialisation) |
61 | this.statisticsFileName = prepareFileName(statisticsConsoleURI) | 59 | this.statisticsFileName = prepareFileName(statisticsConsoleURI) |
62 | 60 | ||
63 | this.printToConsole = printToConsole | 61 | this.printToConsole = (ConsolePlugin.getDefault() === null) |
64 | this.runtimeConsole = if(printToRuntimeConsole) { prepareRuntimeConsole } else { null } | 62 | this.runtimeConsole = if(printToRuntimeConsole) { prepareRuntimeConsole } else { null } |
65 | 63 | ||
66 | errorMessagesDuringInitialisation.forEach[ | 64 | errorMessagesDuringInitialisation.forEach[ |
@@ -195,7 +193,7 @@ class ScriptConsole { | |||
195 | throw new IllegalArgumentException | 193 | throw new IllegalArgumentException |
196 | } | 194 | } |
197 | 195 | ||
198 | return '''«FOR i : 0..<decorators.size»«separatedMessage.get(i)»«decorators.get(i)»«ENDFOR»«separatedMessage.last»''' | 196 | return '''«FOR i : 0..<decorators.size»«separatedMessage.get(i)»[«decorators.get(i).text»]«ENDFOR»«separatedMessage.last»''' |
199 | } | 197 | } |
200 | private def writeToRuntimeConsole(CharSequence message) { | 198 | private def writeToRuntimeConsole(CharSequence message) { |
201 | // 1. reveal the console view | 199 | // 1. reveal the console view |
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 825bfdcc..97fff9c6 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 | |||
@@ -22,7 +22,9 @@ class StandaloneScriptExecutor { | |||
22 | def static void main(String[] args) { | 22 | def static void main(String[] args) { |
23 | if(args.size == 1) { | 23 | if(args.size == 1) { |
24 | val message = executeScript(args.head) | 24 | val message = executeScript(args.head) |
25 | println(message) | 25 | if(message !== null) { |
26 | println(message) | ||
27 | } | ||
26 | } else if(args.size == 0){ | 28 | } else if(args.size == 0){ |
27 | println('''Run generator with script file path as parameter!''') | 29 | println('''Run generator with script file path as parameter!''') |
28 | } else { // args.size > 1 | 30 | } else { // args.size > 1 |
@@ -36,6 +38,7 @@ class StandaloneScriptExecutor { | |||
36 | ApplicationConfigurationStandaloneSetup.doSetup | 38 | ApplicationConfigurationStandaloneSetup.doSetup |
37 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("xmi",new XMIResourceFactoryImpl) | 39 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("xmi",new XMIResourceFactoryImpl) |
38 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("logicproblem",new XMIResourceFactoryImpl) | 40 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("logicproblem",new XMIResourceFactoryImpl) |
41 | Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put("partialmodel",new XMIResourceFactoryImpl) | ||
39 | ReteEngine.getClass | 42 | ReteEngine.getClass |
40 | 43 | ||
41 | val ext = path.split("\\.").last | 44 | val ext = path.split("\\.").last |
@@ -46,7 +49,8 @@ class StandaloneScriptExecutor { | |||
46 | try{ | 49 | try{ |
47 | resource = resourceSet.getResource(URI.createURI(path),true) | 50 | resource = resourceSet.getResource(URI.createURI(path),true) |
48 | } catch(Exception e) { | 51 | } catch(Exception e) { |
49 | return '''Unable to load Configuration Script!''' | 52 | val message = '''Unable to load Configuration Script!''' |
53 | return message | ||
50 | } | 54 | } |
51 | 55 | ||
52 | EcoreUtil::resolveAll(resource) | 56 | EcoreUtil::resolveAll(resource) |
@@ -57,18 +61,21 @@ class StandaloneScriptExecutor { | |||
57 | val executor = new ScriptExecutor | 61 | val executor = new ScriptExecutor |
58 | executor.executeScript(content,new NullProgressMonitor) | 62 | executor.executeScript(content,new NullProgressMonitor) |
59 | } else { | 63 | } else { |
60 | return('''Content is not a Configuration Script! (Found : «content.class.simpleName»)''') | 64 | val message = '''Content is not a Configuration Script! (Found : «content.class.simpleName»)''' |
65 | return message | ||
61 | } | 66 | } |
62 | } else { | 67 | } else { |
63 | return ''' | 68 | val message = ''' |
64 | The Configuration Script contains «errors.size» error«IF errors.size>1»s«ENDIF»: | 69 | The Configuration Script contains «errors.size» error«IF errors.size>1»s«ENDIF»: |
65 | «FOR error : errors» | 70 | «FOR error : errors» |
66 | «"\t"»«error.message» | 71 | «"\t"»«error.message» |
67 | «ENDFOR» | 72 | «ENDFOR» |
68 | ''' | 73 | ''' |
74 | return message | ||
69 | } | 75 | } |
70 | } else { | 76 | } else { |
71 | return '''Unsupported file extension: «ext»''' | 77 | val message = '''Unsupported file extension: «ext»''' |
78 | return message | ||
72 | } | 79 | } |
73 | } | 80 | } |
74 | } \ No newline at end of file | 81 | } \ No newline at end of file |