X-Git-Url: http://git.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInEngine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInEngine.java
index b1b8104..8aac30a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInEngine.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/BuiltInEngine.java
@@ -6,9 +6,10 @@ package net.sourceforge.phpdt.internal.ui.text.template;
import java.util.ArrayList;
-import net.sourceforge.phpdt.internal.corext.template.ContextType;
+import net.sourceforge.phpdt.core.ICompilationUnit;
import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitContextType;
-import net.sourceforge.phpdt.internal.corext.template.php.PHPUnitContext;
+import net.sourceforge.phpdt.internal.corext.template.php.JavaContext;
+import net.sourceforge.phpdt.internal.corext.template.php.JavaContextType;
import net.sourceforge.phpdt.internal.ui.text.java.IPHPCompletionProposal;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.phpeditor.php.PHPElement;
@@ -20,12 +21,12 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
-//import org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager;
+//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
public class BuiltInEngine {
/** The context type. */
- private ContextType fContextType;
+ private JavaContextType fContextType;
/** The result proposals. */
private ArrayList fProposals = new ArrayList();
@@ -33,7 +34,7 @@ public class BuiltInEngine {
* Creates the template engine for a particular context type.
* See TemplateContext
for supported context types.
*/
- public BuiltInEngine(ContextType contextType) {
+ public BuiltInEngine(JavaContextType contextType) {
// Assert.isNotNull(contextType);
fContextType = contextType;
}
@@ -62,8 +63,7 @@ public class BuiltInEngine {
* @param completionPosition the context position in the document of the text viewer
* @param compilationUnit the compilation unit (may be null
)
*/
- public void complete(ITextViewer viewer, int completionPosition, ArrayList identifiers)
- //,ICompilationUnit compilationUnit)
+ public void complete(ITextViewer viewer, int completionPosition, ArrayList identifiers,ICompilationUnit compilationUnit)
//hrows JavaModelException
{
IDocument document = viewer.getDocument();
@@ -84,9 +84,10 @@ public class BuiltInEngine {
}
}
- ((CompilationUnitContextType) fContextType).setContextParameters(document, completionPosition, selection.y); //mpilationUnit);
-
- PHPUnitContext context = (PHPUnitContext) fContextType.createContext();
+// ((CompilationUnitContextType) fContextType).setContextParameters(document, completionPosition, selection.y); //mpilationUnit);
+// JavaContext context = (JavaContext) fContextType.createContext();
+ JavaContext context = (JavaContext) fContextType.createContext(document, completionPosition,selection.y,compilationUnit);
+ context.setVariable("selection", selectedText); //$NON-NLS-1$
int start = context.getStart();
int end = context.getEnd();
IRegion region = new Region(start, end - start);