X-Git-Url: http://git.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 5d98915..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
@@ -9,6 +9,7 @@ import net.sourceforge.phpdt.internal.corext.template.DocumentTemplateContext;
import net.sourceforge.phpdt.internal.corext.template.Template;
import net.sourceforge.phpdt.internal.corext.template.TemplateBuffer;
import net.sourceforge.phpdt.internal.corext.template.TemplateTranslator;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -24,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.
*
@@ -36,10 +37,17 @@ public class PHPUnitContext extends DocumentTemplateContext {
protected PHPUnitContext(ContextType type, IDocument document, int completionPosition)
//,ICompilationUnit compilationUnit)
{
- super(type, document, completionPosition);
+ 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)
*/
@@ -57,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());
}
/*
@@ -93,8 +102,12 @@ public class PHPUnitContext extends DocumentTemplateContext {
public int getStart() {
IDocument document = getDocument();
try {
- int start = getCompletionPosition();
+ 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--;
@@ -108,7 +121,7 @@ public class PHPUnitContext extends DocumentTemplateContext {
return start;
} catch (BadLocationException e) {
- return getCompletionPosition();
+ return getCompletionOffset();
}
}
@@ -125,6 +138,7 @@ public class PHPUnitContext extends DocumentTemplateContext {
return ' ';
}
}
+
/**
* Returns the compilation unit if one is associated with this context, null
otherwise.
*/
@@ -152,4 +166,11 @@ public class PHPUnitContext extends DocumentTemplateContext {
// }
// }
+ /**
+ * @param b
+ */
+ public void setForceEvaluation(boolean b) {
+ fForceEvaluation = b;
+ }
+
}