Browse Source

Improved link layout and removed generation of duplicates.

tags/Root_ajdt_support
mkersten 20 years ago
parent
commit
f716a6fbdd

+ 18
- 16
ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java View File

String adviceDoc String adviceDoc
= "<TABLE WIDTH=\"100%\" BGCOLOR=#FFFFFF><TR>" + = "<TABLE WIDTH=\"100%\" BGCOLOR=#FFFFFF><TR>" +
"<TD width=\"15%\" bgcolor=\"#FFD8B0\"><B><FONT COLOR=000000>&nbsp;Advised by:</font></b></td><td>";
"<TD width=\"15%\" bgcolor=\"#FFD8B0\"><B><FONT COLOR=000000>&nbsp;Advised&nbsp;by:</font></b></td><td>";


List addedNames = new ArrayList();
for (Iterator it = targets.iterator(); it.hasNext(); ) { for (Iterator it = targets.iterator(); it.hasNext(); ) {
String currHandle = (String)it.next(); String currHandle = (String)it.next();
IProgramElement currDecl = AsmManager.getDefault().getHierarchy().findElementForHandle(currHandle); IProgramElement currDecl = AsmManager.getDefault().getHierarchy().findElementForHandle(currHandle);
hrefLink += currDecl.getParent().toLinkLabelString() + ".html" hrefLink += currDecl.getParent().toLinkLabelString() + ".html"
+ "#" + currDecl.toLabelString(); + "#" + currDecl.toLabelString();


adviceDoc = adviceDoc +
"<A HREF=\"" + hrefLink + "\"><tt>"
+ hrefName.replace('/', '.') + "</tt></A>";
if (it.hasNext()) adviceDoc += ", ";
if (!addedNames.contains(hrefName)) {
adviceDoc = adviceDoc +
"<A HREF=\"" + hrefLink + "\"><tt>"
+ hrefName.replace('/', '.') + "</tt></A>";
if (it.hasNext()) adviceDoc += ", ";
addedNames.add(hrefName);
}
} }
adviceDoc += "</TR></TD></TABLE>\n"; adviceDoc += "</TR></TD></TABLE>\n";
fileContentsBuffer.insert( index, adviceDoc ); fileContentsBuffer.insert( index, adviceDoc );
= "<TABLE WIDTH=\"100%\" BGCOLOR=#FFFFFF><TR>" + = "<TABLE WIDTH=\"100%\" BGCOLOR=#FFFFFF><TR>" +
"<TD width=\"10%\" bgcolor=\"#FFD8B0\"><B><FONT COLOR=000000>&nbsp;Advises:</b></font></td><td>"; "<TD width=\"10%\" bgcolor=\"#FFD8B0\"><B><FONT COLOR=000000>&nbsp;Advises:</b></font></td><td>";
List addedNames = new ArrayList(); // for ensuring that we don't add duplciates
for (Iterator it = targets.iterator(); it.hasNext(); ) { for (Iterator it = targets.iterator(); it.hasNext(); ) {
String currHandle = (String)it.next(); String currHandle = (String)it.next();
IProgramElement currDecl = AsmManager.getDefault().getHierarchy().findElementForHandle(currHandle); IProgramElement currDecl = AsmManager.getDefault().getHierarchy().findElementForHandle(currHandle);
linkRef = currDecl.getParent().getParent().getName() + "." + linkRef; linkRef = currDecl.getParent().getParent().getName() + "." + linkRef;
} }
} }
entry += "<A HREF=\"" + linkRef +
"\"><tt>" + linkName.replace('/', '.') + "</tt></A>"; // !!! don't replace
if (it.hasNext()) entry += ", ";
// if ( isIntroduction ) {
// if ( !addedDecls.contains(currDecl.getSourceSignature() ) ) {
// //addedDecls.add(currDecl.getPackageName() + "." + currDecl.getSignature());
// addedDecls.add(packageName + currDecl.getSourceSignature());
// }
// }
}
if (!addedNames.contains(linkName)) {
entry += "<A HREF=\"" + linkRef +
"\"><tt>" + linkName.replace('/', '.') + "</tt></A>"; // !!! don't replace
if (it.hasNext()) entry += ", ";
addedNames.add(linkName);
}
}
} }
entry += "</B></FONT></TD></TR></TABLE>\n</TR></TD>\n"; entry += "</B></FONT></TD></TR></TABLE>\n</TR></TD>\n";
return entry; return entry;

+ 7
- 3
ajdoc/src/org/aspectj/tools/ajdoc/Main.java View File



public static void main(String[] args) { public static void main(String[] args) {
aborted = false; aborted = false;
// System.err.println("> command invoked: " + Arrays.asList(args).toString());
// STEP 1: parse the command line and do other global setup // STEP 1: parse the command line and do other global setup
sourcepath.addElement("."); // add the current directory to the classapth sourcepath.addElement("."); // add the current directory to the classapth
parseCommandLine(args);
parseCommandLine(args);
rootDir = getRootDir(); rootDir = getRootDir();
symbolManager = SymbolManager.getDefault(); symbolManager = SymbolManager.getDefault();
File[] inputFiles = new File[filenames.size()]; File[] inputFiles = new File[filenames.size()];
static void parseCommandLine(String[] args) { static void parseCommandLine(String[] args) {
if (args.length == 0) { if (args.length == 0) {
displayHelpAndExit( null ); displayHelpAndExit( null );
} else if (args.length == 1 && args[0].startsWith("@")) {
System.err.println("!!!!!!!!");
} }
List vargs = new LinkedList(Arrays.asList(args)); List vargs = new LinkedList(Arrays.asList(args));


else { else {
// didn't find it on that element of the classpath but that's ok // didn't find it on that element of the classpath but that's ok
} }
}
}
} }
} }
} }

+ 2
- 2
ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java View File

public static Test suite() { public static Test suite() {
TestSuite suite = new TestSuite("Test for org.aspectj.tools.ajdoc"); TestSuite suite = new TestSuite("Test for org.aspectj.tools.ajdoc");
//$JUnit-BEGIN$ //$JUnit-BEGIN$
suite.addTestSuite(MainTestCase.class);
suite.addTestSuite(ExecutionTestCase.class);
suite.addTestSuite(SpacewarTestCase.class); suite.addTestSuite(SpacewarTestCase.class);
suite.addTestSuite(ExecutionTestCase.class);
suite.addTestSuite(MainTestCase.class); // !!! must be last because it exists
//$JUnit-END$ //$JUnit-END$
return suite; return suite;
} }

Loading…
Cancel
Save