blob: 28c11187b5989aa64521df5c0df13523dd84da5c [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_12) on Fri May 30 11:15:59 CDT 2008 -->
<TITLE>
IEvaluationContext
</TITLE>
<META NAME="keywords" CONTENT="org.eclipse.wst.jsdt.core.eval.IEvaluationContext interface">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="IEvaluationContext";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/IEvaluationContext.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="IEvaluationContext.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.eclipse.wst.jsdt.core.eval</FONT>
<BR>
Interface IEvaluationContext</H2>
<HR>
<DL>
<DT><PRE>public interface <B>IEvaluationContext</B></DL>
</PRE>
<P>
An evaluation context supports evaluating code snippets.
<p>
A code snippet is pretty much any valid piece of JavaScript code that could be
pasted into the body of a method and compiled. However, there are two
areas where the rules are slightly more liberal.
<p>
First, a code snippet can return heterogeneous types. Inside the same code
snippet an <code>int</code> could be returned on one line, and a
<code>String</code> on the next, etc. For example, the following would be
considered a valid code snippet:
<pre>
<code>
char c = '3';
switch (c) {
case '1': return 1;
case '2': return '2';
case '3': return "3";
default: return null;
}
</code>
</pre>
</p>
<p>
Second, if the last statement is only an expression, the <code>return</code>
keyword is implied. For example, the following returns <code>false</code>:
<pre>
<code>
int i = 1;
i == 2
</code>
</pre>
</p>
<p>
Global variables are an additional feature of evaluation contexts. Within an
evaluation context, global variables maintain their value across evaluations.
These variables are particularly useful for storing the result of an
evaluation for use in subsequent evaluations.
</p>
<p>
The evaluation context remembers the name of the package in which code
snippets are run. The user can set this to any package, thereby gaining
access to types that are normally only visible within that package.
</p>
<p>
Finally, the evaluation context remembers a list of import declarations. The
user can import any packages and types so that the code snippets may refer
to types by their shorter simple names.
</p>
<p>
Example of use:
<pre>
<code>
IJavaScriptProject project = getJavaProject();
IEvaluationContext context = project.newEvaluationContext();
String codeSnippet = "int i= 0; i++";
ICodeSnippetRequestor requestor = ...;
context.evaluateCodeSnippet(codeSnippet, requestor, progressMonitor);
</code>
</pre>
</p>
<p>
This interface is not intended to be implemented by clients.
<code>IJavaScriptProject.newEvaluationContext</code> can be used to obtain an
instance.
</p>
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptProject.html#newEvaluationContext()"><CODE>Provisional API: This class/interface is part of an interim API that is still under development and expected to
change significantly before reaching stability. It is being made available at this early stage to solicit feedback
from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
(repeatedly) as the API evolves.</CODE></A></DL>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval">IGlobalVariable</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#allVariables()">allVariables</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the global variables declared in this evaluation context.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.CompletionRequestor)">codeComplete</A></B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;position,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/CompletionRequestor.html" title="class in org.eclipse.wst.jsdt.core">CompletionRequestor</A>&nbsp;requestor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Performs a code completion at the given position in the given code snippet,
reporting results to the given completion requestor.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.CompletionRequestor, org.eclipse.wst.jsdt.core.WorkingCopyOwner)">codeComplete</A></B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;position,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/CompletionRequestor.html" title="class in org.eclipse.wst.jsdt.core">CompletionRequestor</A>&nbsp;requestor,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/WorkingCopyOwner.html" title="class in org.eclipse.wst.jsdt.core">WorkingCopyOwner</A>&nbsp;owner)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Performs a code completion at the given position in the given code snippet,
reporting results to the given completion requestor.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.ICompletionRequestor)">codeComplete</A></B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;position,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/ICompletionRequestor.html" title="interface in org.eclipse.wst.jsdt.core">ICompletionRequestor</A>&nbsp;requestor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.CompletionRequestor)"><CODE>codeComplete(String,int,CompletionRequestor)</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.ICompletionRequestor, org.eclipse.wst.jsdt.core.WorkingCopyOwner)">codeComplete</A></B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;position,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/ICompletionRequestor.html" title="interface in org.eclipse.wst.jsdt.core">ICompletionRequestor</A>&nbsp;requestor,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/WorkingCopyOwner.html" title="class in org.eclipse.wst.jsdt.core">WorkingCopyOwner</A>&nbsp;owner)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.CompletionRequestor, org.eclipse.wst.jsdt.core.WorkingCopyOwner)"><CODE>codeComplete(String,int,CompletionRequestor,WorkingCopyOwner)</CODE></A> instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptElement.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptElement</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeSelect(java.lang.String, int, int)">codeSelect</A></B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;offset,
int&nbsp;length)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Resolves and returns a collection of JavaScript elements corresponding to the source
code at the given positions in the given code snippet.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptElement.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptElement</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeSelect(java.lang.String, int, int, org.eclipse.wst.jsdt.core.WorkingCopyOwner)">codeSelect</A></B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;offset,
int&nbsp;length,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/WorkingCopyOwner.html" title="class in org.eclipse.wst.jsdt.core">WorkingCopyOwner</A>&nbsp;owner)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Resolves and returns a collection of JavaScript elements corresponding to the source
code at the given positions in the given code snippet.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#deleteVariable(org.eclipse.wst.jsdt.core.eval.IGlobalVariable)">deleteVariable</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval">IGlobalVariable</A>&nbsp;variable)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Deletes the given variable from this evaluation context.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#evaluateCodeSnippet(java.lang.String, org.eclipse.wst.jsdt.core.eval.ICodeSnippetRequestor, IProgressMonitor)">evaluateCodeSnippet</A></B>(java.lang.String&nbsp;codeSnippet,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval">ICodeSnippetRequestor</A>&nbsp;requestor,
IProgressMonitor&nbsp;progressMonitor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Evaluates the given code snippet.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#evaluateCodeSnippet(java.lang.String, java.lang.String[], java.lang.String[], int[], org.eclipse.wst.jsdt.core.IType, boolean, boolean, org.eclipse.wst.jsdt.core.eval.ICodeSnippetRequestor, IProgressMonitor)">evaluateCodeSnippet</A></B>(java.lang.String&nbsp;codeSnippet,
java.lang.String[]&nbsp;localVariableTypeNames,
java.lang.String[]&nbsp;localVariableNames,
int[]&nbsp;localVariableModifiers,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IType.html" title="interface in org.eclipse.wst.jsdt.core">IType</A>&nbsp;declaringType,
boolean&nbsp;isStatic,
boolean&nbsp;isConstructorCall,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval">ICodeSnippetRequestor</A>&nbsp;requestor,
IProgressMonitor&nbsp;progressMonitor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Evaluates the given code snippet in the context of a suspended thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#evaluateVariable(org.eclipse.wst.jsdt.core.eval.IGlobalVariable, org.eclipse.wst.jsdt.core.eval.ICodeSnippetRequestor, IProgressMonitor)">evaluateVariable</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval">IGlobalVariable</A>&nbsp;variable,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval">ICodeSnippetRequestor</A>&nbsp;requestor,
IProgressMonitor&nbsp;progressMonitor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Evaluates the given global variable.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#getImports()">getImports</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the import declarations for this evaluation context.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#getPackageName()">getPackageName</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the name of the package in which code snippets are to be compiled and
run.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptProject.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptProject</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#getProject()">getProject</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the JavaScript project this evaluation context was created for.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval">IGlobalVariable</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#newVariable(java.lang.String, java.lang.String, java.lang.String)">newVariable</A></B>(java.lang.String&nbsp;typeName,
java.lang.String&nbsp;name,
java.lang.String&nbsp;initializer)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new global variable with the given name, type, and initializer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#setImports(java.lang.String[])">setImports</A></B>(java.lang.String[]&nbsp;imports)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the import declarations for this evaluation context.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#setPackageName(java.lang.String)">setPackageName</A></B>(java.lang.String&nbsp;packageName)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the dot-separated name of the package in which code snippets are
to be compiled and run.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#validateImports(org.eclipse.wst.jsdt.core.eval.ICodeSnippetRequestor)">validateImports</A></B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval">ICodeSnippetRequestor</A>&nbsp;requestor)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Validates this evaluation context's import declarations.</TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="allVariables()"><!-- --></A><H3>
allVariables</H3>
<PRE>
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval">IGlobalVariable</A>[] <B>allVariables</B>()</PRE>
<DL>
<DD>Returns the global variables declared in this evaluation context.
The variables are maintained in the order they are created in.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the list of global variables</DL>
</DD>
</DL>
<HR>
<A NAME="codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.ICompletionRequestor)"><!-- --></A><H3>
codeComplete</H3>
<PRE>
void <B>codeComplete</B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;position,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/ICompletionRequestor.html" title="interface in org.eclipse.wst.jsdt.core">ICompletionRequestor</A>&nbsp;requestor)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.CompletionRequestor)"><CODE>codeComplete(String,int,CompletionRequestor)</CODE></A> instead.</I>
<P>
<DD>Performs a code completion at the given position in the given code snippet,
reporting results to the given completion requestor.
<p>
Note that code completion does not involve evaluation.
<p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codeSnippet</CODE> - the code snippet to complete in<DD><CODE>position</CODE> - the character position in the code snippet to complete at,
or -1 indicating the beginning of the snippet<DD><CODE>requestor</CODE> - the code completion requestor capable of accepting all
possible types of completions
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if code completion could not be performed. Reasons include:
<ul>
<li>The position specified is less than -1 or is greater than the snippet's
length (INDEX_OUT_OF_BOUNDS)</li>
</ul></DL>
</DD>
</DL>
<HR>
<A NAME="codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.ICompletionRequestor, org.eclipse.wst.jsdt.core.WorkingCopyOwner)"><!-- --></A><H3>
codeComplete</H3>
<PRE>
void <B>codeComplete</B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;position,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/ICompletionRequestor.html" title="interface in org.eclipse.wst.jsdt.core">ICompletionRequestor</A>&nbsp;requestor,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/WorkingCopyOwner.html" title="class in org.eclipse.wst.jsdt.core">WorkingCopyOwner</A>&nbsp;owner)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>Use <A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html#codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.CompletionRequestor, org.eclipse.wst.jsdt.core.WorkingCopyOwner)"><CODE>codeComplete(String,int,CompletionRequestor,WorkingCopyOwner)</CODE></A> instead.</I>
<P>
<DD>Performs a code completion at the given position in the given code snippet,
reporting results to the given completion requestor.
It considers types in the working copies with the given owner first. In other words,
the owner's working copies will take precedence over their original javascript unit s
in the workspace.
<p>
Note that if a working copy is empty, it will be as if the original compilation
unit had been deleted.
</p>
<p>
Note that code completion does not involve evaluation.
<p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codeSnippet</CODE> - the code snippet to complete in<DD><CODE>position</CODE> - the character position in the code snippet to complete at,
or -1 indicating the beginning of the snippet<DD><CODE>requestor</CODE> - the code completion requestor capable of accepting all
possible types of completions<DD><CODE>owner</CODE> - the owner of working copies that take precedence over their original javascript unit s
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if code completion could not be performed. Reasons include:
<ul>
<li>The position specified is less than -1 or is greater than the snippet's
length (INDEX_OUT_OF_BOUNDS)</li>
</ul></DL>
</DD>
</DL>
<HR>
<A NAME="codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.CompletionRequestor)"><!-- --></A><H3>
codeComplete</H3>
<PRE>
void <B>codeComplete</B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;position,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/CompletionRequestor.html" title="class in org.eclipse.wst.jsdt.core">CompletionRequestor</A>&nbsp;requestor)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD>Performs a code completion at the given position in the given code snippet,
reporting results to the given completion requestor.
<p>
Note that code completion does not involve evaluation.
<p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codeSnippet</CODE> - the code snippet to complete in<DD><CODE>position</CODE> - the character position in the code snippet to complete at,
or -1 indicating the beginning of the snippet<DD><CODE>requestor</CODE> - the code completion requestor capable of accepting all
possible types of completions
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if code completion could not be performed. Reasons include:
<ul>
<li>The position specified is less than -1 or is greater than the snippet's
length (INDEX_OUT_OF_BOUNDS)</li>
</ul></DL>
</DD>
</DL>
<HR>
<A NAME="codeComplete(java.lang.String, int, org.eclipse.wst.jsdt.core.CompletionRequestor, org.eclipse.wst.jsdt.core.WorkingCopyOwner)"><!-- --></A><H3>
codeComplete</H3>
<PRE>
void <B>codeComplete</B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;position,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/CompletionRequestor.html" title="class in org.eclipse.wst.jsdt.core">CompletionRequestor</A>&nbsp;requestor,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/WorkingCopyOwner.html" title="class in org.eclipse.wst.jsdt.core">WorkingCopyOwner</A>&nbsp;owner)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD>Performs a code completion at the given position in the given code snippet,
reporting results to the given completion requestor.
It considers types in the working copies with the given owner first. In other words,
the owner's working copies will take precedence over their original javascript unit s
in the workspace.
<p>
Note that if a working copy is empty, it will be as if the original compilation
unit had been deleted.
</p>
<p>
Note that code completion does not involve evaluation.
<p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codeSnippet</CODE> - the code snippet to complete in<DD><CODE>position</CODE> - the character position in the code snippet to complete at,
or -1 indicating the beginning of the snippet<DD><CODE>requestor</CODE> - the code completion requestor capable of accepting all
possible types of completions<DD><CODE>owner</CODE> - the owner of working copies that take precedence over their original javascript unit s
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if code completion could not be performed. Reasons include:
<ul>
<li>The position specified is less than -1 or is greater than the snippet's
length (INDEX_OUT_OF_BOUNDS)</li>
</ul></DL>
</DD>
</DL>
<HR>
<A NAME="codeSelect(java.lang.String, int, int)"><!-- --></A><H3>
codeSelect</H3>
<PRE>
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptElement.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptElement</A>[] <B>codeSelect</B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;offset,
int&nbsp;length)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD>Resolves and returns a collection of JavaScript elements corresponding to the source
code at the given positions in the given code snippet.
<p>
Note that code select does not involve evaluation, and problems are never
reported.
<p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codeSnippet</CODE> - the code snippet to resolve in<DD><CODE>offset</CODE> - the position in the code snippet of the first character
of the code to resolve<DD><CODE>length</CODE> - the length of the selected code to resolve
<DT><B>Returns:</B><DD>the (possibly empty) list of selection JavaScript elements
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if code resolve could not be performed.
Reasons include:
<ul>
<li>The position specified is less than -1 or is greater than the snippet's
length (INDEX_OUT_OF_BOUNDS)</li>
</ul></DL>
</DD>
</DL>
<HR>
<A NAME="codeSelect(java.lang.String, int, int, org.eclipse.wst.jsdt.core.WorkingCopyOwner)"><!-- --></A><H3>
codeSelect</H3>
<PRE>
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptElement.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptElement</A>[] <B>codeSelect</B>(java.lang.String&nbsp;codeSnippet,
int&nbsp;offset,
int&nbsp;length,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/WorkingCopyOwner.html" title="class in org.eclipse.wst.jsdt.core">WorkingCopyOwner</A>&nbsp;owner)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD>Resolves and returns a collection of JavaScript elements corresponding to the source
code at the given positions in the given code snippet.
It considers types in the working copies with the given owner first. In other words,
the owner's working copies will take precedence over their original javascript unit s
in the workspace.
<p>
Note that if a working copy is empty, it will be as if the original compilation
unit had been deleted.
</p>
<p>
Note that code select does not involve evaluation, and problems are never
reported.
<p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codeSnippet</CODE> - the code snippet to resolve in<DD><CODE>offset</CODE> - the position in the code snippet of the first character
of the code to resolve<DD><CODE>length</CODE> - the length of the selected code to resolve<DD><CODE>owner</CODE> - the owner of working copies that take precedence over their original javascript unit s
<DT><B>Returns:</B><DD>the (possibly empty) list of selection JavaScript elements
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if code resolve could not be performed.
Reasons include:
<ul>
<li>The position specified is less than -1 or is greater than the snippet's
length (INDEX_OUT_OF_BOUNDS)</li>
</ul></DL>
</DD>
</DL>
<HR>
<A NAME="deleteVariable(org.eclipse.wst.jsdt.core.eval.IGlobalVariable)"><!-- --></A><H3>
deleteVariable</H3>
<PRE>
void <B>deleteVariable</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval">IGlobalVariable</A>&nbsp;variable)</PRE>
<DL>
<DD>Deletes the given variable from this evaluation context. Does nothing if
the given variable has already been deleted.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>variable</CODE> - the global variable</DL>
</DD>
</DL>
<HR>
<A NAME="evaluateCodeSnippet(java.lang.String, java.lang.String[], java.lang.String[], int[], org.eclipse.wst.jsdt.core.IType, boolean, boolean, org.eclipse.wst.jsdt.core.eval.ICodeSnippetRequestor, IProgressMonitor)"><!-- --></A><H3>
evaluateCodeSnippet</H3>
<PRE>
void <B>evaluateCodeSnippet</B>(java.lang.String&nbsp;codeSnippet,
java.lang.String[]&nbsp;localVariableTypeNames,
java.lang.String[]&nbsp;localVariableNames,
int[]&nbsp;localVariableModifiers,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IType.html" title="interface in org.eclipse.wst.jsdt.core">IType</A>&nbsp;declaringType,
boolean&nbsp;isStatic,
boolean&nbsp;isConstructorCall,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval">ICodeSnippetRequestor</A>&nbsp;requestor,
IProgressMonitor&nbsp;progressMonitor)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD>Evaluates the given code snippet in the context of a suspended thread.
The code snippet is compiled along with this context's package declaration,
imports, and global variables. The given requestor's
<code>acceptProblem</code> method is called for each compilation problem that
is detected. Then the resulting class files are handed to the given
requestor's <code>acceptClassFiles</code> method to deploy and run.
<p>
The requestor is expected to:
<ol>
<li>send the class files to the target VM,
<li>load them (starting with the code snippet class),
<li>create a new instance of the code snippet class,
<li>run the method <code>run()</code> of the code snippet,
<li>retrieve the values of the local variables,
<li>retrieve the returned value of the code snippet
</ol>
</p>
<p>
This method is long-running; progress and cancellation are provided
by the given progress monitor.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codeSnippet</CODE> - the code snippet<DD><CODE>localVariableTypeNames</CODE> - the dot-separated fully qualified names of the types of the local variables.<DD><CODE>localVariableNames</CODE> - the names of the local variables as they are declared in the user's code.<DD><CODE>localVariableModifiers</CODE> - the modifiers of the local variables (default modifier or final modifier).<DD><CODE>declaringType</CODE> - the type in which the code snippet is evaluated.<DD><CODE>isStatic</CODE> - whether the code snippet is evaluated in a static member of the declaring type.<DD><CODE>isConstructorCall</CODE> - whether the code snippet is evaluated in a constructor of the declaring type.<DD><CODE>requestor</CODE> - the code snippet requestor<DD><CODE>progressMonitor</CODE> - a progress monitor
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if a runtime problem occurred or if this
context's project has no build state</DL>
</DD>
</DL>
<HR>
<A NAME="evaluateCodeSnippet(java.lang.String, org.eclipse.wst.jsdt.core.eval.ICodeSnippetRequestor, IProgressMonitor)"><!-- --></A><H3>
evaluateCodeSnippet</H3>
<PRE>
void <B>evaluateCodeSnippet</B>(java.lang.String&nbsp;codeSnippet,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval">ICodeSnippetRequestor</A>&nbsp;requestor,
IProgressMonitor&nbsp;progressMonitor)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD>Evaluates the given code snippet. The code snippet is
compiled along with this context's package declaration, imports, and
global variables. The given requestor's <code>acceptProblem</code> method
is called for each compilation problem that is detected. Then the resulting
class files are handed to the given requestor's <code>acceptClassFiles</code>
method to deploy and run. The requestor is also responsible for getting the
result back.
<p>
This method is long-running; progress and cancellation are provided
by the given progress monitor.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codeSnippet</CODE> - the code snippet<DD><CODE>requestor</CODE> - the code snippet requestor<DD><CODE>progressMonitor</CODE> - a progress monitor
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if a runtime problem occurred or if this
context's project has no build state</DL>
</DD>
</DL>
<HR>
<A NAME="evaluateVariable(org.eclipse.wst.jsdt.core.eval.IGlobalVariable, org.eclipse.wst.jsdt.core.eval.ICodeSnippetRequestor, IProgressMonitor)"><!-- --></A><H3>
evaluateVariable</H3>
<PRE>
void <B>evaluateVariable</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval">IGlobalVariable</A>&nbsp;variable,
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval">ICodeSnippetRequestor</A>&nbsp;requestor,
IProgressMonitor&nbsp;progressMonitor)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD>Evaluates the given global variable. During this operation,
this context's package declaration, imports, and <i>all</i> its declared
variables are verified. The given requestor's <code>acceptProblem</code>
method will be called for each problem that is detected.
<p>
This method is long-running; progress and cancellation are provided
by the given progress monitor.
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>variable</CODE> - the global variable<DD><CODE>requestor</CODE> - the code snippet requestor<DD><CODE>progressMonitor</CODE> - a progress monitor
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if a runtime problem occurred or if this
context's project has no build state</DL>
</DD>
</DL>
<HR>
<A NAME="getImports()"><!-- --></A><H3>
getImports</H3>
<PRE>
java.lang.String[] <B>getImports</B>()</PRE>
<DL>
<DD>Returns the import declarations for this evaluation context. Returns and empty
list if there are no imports (the default if the imports have never been set).
The syntax for the import corresponds to a fully qualified type name, or to
an on-demand package name as defined by ImportDeclaration (JLS2 7.5). For
example, <code>"java.util.Hashtable"</code> or <code>"java.util.*"</code>.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the list of import names</DL>
</DD>
</DL>
<HR>
<A NAME="getPackageName()"><!-- --></A><H3>
getPackageName</H3>
<PRE>
java.lang.String <B>getPackageName</B>()</PRE>
<DL>
<DD>Returns the name of the package in which code snippets are to be compiled and
run. Returns an empty string for the default package (the default if the
package name has never been set). For example, <code>"com.example.myapp"</code>.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the dot-separated package name, or the empty string indicating the
default package</DL>
</DD>
</DL>
<HR>
<A NAME="getProject()"><!-- --></A><H3>
getProject</H3>
<PRE>
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/IJavaScriptProject.html" title="interface in org.eclipse.wst.jsdt.core">IJavaScriptProject</A> <B>getProject</B>()</PRE>
<DL>
<DD>Returns the JavaScript project this evaluation context was created for.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the JavaScript project</DL>
</DD>
</DL>
<HR>
<A NAME="newVariable(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>
newVariable</H3>
<PRE>
<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval">IGlobalVariable</A> <B>newVariable</B>(java.lang.String&nbsp;typeName,
java.lang.String&nbsp;name,
java.lang.String&nbsp;initializer)</PRE>
<DL>
<DD>Creates a new global variable with the given name, type, and initializer.
<p>
The <code>typeName</code> and <code>initializer</code> are interpreted in
the context of this context's package and import declarations.
</p>
<p>
The syntax for a type name corresponds to Type in Field Declaration (JLS2 8.3).
</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>typeName</CODE> - the type name<DD><CODE>name</CODE> - the name of the global variable<DD><CODE>initializer</CODE> - the initializer expression, or <code>null</code> if the
variable is not initialized
<DT><B>Returns:</B><DD>a new global variable with the given name, type, and initializer</DL>
</DD>
</DL>
<HR>
<A NAME="setImports(java.lang.String[])"><!-- --></A><H3>
setImports</H3>
<PRE>
void <B>setImports</B>(java.lang.String[]&nbsp;imports)</PRE>
<DL>
<DD>Sets the import declarations for this evaluation context. An empty
list indicates there are no imports. The syntax for the import corresponds to a
fully qualified type name, or to an on-demand package name as defined by
ImportDeclaration (JLS2 7.5). For example, <code>"java.util.Hashtable"</code>
or <code>"java.util.*"</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>imports</CODE> - the list of import names</DL>
</DD>
</DL>
<HR>
<A NAME="setPackageName(java.lang.String)"><!-- --></A><H3>
setPackageName</H3>
<PRE>
void <B>setPackageName</B>(java.lang.String&nbsp;packageName)</PRE>
<DL>
<DD>Sets the dot-separated name of the package in which code snippets are
to be compiled and run. For example, <code>"com.example.myapp"</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>packageName</CODE> - the dot-separated package name, or the empty string
indicating the default package</DL>
</DD>
</DL>
<HR>
<A NAME="validateImports(org.eclipse.wst.jsdt.core.eval.ICodeSnippetRequestor)"><!-- --></A><H3>
validateImports</H3>
<PRE>
void <B>validateImports</B>(<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval">ICodeSnippetRequestor</A>&nbsp;requestor)
throws <A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></PRE>
<DL>
<DD>Validates this evaluation context's import declarations. The given requestor's
<code>acceptProblem</code> method is called for each problem that is detected.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>requestor</CODE> - the code snippet requestor
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../../org/eclipse/wst/jsdt/core/JavaScriptModelException.html" title="class in org.eclipse.wst.jsdt.core">JavaScriptModelException</A></CODE> - if this context's project has no build state</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/IEvaluationContext.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/ICodeSnippetRequestor.html" title="interface in org.eclipse.wst.jsdt.core.eval"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../../org/eclipse/wst/jsdt/core/eval/IGlobalVariable.html" title="interface in org.eclipse.wst.jsdt.core.eval"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/eclipse/wst/jsdt/core/eval/IEvaluationContext.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="IEvaluationContext.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>