X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/java/CompilationUnitContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/java/CompilationUnitContext.java index dcc8f00..17f42d6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/java/CompilationUnitContext.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/java/CompilationUnitContext.java @@ -47,6 +47,19 @@ public class CompilationUnitContext extends DocumentTemplateContext { return template.matches(getKey(), getContextType().getName()); } + /** + * Returns true if template matches the prefix and context, + * false otherwise. + */ + public boolean canEvaluate(String identifier) { + String prefix = getKey(); + return +// fEnabled && +// fContextTypeName.equals(contextTypeName) && + (prefix.length() != 0) && + identifier.toLowerCase().startsWith(prefix.toLowerCase()); + } + /* * @see TemplateContext#evaluate(Template template) */ @@ -82,11 +95,15 @@ public class CompilationUnitContext extends DocumentTemplateContext { try { int start= getCompletionPosition(); - while ((start != 0) && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) + while ( ((start != 0) && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) || + ((start != 0) && document.getChar(start - 1)=='$') ) { start--; + } - if ((start != 0) && Character.isUnicodeIdentifierStart(document.getChar(start - 1))) + if ( ((start != 0) && Character.isUnicodeIdentifierStart(document.getChar(start - 1))) || + ((start != 0) && document.getChar(start - 1)=='$')) { start--; + } return start;