documentation: IDocumentationResponse.getText() method added
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/AbstractDocumentationResponse.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/AbstractDocumentationResponse.java
index 8c89933..53cce5b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/AbstractDocumentationResponse.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/AbstractDocumentationResponse.java
@@ -12,6 +12,7 @@
package org.eclipse.dltk.ui.documentation;
import java.io.IOException;
+import java.io.Reader;
import java.net.URL;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -47,4 +48,17 @@
return null;
}
+ public String getText() throws IOException {
+ final Reader reader = getReader();
+ try {
+ return DocumentationUtils.readAll(reader);
+ } finally {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ // ignore close exception
+ }
+ }
+ }
+
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/DocumentationResponseDelegate.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/DocumentationResponseDelegate.java
index 4ac8420..96a9597 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/DocumentationResponseDelegate.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/DocumentationResponseDelegate.java
@@ -40,6 +40,10 @@
return target.getReader();
}
+ public String getText() throws IOException {
+ return target.getText();
+ }
+
public DocumentationResponseDelegate(IDocumentationResponse target) {
this.target = target;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/IDocumentationResponse.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/IDocumentationResponse.java
index 8ccf411..1d6b149 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/IDocumentationResponse.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/IDocumentationResponse.java
@@ -68,4 +68,11 @@
* @throws IOException
*/
Reader getReader() throws IOException;
+
+ /**
+ * Returns the documentation contents as String.
+ *
+ * @throws IOException
+ */
+ String getText() throws IOException;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/TextDocumentationResponse.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/TextDocumentationResponse.java
index 23c57d2..e2a1061 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/TextDocumentationResponse.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/documentation/TextDocumentationResponse.java
@@ -47,6 +47,11 @@
}
@Override
+ public String getText() {
+ return content;
+ }
+
+ @Override
public String getTitle() {
return title;
}