diff --git a/org.eclipse.triquetrum.commands.xtext.ide/.classpath b/org.eclipse.triquetrum.commands.xtext.ide/.classpath index cd407990..ad8063a2 100644 --- a/org.eclipse.triquetrum.commands.xtext.ide/.classpath +++ b/org.eclipse.triquetrum.commands.xtext.ide/.classpath @@ -1,6 +1,7 @@ + diff --git a/org.eclipse.triquetrum.commands.xtext.ide/META-INF/MANIFEST.MF b/org.eclipse.triquetrum.commands.xtext.ide/META-INF/MANIFEST.MF index 535811e7..642004cc 100644 --- a/org.eclipse.triquetrum.commands.xtext.ide/META-INF/MANIFEST.MF +++ b/org.eclipse.triquetrum.commands.xtext.ide/META-INF/MANIFEST.MF @@ -9,5 +9,9 @@ Export-Package: org.eclipse.triquetrum.commands.ide.contentassist.antlr, org.eclipse.triquetrum.commands.ide.contentassist.antlr.internal Require-Bundle: org.eclipse.xtext.ide;bundle-version="2.10.0", org.eclipse.triquetrum.commands.xtext;bundle-version="1.0.0", - org.eclipse.xtext.xbase.ide;bundle-version="2.10.0" + org.eclipse.xtext.xbase.ide;bundle-version="2.10.0", + org.eclipse.debug.core;bundle-version="3.10.100", + org.eclipse.debug.ui;bundle-version="3.11.200", + org.eclipse.ui;bundle-version="3.108.0", + org.eclipse.core.runtime;bundle-version="3.12.0" diff --git a/org.eclipse.triquetrum.commands.xtext.ide/build.properties b/org.eclipse.triquetrum.commands.xtext.ide/build.properties index d211e779..ff24db62 100644 --- a/org.eclipse.triquetrum.commands.xtext.ide/build.properties +++ b/org.eclipse.triquetrum.commands.xtext.ide/build.properties @@ -12,4 +12,5 @@ source.. = src/,\ src-gen/,\ xtend-gen/ bin.includes = .,\ - META-INF/ + META-INF/,\ + plugin.xml diff --git a/org.eclipse.triquetrum.commands.xtext.ide/plugin.xml b/org.eclipse.triquetrum.commands.xtext.ide/plugin.xml new file mode 100644 index 00000000..1c286c57 --- /dev/null +++ b/org.eclipse.triquetrum.commands.xtext.ide/plugin.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.triquetrum.commands.xtext.ide/src/main/java/org/eclipse/triquetrum/commands/xtext/ide/TqCLLaunchShortcut.java b/org.eclipse.triquetrum.commands.xtext.ide/src/main/java/org/eclipse/triquetrum/commands/xtext/ide/TqCLLaunchShortcut.java new file mode 100644 index 00000000..2775d9a7 --- /dev/null +++ b/org.eclipse.triquetrum.commands.xtext.ide/src/main/java/org/eclipse/triquetrum/commands/xtext/ide/TqCLLaunchShortcut.java @@ -0,0 +1,40 @@ +package org.eclipse.triquetrum.commands.xtext.ide; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.ui.ILaunchShortcut; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.triquetrum.commands.interpreter.TqclInterpreter; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; + +public class TqCLLaunchShortcut implements ILaunchShortcut { + + @Override + public void launch(ISelection selection, String mode) { + Object firstElement = ((IStructuredSelection) selection).getFirstElement(); + if (firstElement instanceof IFile) { + try { + IFile file = (IFile) firstElement; + java.net.URI rawLocationURI = file.getRawLocationURI(); + TqclInterpreter interpreter = new TqclInterpreter(); + interpreter.interpret(file.getContents(), rawLocationURI); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + @Override + public void launch(IEditorPart editor, String mode) { + // TODO Auto-generated method stub + IEditorInput firstElement = editor.getEditorInput(); + if (firstElement instanceof IFile) { + IFile file = (IFile) firstElement; + + } + } + +} diff --git a/org.eclipse.triquetrum.commands.xtext.tests/src/test/xtend-gen/org/eclipse/triquetrum/commands/tests/.TqclParsingTest.xtendbin b/org.eclipse.triquetrum.commands.xtext.tests/src/test/xtend-gen/org/eclipse/triquetrum/commands/tests/.TqclParsingTest.xtendbin index 8819b3ca..7a01eca2 100644 Binary files a/org.eclipse.triquetrum.commands.xtext.tests/src/test/xtend-gen/org/eclipse/triquetrum/commands/tests/.TqclParsingTest.xtendbin and b/org.eclipse.triquetrum.commands.xtext.tests/src/test/xtend-gen/org/eclipse/triquetrum/commands/tests/.TqclParsingTest.xtendbin differ diff --git a/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/labeling/.TqclDescriptionLabelProvider.xtendbin b/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/labeling/.TqclDescriptionLabelProvider.xtendbin index 770a981c..9acdbdc3 100644 Binary files a/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/labeling/.TqclDescriptionLabelProvider.xtendbin and b/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/labeling/.TqclDescriptionLabelProvider.xtendbin differ diff --git a/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/labeling/.TqclLabelProvider.xtendbin b/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/labeling/.TqclLabelProvider.xtendbin index d10951f7..f3305cb5 100644 Binary files a/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/labeling/.TqclLabelProvider.xtendbin and b/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/labeling/.TqclLabelProvider.xtendbin differ diff --git a/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/outline/.TqclOutlineTreeProvider.xtendbin b/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/outline/.TqclOutlineTreeProvider.xtendbin index 65d19561..6509b332 100644 Binary files a/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/outline/.TqclOutlineTreeProvider.xtendbin and b/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/outline/.TqclOutlineTreeProvider.xtendbin differ diff --git a/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/quickfix/.TqclQuickfixProvider.xtendbin b/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/quickfix/.TqclQuickfixProvider.xtendbin index 4fbdc7bf..614457d0 100644 Binary files a/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/quickfix/.TqclQuickfixProvider.xtendbin and b/org.eclipse.triquetrum.commands.xtext.ui/src/main/xtend-gen/org/eclipse/triquetrum/commands/ui/quickfix/.TqclQuickfixProvider.xtendbin differ diff --git a/org.eclipse.triquetrum.commands.xtext/META-INF/MANIFEST.MF b/org.eclipse.triquetrum.commands.xtext/META-INF/MANIFEST.MF index eeabbc83..4c5708b8 100644 --- a/org.eclipse.triquetrum.commands.xtext/META-INF/MANIFEST.MF +++ b/org.eclipse.triquetrum.commands.xtext/META-INF/MANIFEST.MF @@ -28,15 +28,16 @@ Require-Bundle: org.eclipse.xtext, org.eclipse.triquetrum.commands.api Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: org.apache.log4j -Export-Package: org.eclipse.triquetrum.commands.tqcl, - org.eclipse.triquetrum.commands.validation, +Export-Package: org.eclipse.triquetrum.commands, + org.eclipse.triquetrum.commands.generator, + org.eclipse.triquetrum.commands.interpreter, org.eclipse.triquetrum.commands.parser.antlr, org.eclipse.triquetrum.commands.parser.antlr.internal, + org.eclipse.triquetrum.commands.scoping, org.eclipse.triquetrum.commands.serializer, - org.eclipse.triquetrum.commands.generator, - org.eclipse.triquetrum.commands, - org.eclipse.triquetrum.commands.tqcl.impl, org.eclipse.triquetrum.commands.services, - org.eclipse.triquetrum.commands.scoping, - org.eclipse.triquetrum.commands.tqcl.util + org.eclipse.triquetrum.commands.tqcl, + org.eclipse.triquetrum.commands.tqcl.impl, + org.eclipse.triquetrum.commands.tqcl.util, + org.eclipse.triquetrum.commands.validation Bundle-Vendor: Eclipse Triquetrum diff --git a/org.eclipse.triquetrum.commands.xtext/src/main/java/org/eclipse/triquetrum/commands/interpreter/TqclInterpreter.java b/org.eclipse.triquetrum.commands.xtext/src/main/java/org/eclipse/triquetrum/commands/interpreter/TqclInterpreter.java new file mode 100644 index 00000000..898578f4 --- /dev/null +++ b/org.eclipse.triquetrum.commands.xtext/src/main/java/org/eclipse/triquetrum/commands/interpreter/TqclInterpreter.java @@ -0,0 +1,32 @@ +package org.eclipse.triquetrum.commands.interpreter; + +import java.io.IOException; +import java.io.InputStream; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.triquetrum.commands.TqclStandaloneSetup; +import org.eclipse.xtext.parser.IParseResult; +import org.eclipse.xtext.resource.IResourceFactory; +import org.eclipse.xtext.resource.XtextResource; + +import com.google.inject.Injector; + +public class TqclInterpreter { + + public void interpret(InputStream script, java.net.URI uri) { + try { + Injector injector = new TqclStandaloneSetup().createInjectorAndDoEMFRegistration(); + IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class); + + XtextResource resource = (XtextResource) resourceFactory.createResource(URI.createURI(uri.getPath())); + resource.load(script, null); + IParseResult parseResult = resource.getParseResult(); + EObject rootASTElement = parseResult.getRootASTElement(); + System.out.println(""); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +}