Implementing a Defined Function Package Tool

After specifying this extension a Java class implementing the IToolExecutor2 interface is created in the plug-in project. Edit this Java class to implement the functionality of your tool.

Find below an example implementation of the Simple Tool which determines and displays the value of the tool attribute:

public class SampleToolExecutor implements IToolExecutor2 {

	private static final String ATTRIBUTE_UPDATE_ALLOWED = "attr.updateAllowed";

	@Override
	public IToolResult executeSingleProcessing(IToolContext pToolContext, IProgressMonitor pMon)       throws TaurusToolException {
		// Get a modeled attribute value
		Boolean updateAllowed = ToolUtility.getAttributeValue(pToolContext, pToolContext, ATTRIBUTE_UPDATE_ALLOWED,
				Boolean.class);
		if (updateAllowed)
			System.out.println("Update is allowed.");
		else
			System.out.println("Update is not allowed.");
		return new ToolResult(pToolContext);
	}

	@Override
	public IToolResult executeMassProcessing(IMassProcessingToolContext pMassProcessingContext, IProgressMonitor pMon)
			throws TaurusToolException {
		/*This tool does not support mass processing.*/
		return null;
	}
	
	@Override
	public boolean supportsMassProcessing() {
		return false;
	}

}

The implementation of the new Simple Function Package tool is now complete.