package org.eclipse.epsilon.examples.tools;
import org.eclipse.epsilon.eol.execute.context.Variable;
import org.eclipse.epsilon.eol.tools.AbstractTool;
public class SampleTool extends AbstractTool {
protected String name;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String sayHello() {
return "Hello " + name;
}
// Creates a new variable called variableName
// and adds it to the frame stack
public void sayHelloAsVariable(String variableName) {
context.getFrameStack().put(Variable.
createReadOnlyVariable(variableName, sayHello()));
}
}
var sampleTool = new Native("org.eclipse.epsilon.examples.tools.SampleTool");
sampleTool.name = "George";
sampleTool.sayHello().println();
sampleTool.sayHelloAsVariable("greeting");
greeting.println();
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.epsilon.common.dt.tool">
<tool
class="org.eclipse.epsilon.examples.tools.SampleTool"
defaultName="SampleTool">
</tool>
</extension>
</plugin>
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
Check out the code from the SVN:
Once you have checked out/imported the code, to run the example you need to go through the following steps:
In this example, we create a custom tool for Epsilon.
.emf files are Ecore metamodels expressed using the Emfatic textual syntax.
More examples are available in the examples folder of the SVN repository.