X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/PHPUnitContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/PHPUnitContext.java index 22ac0e2..8f9a0be 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/PHPUnitContext.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/PHPUnitContext.java @@ -25,7 +25,7 @@ public class PHPUnitContext extends DocumentTemplateContext { private static final String specialChars = "$"; /** The compilation unit, may be null. */ // private final ICompilationUnit fCompilationUnit; - + protected boolean fForceEvaluation; /** * Creates a compilation unit context. * @@ -40,7 +40,14 @@ public class PHPUnitContext extends DocumentTemplateContext { super(type, document, completionPosition, 0); // fCompilationUnit= compilationUnit; } - + + protected PHPUnitContext(ContextType type, IDocument document, int completionPosition, int completionLength) + //,ICompilationUnit compilationUnit) + { + super(type, document, completionPosition, completionLength); + // fCompilationUnit= compilationUnit; + } + /* * @see TemplateContext#canEvaluate(Template templates) */ @@ -58,7 +65,8 @@ public class PHPUnitContext extends DocumentTemplateContext { return // fEnabled && // fContextTypeName.equals(contextTypeName) && - (prefix.length() != 0) && identifier.toLowerCase().startsWith(prefix.toLowerCase()); +// (prefix.length() != 0) && + identifier.toLowerCase().startsWith(prefix.toLowerCase()); } /* @@ -96,6 +104,10 @@ public class PHPUnitContext extends DocumentTemplateContext { try { int start = getCompletionOffset(); + if ( ((start != 0) && specialChars.indexOf(document.getChar(start - 1)) != (-1) )) { + return --start; + } + while (((start != 0) && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) || ((start != 0) && specialChars.indexOf(document.getChar(start - 1)) != (-1) )) { start--; @@ -126,6 +138,7 @@ public class PHPUnitContext extends DocumentTemplateContext { return ' '; } } + /** * Returns the compilation unit if one is associated with this context, null otherwise. */ @@ -153,4 +166,11 @@ public class PHPUnitContext extends DocumentTemplateContext { // } // } + /** + * @param b + */ + public void setForceEvaluation(boolean b) { + fForceEvaluation = b; + } + }