improved PHP parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / text / template / LocalVariableProposal.java
index 2e79bb8..d74f323 100644 (file)
@@ -18,21 +18,28 @@ import org.eclipse.swt.graphics.Image;
 public class LocalVariableProposal extends AbstractProposal {
 
   private final String fIdentifierName;
+
   private final IRegion fRegion;
-  private int fRelevance;
+
+  private final int fRelevance;
 
   /**
    * Creates a template proposal with a template and its context.
+   * 
    * @param template
    *          the template
    * @param image
    *          the icon of the proposal.
    */
   public LocalVariableProposal(String identifierName, IRegion region, ITextViewer viewer) {
+    this(identifierName, region, viewer, 99);
+  }
+
+  public LocalVariableProposal(String identifierName, IRegion region, ITextViewer viewer, int relevance) {
     super(viewer);
     fIdentifierName = identifierName;
     fRegion = region;
-    fRelevance = 99;
+    fRelevance = relevance;
   }
 
   /*
@@ -84,15 +91,11 @@ public class LocalVariableProposal extends AbstractProposal {
    */
   public String getAdditionalProposalInfo() {
     StringBuffer hoverInfoBuffer = new StringBuffer();
-    //    String workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
-//    String workspaceLocation;
-//    if (fProject != null) {
-//      workspaceLocation = fProject.getLocation().toString() + '/';
-//    } else {
-//      // should never happen?
-//      workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
-//    }
-    hoverInfoBuffer.append("local variable -");
+    if (fRelevance>95) {
+      hoverInfoBuffer.append("function source variable -");
+    } else {
+      hoverInfoBuffer.append("editor source variable -");
+    }
     hoverInfoBuffer.append(fIdentifierName);
     return hoverInfoBuffer.toString();
   }
@@ -133,10 +136,5 @@ public class LocalVariableProposal extends AbstractProposal {
   public int hashCode() {
     return fIdentifierName.hashCode();
   }
-  /**
-   * @param relevance The relevance to set.
-   */
-  public void setRelevance(int relevance) {
-    fRelevance = relevance;
-  }
+
 }
\ No newline at end of file