X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitContext.java index dc3d508..a7defad 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitContext.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CompilationUnitContext.java @@ -19,8 +19,8 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.templates.DocumentTemplateContext; import org.eclipse.jface.text.templates.TemplateContextType; -//import net.sourceforge.phpdt.internal.ui.text.template.contentassist.MultiVariableGuess; - +// import +// net.sourceforge.phpdt.internal.ui.text.template.contentassist.MultiVariableGuess; /** * A compilation unit context. @@ -29,74 +29,84 @@ public abstract class CompilationUnitContext extends DocumentTemplateContext { /** The compilation unit, may be null. */ private final ICompilationUnit fCompilationUnit; + /** A flag to force evaluation in head-less mode. */ protected boolean fForceEvaluation; + /** A global state for proposals that change if a master proposal changes. */ protected MultiVariableGuess fMultiVariableGuess; /** * Creates a compilation unit context. * - * @param type the context type - * @param document the document - * @param completionOffset the completion position within the document - * @param completionLength the completion length within the document - * @param compilationUnit the compilation unit (may be null) + * @param type + * the context type + * @param document + * the document + * @param completionOffset + * the completion position within the document + * @param completionLength + * the completion length within the document + * @param compilationUnit + * the compilation unit (may be null) */ - protected CompilationUnitContext(TemplateContextType type, IDocument document, int completionOffset, - int completionLength, ICompilationUnit compilationUnit) - { + protected CompilationUnitContext(TemplateContextType type, + IDocument document, int completionOffset, int completionLength, + ICompilationUnit compilationUnit) { super(type, document, completionOffset, completionLength); - fCompilationUnit= compilationUnit; + fCompilationUnit = compilationUnit; } - + /** - * Returns the compilation unit if one is associated with this context, null otherwise. + * Returns the compilation unit if one is associated with this context, + * null otherwise. */ public final ICompilationUnit getCompilationUnit() { return fCompilationUnit; } /** - * Returns the enclosing element of a particular element type, null - * if no enclosing element of that type exists. + * Returns the enclosing element of a particular element type, + * null if no enclosing element of that type exists. */ public IJavaElement findEnclosingElement(int elementType) { if (fCompilationUnit == null) return null; try { - IJavaElement element= fCompilationUnit.getElementAt(getStart()); + IJavaElement element = fCompilationUnit.getElementAt(getStart()); if (element == null) { - element= fCompilationUnit; + element = fCompilationUnit; } - + return element.getAncestor(elementType); } catch (JavaModelException e) { return null; - } + } } /** * Forces evaluation. */ public void setForceEvaluation(boolean evaluate) { - fForceEvaluation= evaluate; + fForceEvaluation = evaluate; } - + /** * Returns the multivariable guess - state + * * @return */ public MultiVariableGuess getMultiVariableGuess() { return fMultiVariableGuess; - } + } /** - * @param multiVariableGuess The multiVariableGuess to set. + * @param multiVariableGuess + * The multiVariableGuess to set. */ public void setMultiVariableGuess(MultiVariableGuess multiVariableGuess) { - fMultiVariableGuess= multiVariableGuess; + fMultiVariableGuess = multiVariableGuess; } }