From f716a6fbdd5c9977dc6faae8f40d94f4717c269e Mon Sep 17 00:00:00 2001 From: mkersten Date: Tue, 30 Mar 2004 17:14:39 +0000 Subject: [PATCH] Improved link layout and removed generation of duplicates. --- .../aspectj/tools/ajdoc/HtmlDecorator.java | 34 ++++++++++--------- ajdoc/src/org/aspectj/tools/ajdoc/Main.java | 10 ++++-- .../aspectj/tools/ajdoc/AjdocModuleTests.java | 4 +-- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java index 26eb12728..7517f4f4e 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java @@ -417,8 +417,9 @@ class HtmlDecorator { String adviceDoc = "" + - "
 Advised by:"; + " Advised by:"; + List addedNames = new ArrayList(); for (Iterator it = targets.iterator(); it.hasNext(); ) { String currHandle = (String)it.next(); IProgramElement currDecl = AsmManager.getDefault().getHierarchy().findElementForHandle(currHandle); @@ -436,11 +437,14 @@ class HtmlDecorator { hrefLink += currDecl.getParent().toLinkLabelString() + ".html" + "#" + currDecl.toLabelString(); - adviceDoc = adviceDoc + - "" - + hrefName.replace('/', '.') + ""; - - if (it.hasNext()) adviceDoc += ", "; + if (!addedNames.contains(hrefName)) { + adviceDoc = adviceDoc + + "" + + hrefName.replace('/', '.') + ""; + + if (it.hasNext()) adviceDoc += ", "; + addedNames.add(hrefName); + } } adviceDoc += "
\n"; fileContentsBuffer.insert( index, adviceDoc ); @@ -459,6 +463,7 @@ class HtmlDecorator { = "" + "
 Advises:"; + List addedNames = new ArrayList(); // for ensuring that we don't add duplciates for (Iterator it = targets.iterator(); it.hasNext(); ) { String currHandle = (String)it.next(); IProgramElement currDecl = AsmManager.getDefault().getHierarchy().findElementForHandle(currHandle); @@ -485,16 +490,13 @@ class HtmlDecorator { linkRef = currDecl.getParent().getParent().getName() + "." + linkRef; } } - entry += "" + linkName.replace('/', '.') + ""; // !!! 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 += "" + linkName.replace('/', '.') + ""; // !!! don't replace + if (it.hasNext()) entry += ", "; + addedNames.add(linkName); + } + } } entry += "
\n\n"; return entry; diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java index 0e8b3f06d..22d875ea5 100644 --- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java +++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java @@ -80,10 +80,12 @@ public class Main implements Config { public static void main(String[] args) { aborted = false; - + +// System.err.println("> command invoked: " + Arrays.asList(args).toString()); + // STEP 1: parse the command line and do other global setup sourcepath.addElement("."); // add the current directory to the classapth - parseCommandLine(args); + parseCommandLine(args); rootDir = getRootDir(); symbolManager = SymbolManager.getDefault(); File[] inputFiles = new File[filenames.size()]; @@ -361,6 +363,8 @@ public class Main implements Config { static void parseCommandLine(String[] args) { if (args.length == 0) { displayHelpAndExit( null ); + } else if (args.length == 1 && args[0].startsWith("@")) { + System.err.println("!!!!!!!!"); } List vargs = new LinkedList(Arrays.asList(args)); @@ -553,7 +557,7 @@ public class Main implements Config { else { // didn't find it on that element of the classpath but that's ok } - } + } } } } diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java index d4878e1d9..bf00ddd36 100644 --- a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java @@ -21,9 +21,9 @@ public class AjdocModuleTests { public static Test suite() { TestSuite suite = new TestSuite("Test for org.aspectj.tools.ajdoc"); //$JUnit-BEGIN$ - suite.addTestSuite(MainTestCase.class); - suite.addTestSuite(ExecutionTestCase.class); suite.addTestSuite(SpacewarTestCase.class); + suite.addTestSuite(ExecutionTestCase.class); + suite.addTestSuite(MainTestCase.class); // !!! must be last because it exists //$JUnit-END$ return suite; } -- 2.39.5