org.sintef.mofscript.editor
Class ExecutionUtility

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

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


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.
 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
 java.lang.String getCurrentInputDir()
          Retrieves the current input directory
 java.lang.String getCurrentInputFile()
          Retrieves the current input file
 MOFScriptSpecification getCurrentTransformation()
          Retrieves the current transformatation
protected  void mofScriptTextToModel(org.eclipse.core.resources.IFile transformationFile, java.lang.String content)
          Executes a MOFScript transformation of MOFScript input - based on textual MOFScript files
 boolean openSourceModelFile(java.lang.String title, java.lang.String[] filter)
          Shows a file dialog to select a source model file.
 void run()
          Threaded transformation execution
protected  void setExecutionResourceProperties(org.eclipse.core.resources.IFile file)
          Sets some properties on the transformation file
 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
protected  void threadExecute()
          Executed a transformation in a thread
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionUtility

public ExecutionUtility()
Method Detail

getCurrentTransformation

public MOFScriptSpecification getCurrentTransformation()
Retrieves the current transformatation

Returns:

getCurrentInputFile

public java.lang.String getCurrentInputFile()
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)
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)
Shows a file dialog to select a source model file. Uses the model repository dir - or the latest openned file directory

Returns:

threadExecute

protected void threadExecute()
Executed a transformation in a thread


setExecutionResourceProperties

protected void setExecutionResourceProperties(org.eclipse.core.resources.IFile file)
Sets some properties on the transformation file

Parameters:
file -

executeModelDirect

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

Parameters:
transformationFile - - should contain a MOFScript model

storeMofScriptModel

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

Parameters:
transformationFile -

mofScriptTextToModel

protected void mofScriptTextToModel(org.eclipse.core.resources.IFile transformationFile,
                                    java.lang.String content)
Executes a MOFScript transformation of MOFScript input - based on textual MOFScript files

Parameters:
transformationFile -
content -

run

public void run()
Threaded transformation execution

Specified by:
run in interface java.lang.Runnable