summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-05-05 16:05:03 +0000
committermichelou <michelou@epfl.ch>2006-05-05 16:05:03 +0000
commitbffeaa0e043c2034bb06826854cd8769756f25ae (patch)
tree7cb7bc1c2e972707914f56453db5f2d37e40546f
parentb1e41df94da49a57f382776c51acb2b0add80594 (diff)
downloadscala-bffeaa0e043c2034bb06826854cd8769756f25ae.tar.gz
scala-bffeaa0e043c2034bb06826854cd8769756f25ae.tar.bz2
scala-bffeaa0e043c2034bb06826854cd8769756f25ae.zip
added hrefs to classes of Java API using JavaSc...
added hrefs to classes of Java API using JavaScript
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocGenerator.scala9
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocUtil.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/script.js32
3 files changed, 40 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
index 55278d44ea..709eac4025 100644
--- a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
@@ -66,8 +66,13 @@ abstract class DocGenerator extends Models {
}
def urlFor(tpe: Type, target: String): NodeSeq = try {
- if (tpe.symbol.sourceFile == null) Text(tpe.toString());
- else aref(urlFor(tpe.symbol), target, tpe.toString());
+ if (tpe.symbol.hasFlag(symtab.Flags.JAVA))
+ <a class={tpe.toString().replace('.', '_')} href=""
+ target="contentFrame">{tpe.toString()}</a>
+ else if (tpe.symbol.sourceFile == null)
+ Text(tpe.toString())
+ else
+ aref(urlFor(tpe.symbol), target, tpe.toString());
} catch {
case e : Error =>
//System.err.println("SYM=" + sym);
diff --git a/src/compiler/scala/tools/nsc/doc/DocUtil.scala b/src/compiler/scala/tools/nsc/doc/DocUtil.scala
index d187c7d182..fd67deafa4 100644
--- a/src/compiler/scala/tools/nsc/doc/DocUtil.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocUtil.scala
@@ -57,7 +57,7 @@ object DocUtil {
<script type="text/javascript" src={relative + "script.js"}></script>;
def body0(hasBody: Boolean, nodes: NodeSeq): NodeSeq =
- if (!hasBody) nodes else <body>{nodes}</body>;
+ if (!hasBody) nodes else <body onload="init()">{nodes}</body>;
val dtype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
diff --git a/src/compiler/scala/tools/nsc/doc/script.js b/src/compiler/scala/tools/nsc/doc/script.js
index 94093ecc50..dccda75730 100644
--- a/src/compiler/scala/tools/nsc/doc/script.js
+++ b/src/compiler/scala/tools/nsc/doc/script.js
@@ -2,4 +2,36 @@
function setWindowTitle(title) {
parent.document.title = title;
}
+
+var api_root = 'http://java.sun.com/j2se/1.5.0/docs/api/';
+//var api_root = 'file:///home/linuxsoft/apps/java/docs/api/';
+
+// hashtable
+var table = new Array()
+
+function init() {
+ // initialize hashtable
+ table['java_lang_Long'] = true;
+ table['java_lang_Object'] = true;
+ table['java_lang_String'] = true;
+ table['java_net_URI'] = true;
+ table['java_sql_Connection'] = true;
+ table['java_sql_ResultSetMetaData'] = true;
+ table['java_util_Properties'] = true;
+ table['scala_Unit'] = true;
+
+ var elems = document.getElementsByTagName('a');
+ for (i = 0; i < elems.length; i++) {
+ try {
+ key = elems[i].getAttribute('class');
+ if (table[key] != null) {
+ value = api_root + key.replace(/_/g, "/") + ".html";
+ elems[i].setAttribute('href', value);
+ }
+ }
+ catch (e) {
+ // do nothing
+ }
+ }
+}
-->