aboutsummaryrefslogtreecommitdiffstats
path: root/ajdoc
diff options
context:
space:
mode:
authoraclement <aclement>2004-04-08 13:14:48 +0000
committeraclement <aclement>2004-04-08 13:14:48 +0000
commit66be44ad6c64129239852054a3e75b0c5958035f (patch)
treeb0dd87b6ebc6cf283881cde809135ca59972c06b /ajdoc
parentb0d32cafba6241023d1efdc343a2744a5e25a00d (diff)
downloadaspectj-66be44ad6c64129239852054a3e75b0c5958035f.tar.gz
aspectj-66be44ad6c64129239852054a3e75b0c5958035f.zip
Fix broken links in ajdoc. Part 4 : fix links to members of types
in other packages (again). Also, fix for nested types. Covers more than one level of nesting. NOTE: the tool is currently not capable of producing output for more than one level of nesting. Bug will be raised if Ron has not already opened it.
Diffstat (limited to 'ajdoc')
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java62
1 files changed, 45 insertions, 17 deletions
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
index 8c93a10ef..81d555257 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
@@ -475,27 +475,32 @@ class HtmlDecorator {
String linkRef = "";
String linkName = rootDir.getAbsolutePath() + "/";
if (currDecl.getKind().isType()) {
+ // Handling type
linkName = packagePath;
- if (currDecl.getParent().getKind().isType()) {
+ if (isNestedType(currDecl)) {
linkName =
- linkName + currDecl.getParent().getName() + ".";
+ getAncestorComponents(
+ currDecl.getParent(),
+ linkName);
}
linkName = linkName + currDecl.getName();
linkRef = getRelativeComponent(packagePath) + packagePath;
- // XXX: only one level of nested classes
- if (currDecl.getParent().getKind().isType()) {
+ if (isNestedType(currDecl)) {
linkRef =
- linkRef + currDecl.getParent().getName() + ".";
+ getAncestorComponents(
+ currDecl.getParent(),
+ linkRef);
}
linkRef = linkRef + currDecl.toLabelString() + ".html";
} else {
+ // Handling member
linkName = packagePath;
- if (currDecl.getParent().getParent().getKind().isType()) {
+ if (isMemberOfNestedType(currDecl)) {
linkName =
- linkName
- + currDecl.getParent().getParent().getName()
- + ".";
+ getAncestorComponents(
+ currDecl.getParent().getParent(),
+ linkName);
}
linkName =
linkName
@@ -503,16 +508,12 @@ class HtmlDecorator {
+ "."
+ currDecl.getName();
- // Constructing the linkRef string requires a check
- // to see if the parent type is actually nested inside
- // another type.
linkRef = getRelativeComponent(packagePath) + packagePath;
- // XXX: only one level of nested classes
- if (currDecl.getParent().getParent().getKind().isType()) {
+ if (isMemberOfNestedType(currDecl)) {
linkRef =
- linkRef
- + currDecl.getParent().getParent().getName()
- + ".";
+ getAncestorComponents(
+ currDecl.getParent().getParent(),
+ linkRef);
}
linkRef =
linkRef
@@ -533,6 +534,33 @@ class HtmlDecorator {
return entry;
}
+ private static boolean isNestedType(IProgramElement currDecl) {
+ return currDecl.getParent().getKind().isType();
+ }
+
+ private static boolean isMemberOfNestedType(IProgramElement currDecl) {
+ return currDecl.getParent().getParent().getKind().isType();
+ }
+
+ /**
+ * Convenience method for dealing with nested inner types.
+ * Add the parent types to the link path for the supplied
+ * <code>IProgramElement</code>.
+ * HEALTH WARNING : May contain traces of recursion.
+ * @param decl
+ * @param path
+ * @return
+ */
+ private static String getAncestorComponents(
+ IProgramElement decl,
+ String path) {
+ String result = path;
+ if (decl.getParent().getKind().isType()) {
+ result = getAncestorComponents(decl.getParent(), result);
+ }
+ return result + decl.getName() + ".";
+ }
+
/**
* Generates a relative directory path fragment that can be
* used to navigate "upwards" from the directory location