Defined a limit for code completion list entries PHPeclipsePlugin.MAX_PROPOSALS
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / corext / phpdoc / PHPDocUtil.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/PHPDocUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/phpdoc/PHPDocUtil.java
new file mode 100644 (file)
index 0000000..59b8ca3
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Created on 20.09.2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package net.sourceforge.phpdt.internal.corext.phpdoc;
+
+import java.io.FileReader;
+import java.io.IOException;
+
+import net.sourceforge.phpeclipse.builder.PHPIdentifierLocation;
+
+/**
+ * @author khartlage
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class PHPDocUtil {
+       
+       /**
+        * Generate a PHPDoc hover text if possible
+        * 
+        * @param hoverInfoBuffer
+        * @param filename
+        * @param location
+        */
+  public static void appendPHPDoc(StringBuffer hoverInfoBuffer, String filename, PHPIdentifierLocation location) {
+    hoverInfoBuffer.append(location.toString());
+    hoverInfoBuffer.append('\n');
+    if (location.getPHPDocOffset() >= 0) {
+      FileReader phpdocFileReader;
+      try {
+        phpdocFileReader = new FileReader(filename);
+
+        char[] charArray = new char[location.getPHPDocLength()];
+        phpdocFileReader.skip(location.getPHPDocOffset());
+        phpdocFileReader.read(charArray, 0, location.getPHPDocLength());
+        PHPDocCharArrayCommentReader phpdocConverter = new PHPDocCharArrayCommentReader(charArray);
+        hoverInfoBuffer.append(phpdocConverter.getString());
+        hoverInfoBuffer.append('\n');
+      } catch (IOException e) {
+      }
+    }
+  }
+}