transient private Declaration[] pointsTo = null;
private Declaration parentDeclaration = null;
+ private IProgramElement node;
public Declaration(int beginLine, int endLine, int beginColumn, int endColumn,
String modifiers, String signature, String fullSignature,
String crosscutDesignator,
String declaringType, String kind,
String filename, String formalComment,
- String packageName)
+ String packageName,
+ IProgramElement node)
{
this.beginLine = beginLine;
this.endLine = endLine;
this.pointsToHandles = new Handle[0];
//???
this.declarations = new Declaration[0];
+ this.node = node;
}
public int getBeginLine() { return beginLine; }
return manager.getDeclarationAtPoint(filename, line, column);
}
}
+ public IProgramElement getNode() {
+ return node;
+ }
}
String packageName = decl.getPackageName();
String filename = "";
if ( packageName != null ) {
+
int index1 = base.lastIndexOf(Config.DIR_SEP_CHAR);
int index2 = base.lastIndexOf(".");
String currFileClass = "";
if (index1 > -1 && index2 > 0 && index1 < index2) {
currFileClass = base.substring(index1+1, index2);
}
+
+ // XXX only one level of nexting
if (currFileClass.equals(decl.getDeclaringType())) {
- // !!! hack for inner class !!!
+ nestedClass = true;
packageName = packageName.replace( '.','/' );
String newBase = "";
if ( base.lastIndexOf(Config.DIR_SEP_CHAR) > 0 ) {
newBase = base.substring(0, base.lastIndexOf(Config.DIR_SEP_CHAR));
}
+ String signature = constructNestedTypeName(decl.getNode());
+
filename = newBase + Config.DIR_SEP_CHAR + packageName +
Config.DIR_SEP_CHAR + currFileClass + //"." +
- decl.getSignature() + ".html";
- nestedClass = true;
+ signature + ".html";
} else {
- packageName = packageName.replace( '.','/' ); // !!!
+ packageName = packageName.replace( '.','/' );
filename = base + packageName + Config.DIR_SEP_CHAR + decl.getSignature() + ".html";
}
}
}
if (!exceededNestingLevel) {
decorateHTMLFile(new File(filename));
+
decorateHTMLFromDecls(decl.getDeclarations(),
base + decl.getSignature() + ".",
docModifier,
}
}
- static void decorateHTMLFile(File file) throws IOException {
+ private static String constructNestedTypeName(IProgramElement node) {
+ if (node.getParent().getKind().isSourceFile()) {
+ return node.getName();
+ } else {
+ String nodeName = "";
+ if (node.getKind().isType()) nodeName += '.' + node.getName();
+ return constructNestedTypeName(node.getParent()) + nodeName;
+ }
+ }
+
+ static void decorateHTMLFile(File file) throws IOException {
System.out.println( "> Decorating " + file.getCanonicalPath() + "..." );
BufferedReader reader = new BufferedReader(new FileReader(file));
StringBuffer fileContents = new StringBuffer();
}
else {
decorateMemberDocumentation(decl, fileContents, index);
- }
+ }
}
// Change "Class" to "Aspect", HACK: depends on "affects:"
if (currDecl.getPackageName() != null && !currDecl.getPackageName().equals("")) {
packagePath = currDecl.getPackageName().replace('.', '/') + Config.DIR_SEP_CHAR;
}
- String hrefLink = "";
- String hrefName = rootDir.getAbsolutePath() + "/";
- if (currDecl.getKind().isType()) {
- hrefName = packagePath;
- if (currDecl.getParent().getKind().isType()) {
- hrefName =
- hrefName + currDecl.getParent().getName() + ".";
- }
- 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() + ".";
- }
- hrefLink = hrefLink + currDecl.toLabelString() + ".html";
- } else {
- 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()
- + ".";
- }
- hrefLink +=
- currDecl.getParent().getName()
- + ".html"
- + "#"
- + currDecl.toLabelString();
+
+ String typeSignature = constructNestedTypeName(currDecl);
+
+ String hrefName =
+ packagePath
+ + typeSignature;
+
+ String hrefLink =
+ rootDir.getAbsolutePath() + "/"
+// getRelativePathFromHere(packagePath)
+ + packagePath
+ + typeSignature
+ + ".html";
+
+ if (!currDecl.getKind().isType()) {
+ hrefName += '.' + currDecl.getName();
+ hrefLink += "#" + currDecl.toLabelString();
}
+
if (!addedNames.contains(hrefName)) {
entry += "<A HREF=\"" + hrefLink +
"\"><tt>" + hrefName.replace('/', '.') + "</tt></A>"; // !!! don't replace
* @param packagePath
* @return String consisting of multiple "../" parts, one for
* each component part of the input <code>packagePath</code>.
- */
- private static String getRelativeComponent(String packagePath) {
- StringBuffer result = new StringBuffer("");
- if (packagePath != null && (packagePath.indexOf("/") != -1)) {
- StringTokenizer sTok = new StringTokenizer(packagePath, "/", false);
+ */
+ private static String getRelativePathFromHere(String packagePath) {
+ StringBuffer result = new StringBuffer("");
+ if (packagePath != null && (packagePath.indexOf("/") != -1)) {
+ StringTokenizer sTok = new StringTokenizer(packagePath, "/", false);
while (sTok.hasMoreTokens()) {
sTok.nextToken(); // don't care about the token value
result.append(".." + Config.DIR_SEP_CHAR);
/** Default to package visiblity. */
static String docModifier = "package";
- static Vector sourcepath = new Vector();
+ static Vector sourcepath;
static boolean verboseMode = false;
static boolean packageMode = false;
rootDir = null;
declIDTable = new Hashtable();
docDir = ".";
+ aborted = false;
+ deleteTempFilesOnExit = true;
}
public static void main(String[] args) {
- aborted = false;
- deleteTempFilesOnExit = true;
-
- filenames = new Vector();
- fileList= new Vector();
- packageList = new Vector();
- options = new Vector();
- ajcOptions = new Vector();
+ clearState();
// if (!JavadocRunner.has14ToolsAvailable()) {
// System.err.println("ajdoc requires a JDK 1.4 or later tools jar - exiting");
// aborted = true;
if ( ((String)options.elementAt(i)).equals( "-d" ) ) {
rootDir = new File((String)options.elementAt(i+1));
if ( !rootDir.exists() ) {
- System.out.println( "Destination directory not found: " +
- (String)options.elementAt(i+1) );
- System.exit( -1 );
+ rootDir.mkdir();
+// System.out.println( "Destination directory not found: " +
+// (String)options.elementAt(i+1) );
+// System.exit( -1 );
}
}
}
options.addElement(arg);
addNextAsOption = false;
}
- else {
+ else {
// check if this is a file or a package
- if ( arg.indexOf( ".java" ) == arg.length() - 5 ||
- arg.indexOf( ".lst" ) == arg.length() - 4 &&
+// System.err.println(">>>>>>>> " + );
+ String entryName = arg.substring(arg.lastIndexOf(File.separator)+1);
+ if ((arg.endsWith(".java") && entryName.indexOf('.') == entryName.length()-5) ||
+ arg.endsWith(".lst") &&
arg != null ) {
File f = new File(arg);
if (f.isAbsolute()) {
// PACKAGE MODE STUFF
else if (!ignoreArg) {
+
packageMode = true;
packageList.addElement( arg );
arg = arg.replace( '.', '/' ); // !!!