]> source.dussan.org Git - aspectj.git/commitdiff
more progress messages for ajde
authorjhugunin <jhugunin>
Thu, 1 May 2003 19:47:43 +0000 (19:47 +0000)
committerjhugunin <jhugunin>
Thu, 1 May 2003 19:47:43 +0000 (19:47 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java

index 79134851954c3e5242d32eb72ee2a7a0d336b74c..f38f4451d3658a93f883dacd4fd15542870b56f1 100644 (file)
@@ -257,6 +257,7 @@ public class AjBuildManager {
        public boolean weaveAndGenerateClassFiles() throws IOException {
                handler.handleMessage(MessageUtil.info("weaving"));
                if (progressListener != null) progressListener.setText("weaving aspects");
+               bcelWeaver.setProgressListener(progressListener, 0.5, 0.5/state.addedClassFiles.size());
                //!!! doesn't provide intermediate progress during weaving
                // XXX add all aspects even during incremental builds?
         addAspectClassFilesToWeaver(state.addedClassFiles);
@@ -402,6 +403,7 @@ public class AjBuildManager {
                                if (progressListener != null) {
                                        compiledCount++;
                                        progressListener.setProgress((compiledCount/2.0)/sourceFileCount);
+                                       progressListener.setText("compiled: " + new String(compilationResult.getFileName()));
                                }
                                
                                if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
index 56756a074d27dc452fc891b8ccd9640b1fe7775f..445ee75ec69b095947796c02c9c2d34f0d65b686 100644 (file)
@@ -20,6 +20,7 @@ import java.util.zip.*;
 import org.apache.bcel.classfile.ClassParser;
 import org.apache.bcel.classfile.JavaClass;
 import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IProgressListener;
 import org.aspectj.util.FileUtil;
 import org.aspectj.weaver.*;
 import org.aspectj.weaver.patterns.DeclareParents;
@@ -28,6 +29,9 @@ import org.aspectj.weaver.patterns.Pointcut;
 public class BcelWeaver implements IWeaver {
     private BcelWorld world;
     private CrosscuttingMembersSet xcutSet;
+    private IProgressListener progressListener = null;
+    private double progressMade;
+    private double progressPerClassFile;
 
     public BcelWeaver(BcelWorld world) {
         super();
@@ -328,10 +332,18 @@ public class BcelWeaver implements IWeaver {
 
        // non-private for testing
        LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType) throws IOException {
-               return weave(classFile, classType, true);
+               LazyClassGen ret = weave(classFile, classType, true);
+               
+               if (progressListener != null) {
+                       progressMade += progressPerClassFile;
+                       progressListener.setProgress(progressMade);
+                       progressListener.setText("woven: " + classFile.getFilename());
+               }
+               
+               return ret;
        }
        
-       private LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType, boolean dump) throws IOException {
+       private LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType, boolean dump) throws IOException {             
                if (classType.isSynthetic()) {
                        if (dump) dumpUnchanged(classFile);
                        return null;
@@ -430,4 +442,11 @@ public class BcelWeaver implements IWeaver {
                }
                return result;
        }
+
+       public void setProgressListener(IProgressListener listener, double previousProgress, double progressPerClassFile) {
+               progressListener = listener;
+               this.progressMade = previousProgress;
+               this.progressPerClassFile = progressPerClassFile;
+       }
+
 }