Improved preference handling in plugin.core
[Mograsim.git] / plugins / net.mograsim.plugin.core / src / net / mograsim / plugin / MograsimActivator.java
index c17f530..2d8e8e6 100644 (file)
@@ -6,9 +6,20 @@ import net.mograsim.machine.MachineRegistry;
 
 public final class MograsimActivator extends AbstractUIPlugin
 {
+       private static MograsimActivator instance;
 
        public MograsimActivator()
        {
+               if (instance != null)
+                       throw new IllegalStateException("MograsimActivator already created!");
+               instance = this;
                MachineRegistry.reload();
        }
-}
+
+       public static MograsimActivator instance()
+       {
+               if (instance == null)
+                       throw new IllegalStateException("MograsimActivator not yet created!");
+               return instance;
+       }
+}
\ No newline at end of file