summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java126
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/Main.java8
2 files changed, 55 insertions, 79 deletions
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
index 81d555257..2f2a82cde 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
@@ -421,12 +421,19 @@ class HtmlDecorator {
String currHandle = (String)it.next();
IProgramElement currDecl = AsmManager.getDefault().getHierarchy().findElementForHandle(currHandle);
+ String packagePath = "";
+ if (currDecl.getPackageName() != null && !currDecl.getPackageName().equals("")) {
+ packagePath = currDecl.getPackageName().replace('.', '/') + Config.DIR_SEP_CHAR;
+ }
+
String hrefName = "";
String hrefLink = "";
+
+ hrefLink = rootDir.getAbsolutePath() + "/" + packagePath;
if (currDecl.getPackageName() != null ) {
hrefName = currDecl.getPackageName().replace('.', '/');
- hrefLink = "";//+ currDecl.getPackageName() + Config.DIR_SEP_CHAR;
- }
+// hrefLink = "";//+ currDecl.getPackageName() + Config.DIR_SEP_CHAR;
+ }
hrefName += Config.DIR_SEP_CHAR +
currDecl.getParent().toLinkLabelString()
+ "." + currDecl.getName();
@@ -467,66 +474,62 @@ class HtmlDecorator {
if (currDecl.getKind().equals(IProgramElement.Kind.CODE)) {
currDecl = currDecl.getParent(); // promote to enclosing
}
- if (currDecl != null) {
+ if (currDecl != null && !StructureUtil.isAnonymous(currDecl.getParent())) {
String packagePath = "";
if (currDecl.getPackageName() != null && !currDecl.getPackageName().equals("")) {
packagePath = currDecl.getPackageName().replace('.', '/') + Config.DIR_SEP_CHAR;
}
- String linkRef = "";
- String linkName = rootDir.getAbsolutePath() + "/";
+ String hrefLink = "";
+ String hrefName = rootDir.getAbsolutePath() + "/";
if (currDecl.getKind().isType()) {
- // Handling type
- linkName = packagePath;
- if (isNestedType(currDecl)) {
- linkName =
- getAncestorComponents(
- currDecl.getParent(),
- linkName);
+ hrefName = packagePath;
+ if (currDecl.getParent().getKind().isType()) {
+ hrefName =
+ hrefName + currDecl.getParent().getName() + ".";
}
- linkName = linkName + currDecl.getName();
-
- linkRef = getRelativeComponent(packagePath) + packagePath;
- if (isNestedType(currDecl)) {
- linkRef =
- getAncestorComponents(
- currDecl.getParent(),
- linkRef);
+ hrefName = hrefName + currDecl.getName();
+
+ hrefLink = rootDir.getAbsolutePath() + "/" + packagePath;
+// hrefLink = getRelativeComponent(packagePath) + packagePath;
+ // XXX: only one level of nested classes
+ if (currDecl.getParent().getKind().isType()) {
+ hrefLink =
+ hrefLink + currDecl.getParent().getName() + ".";
}
- linkRef = linkRef + currDecl.toLabelString() + ".html";
+ hrefLink = hrefLink + currDecl.toLabelString() + ".html";
} else {
- // Handling member
- linkName = packagePath;
- if (isMemberOfNestedType(currDecl)) {
- linkName =
- getAncestorComponents(
- currDecl.getParent().getParent(),
- linkName);
+ hrefName = packagePath;
+ if (currDecl.getParent().getParent().getKind().isType()) {
+ hrefName += currDecl.getParent().getParent().getName()
+ + ".";
+ }
+ hrefName += currDecl.getParent().getName()
+ + "." + currDecl.getName();
+
+ hrefLink = rootDir.getAbsolutePath() + "/" + packagePath;
+// getRelativeComponent(packagePath) + packagePath;
+
+ // Constructing the hrefLink string requires a check
+ // to see if the parent type is actually nested inside
+ // another type.
+
+ // XXX: only one level of nested classes
+ if (currDecl.getParent().getParent().getKind().isType()) {
+ hrefLink +=
+ currDecl.getParent().getParent().getName()
+ + ".";
}
- linkName =
- linkName
- + currDecl.getParent().getName()
- + "."
- + currDecl.getName();
-
- linkRef = getRelativeComponent(packagePath) + packagePath;
- if (isMemberOfNestedType(currDecl)) {
- linkRef =
- getAncestorComponents(
- currDecl.getParent().getParent(),
- linkRef);
- }
- linkRef =
- linkRef
- + currDecl.getParent().getName()
+ hrefLink +=
+ currDecl.getParent().getName()
+ ".html"
+ "#"
+ currDecl.toLabelString();
}
- if (!addedNames.contains(linkName)) {
- entry += "<A HREF=\"" + linkRef +
- "\"><tt>" + linkName.replace('/', '.') + "</tt></A>"; // !!! don't replace
+ if (!addedNames.contains(hrefName)) {
+ entry += "<A HREF=\"" + hrefLink +
+ "\"><tt>" + hrefName.replace('/', '.') + "</tt></A>"; // !!! don't replace
if (it.hasNext()) entry += ", ";
- addedNames.add(linkName);
+ addedNames.add(hrefName);
}
}
}
@@ -534,33 +537,6 @@ 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
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
index ea8a2d96f..89d78c4f5 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
@@ -514,10 +514,10 @@ public class Main implements Config {
}
else if ( arg.equals( "-source" ) ) {
addNextAsOption = true;
- addNextToAJCOptions = true;
- addNextAsClasspath = false;
- options.addElement(arg);
- ajcOptions.addElement(arg);
+ addNextToAJCOptions = true;
+ addNextAsClasspath = true;
+ options.addElement(arg);
+ ajcOptions.addElement(arg);
}
else if ( arg.equals( "-classpath" ) ) {
addNextAsOption = true;