org.eclipse.jdt.internal.eval
Class CodeSnippetEnvironment

java.lang.Object
  extended by org.eclipse.jdt.internal.eval.CodeSnippetEnvironment
All Implemented Interfaces:
INameEnvironment, EvaluationConstants

public class CodeSnippetEnvironment
extends java.lang.Object
implements INameEnvironment, EvaluationConstants

An environment that wraps the client's name environment. This wrapper always considers the wrapped environment then if the name is not found, it search in the code snippet support. This includes the super class org.eclipse.jdt.internal.eval.target.CodeSnippet as well as the global variable classes.


Field Summary
 
Fields inherited from interface org.eclipse.jdt.internal.eval.EvaluationConstants
CODE_SNIPPET_CLASS_NAME_PREFIX, CODE_SNIPPET_NAME, DELEGATE_THIS, GLOBAL_VARS_CLASS_NAME_PREFIX, LOCAL_VAR_PREFIX, PACKAGE_NAME, RESULT_TYPE_FIELD, RESULT_VALUE_FIELD, ROOT_CLASS_NAME, ROOT_COMPOUND_NAME, ROOT_FULL_CLASS_NAME, RUN_METHOD, SETRESULT_ARGUMENTS, SETRESULT_SELECTOR
 
Constructor Summary
CodeSnippetEnvironment(INameEnvironment env, EvaluationContext context)
          Creates a new wrapper for the given environment.
 
Method Summary
 void cleanup()
          This method cleans the environment uo.
 NameEnvironmentAnswer findType(char[][] compoundTypeName)
          Find a type with the given compound name.
 NameEnvironmentAnswer findType(char[] typeName, char[][] packageName)
          Find a type named in the package .
 boolean isPackage(char[][] parentPackageName, char[] packageName)
          Answer whether packageName is the name of a known subpackage inside the package parentPackageName.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeSnippetEnvironment

public CodeSnippetEnvironment(INameEnvironment env,
                              EvaluationContext context)
Creates a new wrapper for the given environment.

Method Detail

findType

public NameEnvironmentAnswer findType(char[][] compoundTypeName)
Description copied from interface: INameEnvironment
Find a type with the given compound name. Answer the binary form of the type if it is known to be consistent. Otherwise, answer the compilation unit which defines the type or null if the type does not exist. Types in the default package are specified as {{typeName}}. It is unknown whether the package containing the type actually exists. NOTE: This method can be used to find a member type using its internal name A$B, but the source file for A is answered if the binary file is inconsistent.

Specified by:
findType in interface INameEnvironment
See Also:
INameEnvironment.findType(char[][])

findType

public NameEnvironmentAnswer findType(char[] typeName,
                                      char[][] packageName)
Description copied from interface: INameEnvironment
Find a type named in the package . Answer the binary form of the type if it is known to be consistent. Otherwise, answer the compilation unit which defines the type or null if the type does not exist. The default package is indicated by char[0][]. It is known that the package containing the type exists. NOTE: This method can be used to find a member type using its internal name A$B, but the source file for A is answered if the binary file is inconsistent.

Specified by:
findType in interface INameEnvironment
See Also:
INameEnvironment.findType(char[], char[][])

isPackage

public boolean isPackage(char[][] parentPackageName,
                         char[] packageName)
Description copied from interface: INameEnvironment
Answer whether packageName is the name of a known subpackage inside the package parentPackageName. A top level package is found relative to null. The default package is always assumed to exist. For example: isPackage({{java}, {awt}}, {event}); isPackage(null, {java});

Specified by:
isPackage in interface INameEnvironment
See Also:
INameEnvironment.isPackage(char[][], char[])

cleanup

public void cleanup()
Description copied from interface: INameEnvironment
This method cleans the environment uo. It is responsible for releasing the memory and freeing resources. Passed that point, the name environment is no longer usable. A name environment can have a long life cycle, therefore it is the responsibility of the code which created it to decide when it is a good time to clean it up.

Specified by:
cleanup in interface INameEnvironment