run project setup outside of synchronized block to avoid potential deadlock


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@927834 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
index 2dbe8de..602e5a9 100644
--- a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
+++ b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
@@ -392,11 +392,13 @@
     {
         ISigilBundle b = null;
         
-        synchronized ( bldProjectFile )
+        try
         {
-            if ( bundle == null )
+            boolean newProject = false;
+            
+            synchronized ( bldProjectFile )
             {
-                try
+                if ( bundle == null )
                 {
                     if ( bldProjectFile.getLocation().toFile().exists() )
                     {
@@ -405,18 +407,22 @@
                     else
                     {
                         bundle = setupDefaults();
-                        NullProgressMonitor npm = new NullProgressMonitor();
-                        bldProjectFile.create( buildContents(), true /* force */, npm );
-                        project.refreshLocal( IResource.DEPTH_INFINITE, npm );
+                        newProject = true;
                     }
                 }
-                catch ( CoreException e )
-                {
-                    SigilCore.error( "Failed to build bundle", e );
-                }
+
+                b = bundle;
             }
-            
-            b = bundle;
+
+            if ( newProject ) {
+                NullProgressMonitor npm = new NullProgressMonitor();
+                bldProjectFile.create( buildContents(), true /* force */, npm );
+                project.refreshLocal( IResource.DEPTH_ONE, npm );
+            }
+        }
+        catch ( CoreException e )
+        {
+            SigilCore.error( "Failed to build bundle", e );
         }
         
         return b;
@@ -633,10 +639,6 @@
 
     private ISigilBundle parseContents( IFile projectFile ) throws CoreException
     {
-        /*if ( !projectFile.isSynchronized(IResource.DEPTH_ONE) ) {
-        	projectFile.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
-        }*/
-
         if ( projectFile.getName().equals( SigilCore.SIGIL_PROJECT_FILE ) )
         {
             return parseBldContents( projectFile.getLocationURI() );