org.eclipse.jet.compiler
Class JET2Compiler

java.lang.Object
  extended by org.eclipse.jet.compiler.JET2Compiler

public class JET2Compiler
extends java.lang.Object

The compiler that turns a JET2 sources files Java files in the Eclipse workspace.


Field Summary
static java.lang.String COMPILE_PROBLEM_MARKER
          The Marker created by the compiler on all identified problems.
static java.lang.String DEFAULT_COMPILED_TEMPLATE_PACKAGE
          The default value of the OPTION_COMPILED_TEMPLATE_PACKAGE option; value: "org.eclipse.jet2.internal.compiled".
static java.lang.String DEFAULT_COMPILED_TEMPLATE_SRC_DIR
          The default value of the OPTION_COMPILED_TEMPLATE_SRC_DIR option; value: "jet2java".
static java.lang.Boolean DEFAULT_SET_JAVA_FILES_AS_DERIVED
           
static java.lang.String DEFAULT_TEMPLATE_EXT
          The default value of the OPTION_TEMPLATE_EXT option; value: "jet".
static java.lang.String OPTION_COMPILED_TEMPLATE_PACKAGE
          Compiler option specifying the package to which compiled templates are written; value: "compiledTemplatePackage".
static java.lang.String OPTION_COMPILED_TEMPLATE_SRC_DIR
          Compiler option specifying the Java project source directory to which compiled templates are written; value: "compiledTemplateSrcDir".
static java.lang.String OPTION_SET_JAVA_FILES_AS_DERIVED
           
static java.lang.String OPTION_TEMPLATE_EXT
          Compiler option specifying which extensions are recognized as extensions; value: "templateExt".
static java.lang.String RUNTIME_PROBLEM_MARKER
           
 
Constructor Summary
JET2Compiler(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor, java.util.Map options)
          Create an instance
JET2Compiler(org.eclipse.core.resources.IProject project, java.util.Map options, IJETCompilerState compilerState, org.eclipse.core.runtime.IProgressMonitor monitor)
          Create an instance of the JET compiler capable of incremental compilation from a saved state.
 
Method Summary
 void clean()
           
 void compile(org.eclipse.core.resources.IResource resource)
          Compile the passed resource into a Java file.
 void createTransformFiles()
          Create the Template Loader class for the project
 IJETCompilerState getCompilerState()
          Returns the current compiler state
static java.util.Map getDefaultCompilerOptions()
           
 int getNoCompiles()
           
 boolean isJET2SourceFile(org.eclipse.core.resources.IResource resource)
          Test whether the supplied resource is a compilable JET2 source file.
 void removeDerivedResources(org.eclipse.core.resources.IResource resource)
          Remove any resources for the passed resource representing a JET template.
 void removeDerivedResources(org.eclipse.core.resources.IResource resource, boolean derivedOnly)
          Remove any derived resources for this resource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RUNTIME_PROBLEM_MARKER

public static final java.lang.String RUNTIME_PROBLEM_MARKER
See Also:
Constant Field Values

COMPILE_PROBLEM_MARKER

public static final java.lang.String COMPILE_PROBLEM_MARKER
The Marker created by the compiler on all identified problems.

See Also:
Constant Field Values

DEFAULT_COMPILED_TEMPLATE_PACKAGE

public static final java.lang.String DEFAULT_COMPILED_TEMPLATE_PACKAGE
The default value of the OPTION_COMPILED_TEMPLATE_PACKAGE option; value: "org.eclipse.jet2.internal.compiled".

See Also:
Constant Field Values

DEFAULT_COMPILED_TEMPLATE_SRC_DIR

public static final java.lang.String DEFAULT_COMPILED_TEMPLATE_SRC_DIR
The default value of the OPTION_COMPILED_TEMPLATE_SRC_DIR option; value: "jet2java".

See Also:
Constant Field Values

DEFAULT_TEMPLATE_EXT

public static final java.lang.String DEFAULT_TEMPLATE_EXT
The default value of the OPTION_TEMPLATE_EXT option; value: "jet".

See Also:
Constant Field Values

DEFAULT_SET_JAVA_FILES_AS_DERIVED

public static final java.lang.Boolean DEFAULT_SET_JAVA_FILES_AS_DERIVED

OPTION_COMPILED_TEMPLATE_PACKAGE

public static final java.lang.String OPTION_COMPILED_TEMPLATE_PACKAGE
Compiler option specifying the package to which compiled templates are written; value: "compiledTemplatePackage".

See Also:
Constant Field Values

OPTION_COMPILED_TEMPLATE_SRC_DIR

public static final java.lang.String OPTION_COMPILED_TEMPLATE_SRC_DIR
Compiler option specifying the Java project source directory to which compiled templates are written; value: "compiledTemplateSrcDir".

See Also:
Constant Field Values

OPTION_TEMPLATE_EXT

public static final java.lang.String OPTION_TEMPLATE_EXT
Compiler option specifying which extensions are recognized as extensions; value: "templateExt".

See Also:
Constant Field Values

OPTION_SET_JAVA_FILES_AS_DERIVED

public static final java.lang.String OPTION_SET_JAVA_FILES_AS_DERIVED
See Also:
Constant Field Values
Constructor Detail

JET2Compiler

public JET2Compiler(org.eclipse.core.resources.IProject project,
                    java.util.Map options,
                    IJETCompilerState compilerState,
                    org.eclipse.core.runtime.IProgressMonitor monitor)
Create an instance of the JET compiler capable of incremental compilation from a saved state.

Parameters:
project - the project containing templates to be compiled.
options - the compiler options
compilerState - the saved state from previous a previous compile
monitor - a progress monitor

JET2Compiler

public JET2Compiler(org.eclipse.core.resources.IProject project,
                    org.eclipse.core.runtime.IProgressMonitor monitor,
                    java.util.Map options)
Create an instance

Parameters:
project - the project upon which the compiler will act
monitor - a progress monitor for compiler actions
options - a map of compiler options
Method Detail

getDefaultCompilerOptions

public static java.util.Map getDefaultCompilerOptions()

createTransformFiles

public void createTransformFiles()
Create the Template Loader class for the project


isJET2SourceFile

public boolean isJET2SourceFile(org.eclipse.core.resources.IResource resource)
Test whether the supplied resource is a compilable JET2 source file.

Parameters:
resource -
Returns:
true if the identified resource is a jet2 source file

compile

public void compile(org.eclipse.core.resources.IResource resource)
Compile the passed resource into a Java file. Does nothing if the passed resource is not a JET2 template.

Parameters:
resource - a project resource

removeDerivedResources

public void removeDerivedResources(org.eclipse.core.resources.IResource resource)
                            throws org.eclipse.core.runtime.CoreException
Remove any resources for the passed resource representing a JET template. The method will remove any Java files created by the compiler for the resource.

This method is equivalent to: removeDerivedResources(resource, false).

Parameters:
resource - a resource
Throws:
org.eclipse.core.runtime.CoreException - if a derived resource cannot be removed.
See Also:
removeDerivedResources(IResource, boolean)

removeDerivedResources

public void removeDerivedResources(org.eclipse.core.resources.IResource resource,
                                   boolean derivedOnly)
                            throws org.eclipse.core.runtime.CoreException
Remove any derived resources for this resource

Parameters:
resource - a resource
derivedOnly - if true, Java files with the derived attribute set are removed.
Throws:
org.eclipse.core.runtime.CoreException - if a derived resource cannot be removed.

getNoCompiles

public final int getNoCompiles()
Returns:
Returns the noCompiles.

clean

public void clean()

getCompilerState

public final IJETCompilerState getCompilerState()
Returns the current compiler state

Returns:
the current compiler state

Copyright 2006 IBM Corporation and others.
All Rights Reserved.