Fix Request #1431769: Support Context assistance when entering functions arguments
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / text / template / AbstractProposal.java
index f26f6a8..51773b9 100644 (file)
@@ -14,59 +14,67 @@ import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IRegion;
 import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformation;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Shell;
-//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
-//import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
-//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
+
+// import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
+// import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
+// import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
 
 /**
  * A PHP identifier proposal.
  */
 public abstract class AbstractProposal implements IPHPCompletionProposal {
        protected IRegion fSelectedRegion; // initialized by apply()
+
        protected final ITextViewer fViewer;
-       
+
+       protected ContextInformation fContextInfo;
+
        public AbstractProposal(ITextViewer viewer) {
+               fContextInfo = null;
                fViewer = viewer;
        }
+
        protected static String textToHTML(String string) {
-    StringBuffer buffer = new StringBuffer(string.length());
-    buffer.append("<pre>"); //$NON-NLS-1$
+               StringBuffer buffer = new StringBuffer(string.length());
+               buffer.append("<pre>"); //$NON-NLS-1$
 
-    for (int i = 0; i != string.length(); i++) {
-      char ch = string.charAt(i);
+               for (int i = 0; i != string.length(); i++) {
+                       char ch = string.charAt(i);
 
-      switch (ch) {
-        case '&' :
-          buffer.append("&amp;"); //$NON-NLS-1$
-          break;
+                       switch (ch) {
+                       case '&':
+                               buffer.append("&amp;"); //$NON-NLS-1$
+                               break;
 
-        case '<' :
-          buffer.append("&lt;"); //$NON-NLS-1$
-          break;
+                       case '<':
+                               buffer.append("&lt;"); //$NON-NLS-1$
+                               break;
 
-        case '>' :
-          buffer.append("&gt;"); //$NON-NLS-1$
-          break;
+                       case '>':
+                               buffer.append("&gt;"); //$NON-NLS-1$
+                               break;
 
-        case '\t' :
-          buffer.append("    "); //$NON-NLS-1$
-          break;
+                       case '\t':
+                               buffer.append("    "); //$NON-NLS-1$
+                               break;
 
-        case '\n' :
-          buffer.append("<br>"); //$NON-NLS-1$
-          break;
+                       case '\n':
+                               buffer.append("<br>"); //$NON-NLS-1$
+                               break;
 
-        default :
-          buffer.append(ch);
-          break;
-      }
-    }
+                       default:
+                               buffer.append(ch);
+                               break;
+                       }
+               }
 
-    buffer.append("</pre>"); //$NON-NLS-1$
-    return buffer.toString();
-  }
+               buffer.append("</pre>"); //$NON-NLS-1$
+               return buffer.toString();
+       }
 
        /*
         * @see ICompletionProposal#getSelection(IDocument)
@@ -78,11 +86,18 @@ public abstract class AbstractProposal implements IPHPCompletionProposal {
        protected void handleException(CoreException e) {
                Shell shell = fViewer.getTextWidget().getShell();
                PHPeclipsePlugin.log(e);
-               //              ExceptionHandler.handle(e, shell, ObfuscatorMessages.getString("TemplateEvaluator.error.title"), null); //$NON-NLS-1$
+               // ExceptionHandler.handle(e, shell,
+               // ObfuscatorMessages.getString("TemplateEvaluator.error.title"), null);
+               // //$NON-NLS-1$
        }
 
        protected void openErrorDialog(BadLocationException e) {
                Shell shell = fViewer.getTextWidget().getShell();
                MessageDialog.openError(shell, TemplateMessages.getString("TemplateEvaluator.error.title"), e.getMessage()); //$NON-NLS-1$
        }
+
+       public IContextInformation getContextInformation() {
+               return null;
+       }
+
 }
\ No newline at end of file