aboutsummaryrefslogtreecommitdiffstats
path: root/ajdoc/src
diff options
context:
space:
mode:
authoraclement <aclement>2006-01-13 14:44:59 +0000
committeraclement <aclement>2006-01-13 14:44:59 +0000
commitab2150f267eef2ec565cc596b2e0e0412a3bd290 (patch)
treea874b2b4467eb2bd38d58d21e48a329f33d19db3 /ajdoc/src
parenta9ef1b01b21e35c6fa43f24b095edf8bf36afe7c (diff)
downloadaspectj-ab2150f267eef2ec565cc596b2e0e0412a3bd290.tar.gz
aspectj-ab2150f267eef2ec565cc596b2e0e0412a3bd290.zip
ajdoc changes - moving to using a sandbox for testing, plus other bits and pieces - see pr121711 - from Helen.
Diffstat (limited to 'ajdoc/src')
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java55
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/Main.java39
2 files changed, 67 insertions, 27 deletions
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
index 4b8b679cf..db148e599 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
@@ -207,24 +207,36 @@ class HtmlDecorator {
else {
decorateMemberDocumentation(decl, fileContents, index);
}
- }
-
- // Change "Class" to "Aspect"
- // HACK: depends on matching presence of advice or pointcut summary
- int classStartIndex = fileContents.toString().indexOf("<BR>\nClass ");
- int pointcutSummaryIndex = fileContents.toString().indexOf(POINTCUT_SUMMARY);
- int adviceSummaryIndex = fileContents.toString().indexOf(ADVICE_SUMMARY);
- if (classStartIndex != -1 &&
- (adviceSummaryIndex != -1 || pointcutSummaryIndex != -1)) {
- int classEndIndex = fileContents.toString().indexOf("</H2>", classStartIndex);
- if (classStartIndex != -1 && classEndIndex != -1) {
- String classLine = fileContents.toString().substring(classStartIndex, classEndIndex);
- String aspectLine = "<BR>\n" + "Aspect " + classLine.substring(11, classLine.length());
- fileContents.delete(classStartIndex, classEndIndex);
- fileContents.insert(classStartIndex, aspectLine);
+ // Change "Class" to "Aspect"
+ // moved this here because then can use the IProgramElement.Kind
+ // rather than checking to see if there's advice - this fixes
+ // the case with an inner aspect not having the title "Aspect"
+ if(decl.getKind().equals(IProgramElement.Kind.ASPECT)
+ && file.getName().indexOf(decl.toSignatureString()) != -1) {
+ int classStartIndex = fileContents.toString().indexOf("<BR>\nClass ");
+ if (classStartIndex != -1) {
+ int classEndIndex = fileContents.toString().indexOf("</H2>", classStartIndex);
+ if (classStartIndex != -1 && classEndIndex != -1) {
+ String classLine = fileContents.toString().substring(classStartIndex, classEndIndex);
+ String aspectLine = "<BR>\n" + "Aspect " + classLine.substring(11, classLine.length());
+ fileContents.delete(classStartIndex, classEndIndex);
+ fileContents.insert(classStartIndex, aspectLine);
+ }
+ }
+ int secondClassStartIndex = fileContents.toString().indexOf("class <B>");
+ if (secondClassStartIndex != -1) {
+ String name = decl.toSignatureString();
+ int classEndIndex = fileContents.indexOf(name + "</B><DT>");
+ if (secondClassStartIndex != -1 && classEndIndex != -1) {
+ StringBuffer sb = new StringBuffer(fileContents.toString().
+ substring(secondClassStartIndex,classEndIndex));
+ sb.replace(0,5,"aspect");
+ fileContents.delete(secondClassStartIndex, classEndIndex);
+ fileContents.insert(secondClassStartIndex, sb.toString());
+ }
+ }
}
- }
-
+ }
file.delete();
FileOutputStream fos = new FileOutputStream( file );
fos.write( fileContents.toString().getBytes() );
@@ -460,9 +472,12 @@ class HtmlDecorator {
if (!decl.getKind().equals(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR)) {
entry += "&nbsp;&nbsp;";
}
- entry += generateSignatures(decl) +
- "<P>" +
- generateAffects(decl, true) +
+ // if we're not a declare statement then we need to generate the signature.
+ // If we did this for declare statements we get two repeated lines
+ if (!decl.getKind().isDeclare()) {
+ entry += generateSignatures(decl) + "<P>";
+ }
+ entry += generateAffects(decl, true) +
generateDetailsComment(decl);
}
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
index 6f7226966..e0000cb25 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
@@ -66,6 +66,10 @@ public class Main implements Config {
private static boolean deleteTempFilesOnExit = true;
private static boolean aborted = false;
+
+ // creating a local variable to enable us to create the ajdocworkingdir
+ // in a local sandbox during testing
+ private static String outputWorkingDir = Config.WORKING_DIR;
public static void clearState() {
symbolManager = null;
@@ -102,8 +106,8 @@ public class Main implements Config {
File[] signatureFiles = new File[filenames.size()];
try {
// create the workingdir if it doesn't exist
- if ( !(new File( Config.WORKING_DIR ).isDirectory()) ) {
- File dir = new File( Config.WORKING_DIR );
+ if ( !(new File( outputWorkingDir ).isDirectory()) ) {
+ File dir = new File( outputWorkingDir );
dir.mkdir();
if (deleteTempFilesOnExit) dir.deleteOnExit();
}
@@ -171,7 +175,7 @@ public class Main implements Config {
javadocargs = new String[numExtraArgs + options.size() + packageList.size() +
fileList.size() ];
javadocargs[0] = "-sourcepath";
- javadocargs[1] = Config.WORKING_DIR;
+ javadocargs[1] = outputWorkingDir;
int argIndex = 2;
if (authorStandardDocletSwitch) {
javadocargs[argIndex] = "-author";
@@ -321,7 +325,7 @@ public class Main implements Config {
String filename = "";
if ( packageName != null ) {
- String pathName = Config.WORKING_DIR + '/' + packageName.replace('.', '/');
+ String pathName = outputWorkingDir + '/' + packageName.replace('.', '/');
File packageDir = new File(pathName);
if ( !packageDir.exists() ) {
packageDir.mkdirs();
@@ -329,11 +333,11 @@ public class Main implements Config {
}
//verifyPackageDirExists(packageName, null);
packageName = packageName.replace( '.','/' ); // !!!
- filename = Config.WORKING_DIR + Config.DIR_SEP_CHAR + packageName +
+ filename = outputWorkingDir + Config.DIR_SEP_CHAR + packageName +
Config.DIR_SEP_CHAR + inputFile.getName();
}
else {
- filename = Config.WORKING_DIR + Config.DIR_SEP_CHAR + inputFile.getName();
+ filename = outputWorkingDir + Config.DIR_SEP_CHAR + inputFile.getName();
}
File signatureFile = new File( filename );
if (deleteTempFilesOnExit) signatureFile.deleteOnExit();
@@ -436,7 +440,7 @@ public class Main implements Config {
static String getSourcepathAsString() {
String cPath = "";
for (int i = 0; i < sourcepath.size(); i++) {
- cPath += (String)sourcepath.elementAt(i) + Config.DIR_SEP_CHAR + Config.WORKING_DIR;
+ cPath += (String)sourcepath.elementAt(i) + Config.DIR_SEP_CHAR + outputWorkingDir;
if (i != sourcepath.size()-1) {
cPath += File.pathSeparator;
}
@@ -731,6 +735,27 @@ public class Main implements Config {
public static boolean hasAborted() {
return aborted;
}
+
+ /**
+ * Sets the output working dir to be <fullyQualifiedOutputDir>\ajdocworkingdir
+ * Useful in testing to redirect the ajdocworkingdir to the sandbox
+ */
+ public static void setOutputWorkingDir(String fullyQulifiedOutputDir) {
+ if (fullyQulifiedOutputDir == null) {
+ resetOutputWorkingDir();
+ } else {
+ outputWorkingDir = fullyQulifiedOutputDir + File.separatorChar +
+ Config.WORKING_DIR;
+ }
+ }
+
+ /**
+ * Resets the output working dir to be the default which is
+ * <the current directory>\ajdocworkingdir
+ */
+ public static void resetOutputWorkingDir() {
+ outputWorkingDir = Config.WORKING_DIR;
+ }
}