]> source.dussan.org Git - aspectj.git/commitdiff
Improved link layout and removed generation of duplicates.
authormkersten <mkersten>
Tue, 30 Mar 2004 17:14:39 +0000 (17:14 +0000)
committermkersten <mkersten>
Tue, 30 Mar 2004 17:14:39 +0000 (17:14 +0000)
ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
ajdoc/src/org/aspectj/tools/ajdoc/Main.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java

index 26eb127289900bd7288f4fa6cbf6d016ff180408..7517f4f4e00da262798f116084f07366b5b220ea 100644 (file)
@@ -417,8 +417,9 @@ class HtmlDecorator {
             
             String adviceDoc
             = "<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(); ) {
                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 +
-                        "<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";
             fileContentsBuffer.insert( index, adviceDoc );
@@ -459,6 +463,7 @@ class HtmlDecorator {
         = "<TABLE WIDTH=\"100%\" BGCOLOR=#FFFFFF><TR>" +
           "<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(); ) {
                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 += "<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";
         return entry;
index 0e8b3f06dc7ca11cdeaf7691fd1c5754b11d7bcd..22d875ea5e774fd1af1ddd9bcb20ad3439832237 100644 (file)
@@ -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
                       }
-                    }
+                    }  
                 }
             }
         }
index d4878e1d9b6f940bef74d064256d25f43c1393f7..bf00ddd369a2d7d2366c921cf4349f1a0cc476d4 100644 (file)
@@ -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;
        }