org.eclipse.mofscript.editor
Class ExecutionUtility

java.lang.Object
  extended by org.eclipse.mofscript.editor.ExecutionUtility
All Implemented Interfaces:
java.lang.Runnable

public class ExecutionUtility
extends java.lang.Object
implements java.lang.Runnable

Utility class for managing compilation and execution from the editor

Author:
jol

Constructor Summary
ExecutionUtility()
           
 
Method Summary
 void clearMarkers(org.eclipse.core.resources.IFile ifile)
          Clears the markers for a given file resource
 MOFScriptSpecification compile(org.eclipse.core.resources.IFile theFile, java.lang.String contents)
          Compiles a transformation.
 MOFScriptSpecification compile(org.eclipse.core.resources.IFile theFile, java.lang.String contents, boolean silent)
           
 void execute(org.eclipse.core.resources.IFile file, java.lang.String type, boolean showOpenDialog)
          Executes a transformation.
 void executeModelDirect(org.eclipse.core.resources.IFile transformationFile)
          Executes a MOFSript model directly - no compile
 void executeMOFScript2Text(org.eclipse.core.resources.IFile mofscriptModelFile)
          Fetches the MOFScript to Text transformation and executes that on an input transformation
 java.lang.String getCurrentInputDir()
          Retrieves the current input directory
 MOFScriptSpecification getCurrentTransformation()
          Retrieves the current transformatation
 java.lang.String getFirstInputFile()
          Retrieves the current input file
 boolean openSourceModelFile(java.lang.String title, java.lang.String[] filter, java.util.List parameters)
          Shows a file dialog to select a source model file.
 void run()
          Threaded transformation execution
 void setRootDirectoryProperty(org.eclipse.core.resources.IFile file)
          Sets the root directory property for a given file resource The root directory property is used when generating output files If a transformation only specifies relative paths, this property is used for absolute location
 void storeMofScriptModel(MOFScriptSpecification transformation, org.eclipse.core.resources.IFile transformationFile)
          Stores a MOFScript transformation as a model
 void updateMarkers(org.eclipse.core.resources.IFile fileResource, java.util.Iterator errors)
          Updates the error markers for a file resource.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionUtility

public ExecutionUtility()
Method Detail

getCurrentTransformation

public MOFScriptSpecification getCurrentTransformation()
Retrieves the current transformatation

Returns:

getFirstInputFile

public java.lang.String getFirstInputFile()
Retrieves the current input file

Returns:

getCurrentInputDir

public java.lang.String getCurrentInputDir()
Retrieves the current input directory

Returns:

updateMarkers

public void updateMarkers(org.eclipse.core.resources.IFile fileResource,
                          java.util.Iterator errors)
Updates the error markers for a file resource. Also prints the errors to the console

Parameters:
fileResource -
errors -

clearMarkers

public void clearMarkers(org.eclipse.core.resources.IFile ifile)
Clears the markers for a given file resource

Parameters:
ifile -

setRootDirectoryProperty

public void setRootDirectoryProperty(org.eclipse.core.resources.IFile file)
Sets the root directory property for a given file resource The root directory property is used when generating output files If a transformation only specifies relative paths, this property is used for absolute location

Parameters:
file -

compile

public MOFScriptSpecification compile(org.eclipse.core.resources.IFile theFile,
                                      java.lang.String contents,
                                      boolean silent)
Parameters:
theFile -
contents -
silent -
Returns:

compile

public MOFScriptSpecification compile(org.eclipse.core.resources.IFile theFile,
                                      java.lang.String contents)
Compiles a transformation. May be in the form of text in which case the 'contents' is used Else, the transformation is read from the file.

Parameters:
inputSource - - The input source file.
contents - - String representation of the file contents. May be null.

execute

public void execute(org.eclipse.core.resources.IFile file,
                    java.lang.String type,
                    boolean showOpenDialog)
Executes a transformation. The transformation is assumed to have been set by a previous compilation process.

Parameters:
file - - the transformation file resource. This is only used for setting execution and resource properties
type - - type of transformation (currently not used)
showOpenDialog - - If an file open dialog should be shown

openSourceModelFile

public boolean openSourceModelFile(java.lang.String title,
                                   java.lang.String[] filter,
                                   java.util.List parameters)
Shows a file dialog to select a source model file. Uses the model repository dir - or the latest opened file directory

Parameters:
title -
filter -
parameters -
Returns:

executeModelDirect

public void executeModelDirect(org.eclipse.core.resources.IFile transformationFile)
Executes a MOFSript model directly - no compile

Parameters:
transformationFile - - should contain a MOFScript model

executeMOFScript2Text

public void executeMOFScript2Text(org.eclipse.core.resources.IFile mofscriptModelFile)
Fetches the MOFScript to Text transformation and executes that on an input transformation


storeMofScriptModel

public void storeMofScriptModel(MOFScriptSpecification transformation,
                                org.eclipse.core.resources.IFile transformationFile)
Stores a MOFScript transformation as a model

Parameters:
transformationFile -

run

public void run()
Threaded transformation execution

Specified by:
run in interface java.lang.Runnable