diff options
author | 2018-02-24 20:57:30 -0500 | |
---|---|---|
committer | 2018-02-24 20:57:30 -0500 | |
commit | 5e7409bf21ba231fd26995e8ad978ef2214aecc0 (patch) | |
tree | ff819d732b2dd644c9aef8499a7b233d3e81d0d7 /Application/hu.bme.mit.inf.dslreasoner.application.ui/src/hu/bme/mit | |
parent | Execution update (diff) | |
download | VIATRA-Generator-5e7409bf21ba231fd26995e8ad978ef2214aecc0.tar.gz VIATRA-Generator-5e7409bf21ba231fd26995e8ad978ef2214aecc0.tar.zst VIATRA-Generator-5e7409bf21ba231fd26995e8ad978ef2214aecc0.zip |
Handler calls executor
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application.ui/src/hu/bme/mit')
-rw-r--r-- | Application/hu.bme.mit.inf.dslreasoner.application.ui/src/hu/bme/mit/inf/dslreasoner/application/ui/execute/ExecuteScriptHandler.java | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ui/src/hu/bme/mit/inf/dslreasoner/application/ui/execute/ExecuteScriptHandler.java b/Application/hu.bme.mit.inf.dslreasoner.application.ui/src/hu/bme/mit/inf/dslreasoner/application/ui/execute/ExecuteScriptHandler.java index a85ce953..ce1330bd 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application.ui/src/hu/bme/mit/inf/dslreasoner/application/ui/execute/ExecuteScriptHandler.java +++ b/Application/hu.bme.mit.inf.dslreasoner.application.ui/src/hu/bme/mit/inf/dslreasoner/application/ui/execute/ExecuteScriptHandler.java | |||
@@ -26,7 +26,6 @@ public class ExecuteScriptHandler extends AbstractHandler implements IHandler { | |||
26 | 26 | ||
27 | @Override | 27 | @Override |
28 | public Object execute(ExecutionEvent event) throws ExecutionException { | 28 | public Object execute(ExecutionEvent event) throws ExecutionException { |
29 | System.out.println("Called"); | ||
30 | ISelection selection = HandlerUtil.getCurrentSelection(event); | 29 | ISelection selection = HandlerUtil.getCurrentSelection(event); |
31 | if(selection instanceof StructuredSelection) { | 30 | if(selection instanceof StructuredSelection) { |
32 | StructuredSelection structuredSelection = (StructuredSelection) selection; | 31 | StructuredSelection structuredSelection = (StructuredSelection) selection; |
@@ -35,34 +34,12 @@ public class ExecuteScriptHandler extends AbstractHandler implements IHandler { | |||
35 | Object selectedElement = iterator.next(); | 34 | Object selectedElement = iterator.next(); |
36 | if (selectedElement instanceof IFile) { | 35 | if (selectedElement instanceof IFile) { |
37 | IFile selectedFile = (IFile) selectedElement; | 36 | IFile selectedFile = (IFile) selectedElement; |
38 | executeFile(selectedFile); | 37 | URI uri = URI.createPlatformResourceURI(selectedFile.getFullPath().toString(), true); |
38 | scriptExecutor.executeScript(uri); | ||
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } |
42 | return null; | 42 | return null; |
43 | } | 43 | } |
44 | 44 | ||
45 | private void executeFile(IFile selectedFile) { | ||
46 | URI uri = URI.createPlatformResourceURI(selectedFile.getFullPath().toString(), true); | ||
47 | |||
48 | ResourceSet rs = new ResourceSetImpl(); | ||
49 | Resource resource; | ||
50 | try { | ||
51 | resource = rs.getResource(uri, true); | ||
52 | } catch(RuntimeException e) { | ||
53 | return; | ||
54 | } | ||
55 | |||
56 | if(resource.getContents().size() == 1) { | ||
57 | EObject content = resource.getContents().get(0); | ||
58 | if(content instanceof ConfigurationScript) { | ||
59 | ConfigurationScript script = (ConfigurationScript) content; | ||
60 | scriptExecutor.executeScript(script); | ||
61 | } else { | ||
62 | return; | ||
63 | } | ||
64 | } else { | ||
65 | return; | ||
66 | } | ||
67 | } | ||
68 | } | 45 | } |