--- /dev/null
+/*
+ * 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) {
+ }
+ }
+ }
+}