import net.sourceforge.phpdt.internal.corext.template.ContextType;
import net.sourceforge.phpdt.internal.corext.template.DocumentTemplateContext;
+import net.sourceforge.phpdt.internal.corext.template.ITemplateEditor;
import net.sourceforge.phpdt.internal.corext.template.Template;
import net.sourceforge.phpdt.internal.corext.template.TemplateBuffer;
import net.sourceforge.phpdt.internal.corext.template.TemplateTranslator;
private static final String specialChars = "$";
/** The compilation unit, may be <code>null</code>. */
// private final ICompilationUnit fCompilationUnit;
-
+ protected boolean fForceEvaluation;
/**
* Creates a compilation unit context.
*
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)
*/
return
// fEnabled &&
// fContextTypeName.equals(contextTypeName) &&
- (prefix.length() != 0) && identifier.toLowerCase().startsWith(prefix.toLowerCase());
+// (prefix.length() != 0) &&
+ identifier.toLowerCase().startsWith(prefix.toLowerCase());
}
/*
if (lineDelimiter == null)
lineDelimiter = PLATFORM_LINE_DELIMITER;
- // ITemplateEditor formatter= new JavaFormatter(lineDelimiter);
- // formatter.edit(buffer, this);
+// ITemplateEditor formatter= new PHPFormatter(lineDelimiter);
+// formatter.edit(buffer, this);
return buffer;
}
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--;
return ' ';
}
}
+
/**
* Returns the compilation unit if one is associated with this context, <code>null</code> otherwise.
*/
// }
// }
+ /**
+ * @param b
+ */
+ public void setForceEvaluation(boolean b) {
+ fForceEvaluation = b;
+ }
+
}