]> source.dussan.org Git - aspectj.git/commitdiff
Refactored singleton reference to be accessed via getDefault() in order to be consist...
authormkersten <mkersten>
Fri, 25 Jul 2003 15:13:55 +0000 (15:13 +0000)
committermkersten <mkersten>
Fri, 25 Jul 2003 15:13:55 +0000 (15:13 +0000)
asm/src/org/aspectj/asm/StructureModelManager.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EmacsStructureModelManager.java
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java

index 1dbf2981dd9deeddd52475f188c716e7cb0973d5..59f32b98d35fccf83f9c219d72ca16cfdd776fdc 100644 (file)
@@ -27,7 +27,7 @@ public class StructureModelManager {
        /**
         * Singleton instance.
         */
-       public static StructureModelManager INSTANCE = new StructureModelManager();
+       private static StructureModelManager INSTANCE = new StructureModelManager();
        private boolean shouldSaveModel = true;
     protected StructureModel model = new StructureModel();
     private List structureListeners = new ArrayList();
@@ -165,5 +165,9 @@ public class StructureModelManager {
        public void setShouldSaveModel(boolean shouldSaveModel) {
                this.shouldSaveModel = shouldSaveModel;
        }
+
+       public static StructureModelManager getDefault() {
+               return INSTANCE;
+       }
 }
 
index 973be83e1b09e1b3fdd22c6d7ba60a4e6b7d6471..436fda9d0bf206909986e1e17b4f3b5d46dc6473 100644 (file)
@@ -127,7 +127,7 @@ public class AjBuildManager {
             if (batch) {
                 // System.err.println("XXXX batch: " + buildConfig.getFiles());
                 if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {  
-                    bcelWorld.setModel(StructureModelManager.INSTANCE.getStructureModel());
+                    bcelWorld.setModel(StructureModelManager.getDefault().getStructureModel());
                     // in incremental build, only get updated model?
                 }
                 performCompilation(buildConfig.getFiles());
@@ -166,7 +166,7 @@ public class AjBuildManager {
             // but always returns true
             // XXX weaved not in Mik's incremental
             if (buildConfig.isGenerateModelMode()) {
-                StructureModelManager.INSTANCE.fireModelUpdated();  
+                StructureModelManager.getDefault().fireModelUpdated();  
             }
             return !handler.hasErrors();
         } finally {
@@ -176,7 +176,7 @@ public class AjBuildManager {
      
     private void setupModel() {
         String rootLabel = "<root>";
-        StructureModel model = StructureModelManager.INSTANCE.getStructureModel();
+        StructureModel model = StructureModelManager.getDefault().getStructureModel();
         ProgramElementNode.Kind kind = ProgramElementNode.Kind.FILE_JAVA;
         if (buildConfig.getConfigFile() != null) {
             rootLabel = buildConfig.getConfigFile().getName();
index 1b62830861a8150d5cf2f34c2b3ae06f9a9d3572..8f662e160b9a3b089ca4320ec5ffa13dcc9ea09f 100644 (file)
@@ -42,11 +42,11 @@ public class EmacsStructureModelManager {
     }
 
     public void externalizeModel() {
-       if (!StructureModelManager.INSTANCE.getStructureModel().isValid()) return;
+       if (!StructureModelManager.getDefault().getStructureModel().isValid()) return;
         
         try {
             //Set fileSet = StructureModelManager.INSTANCE.getStructureModel().getFileMap().entrySet(); 
-                       Set fileSet = StructureModelManager.INSTANCE.getStructureModel().getFileMapEntrySet(); 
+                       Set fileSet = StructureModelManager.getDefault().getStructureModel().getFileMapEntrySet(); 
             for (Iterator it = fileSet.iterator(); it.hasNext(); ) {
                 ProgramElementNode peNode = (ProgramElementNode)((Map.Entry)it.next()).getValue();
                 dumpStructureToFile(peNode);
index 9f65892a524e863723db3266e985c89b95a7c035..4a2fa756710ab048ed342fc74a6d6ba605495fd9 100644 (file)
@@ -73,7 +73,7 @@ public class AjBuildManagerTest extends TestCase {
                                 }, messageWriter);
         String err = parser.getOtherMessages(true);            
         assertTrue(err, null == err);
-        manager.setStructureModel(StructureModelManager.INSTANCE.getStructureModel());
+        manager.setStructureModel(StructureModelManager.getDefault().getStructureModel());
                MessageHandler handler = new MessageHandler();
         manager.batchBuild(buildConfig, handler);
         assertCompileMessagesValid(handler);