Make sigil projects singletons within IDE to fix problems with inconsistent views (FELIX-2153)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@917989 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java
index 108c111..2a8bc75 100644
--- a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java
+++ b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/SigilCore.java
@@ -241,11 +241,21 @@
     }
 
 
+    private static HashMap<IProject, SigilProject> projects = new HashMap<IProject, SigilProject>();
+    
     public static ISigilProjectModel create( IProject project ) throws CoreException
     {
         if ( project.hasNature( NATURE_ID ) )
         {
-            return new SigilProject( project );
+            SigilProject p = null;
+            synchronized( projects ) {
+                p = projects.get(project);
+                if ( p == null ) {
+                   p = new SigilProject( project );
+                   projects.put(project, p);
+                }
+            }
+            return p; 
         }
         else
         {
@@ -692,5 +702,4 @@
             }
         }
     }
-
 }