new PartitionScanner version
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / text / template / DeclarationEngine.java
index f3f9132..9ff8886 100644 (file)
@@ -17,6 +17,7 @@ import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.builder.PHPIdentifierLocation;
 
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IRegion;
@@ -34,24 +35,26 @@ public class DeclarationEngine {
   /** Token determines last which declarations are allowed for proposal */
   private int fLastSignificantToken;
 
+  private IProject fProject;
   private IFile fFile;
-  private String fFileName;
+//  private String fFileName;
 
   /**
    * Creates the template engine for a particular context type.
    * See <code>TemplateContext</code> for supported context types.
    */
-  public DeclarationEngine(ContextType contextType, int lastSignificantToken, IFile file) {
+  public DeclarationEngine(IProject project, ContextType contextType, int lastSignificantToken, IFile file) {
     // Assert.isNotNull(contextType);
+    fProject = project;
     fContextType = contextType;
 
     fLastSignificantToken = lastSignificantToken;
     fFile = file;
-    if (fFile != null) {
-      fFileName = fFile.getFullPath().toString();
-    } else {
-      fFileName = "";
-    }
+//    if (fFile != null) {
+//      fFileName = fFile.getFullPath().toString();
+//    } else {
+//      fFileName = "";
+//    }
   }
 
   /**
@@ -128,9 +131,15 @@ public class DeclarationEngine {
               if (type != PHPIdentifierLocation.METHOD && type != PHPIdentifierLocation.VARIABLE) {
                 continue; // for loop
               }
-              if (!fFileName.equals(location.getFilename())) {
+              break;
+            case ITerminalSymbols.TokenNamethis_PHP_COMPLETION:
+              if (type != PHPIdentifierLocation.METHOD && type != PHPIdentifierLocation.VARIABLE) {
                 continue; // for loop
               }
+              // check all filenames of the subclasses
+//              if (!fFileName.equals(location.getFilename())) {
+//                continue; // for loop
+//              }
               break;
             case ITerminalSymbols.TokenNamenew :
               if (type != PHPIdentifierLocation.CLASS && type != PHPIdentifierLocation.CONSTRUCTOR) {
@@ -145,7 +154,7 @@ public class DeclarationEngine {
           if (maxProposals-- < 0) {
             return;
           }
-          fProposals.add(new DeclarationProposal(identifier, location, context, region, viewer));
+          fProposals.add( new DeclarationProposal(fProject, identifier, location, context, region, viewer));
         }
       }
     }