felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r918046 - /felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/SigilProjectEditorPart.java
Date Tue, 02 Mar 2010 14:08:59 GMT
Author: dsavage
Date: Tue Mar  2 14:08:59 2010
New Revision: 918046

URL: http://svn.apache.org/viewvc?rev=918046&view=rev
Log:
fix for FELIX-2154 do not call dispose on shared image!
also fixed handling of project during edits related to change made in FELIX-2153

Modified:
    felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/SigilProjectEditorPart.java

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/SigilProjectEditorPart.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/SigilProjectEditorPart.java?rev=918046&r1=918045&r2=918046&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/SigilProjectEditorPart.java
(original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/SigilProjectEditorPart.java
Tue Mar  2 14:08:59 2010
@@ -66,7 +66,8 @@
 {
 
     private final Set<IModelElement> unresolvedElements = Collections.synchronizedSet(
new HashSet<IModelElement>() );
-    private ISigilProjectModel project;
+    private ISigilProjectModel projectx;
+    private ISigilProjectModel tempProject;
     private volatile boolean saving = false;
     private int dependenciesPageIndex;
 
@@ -94,34 +95,14 @@
             saving = true;
             new ProgressMonitorDialog( getSite().getShell() ).run( true, true, new IRunnableWithProgress()
             {
-                public void run( final IProgressMonitor monitor ) throws InvocationTargetException,
+                public void run( IProgressMonitor monitor ) throws InvocationTargetException,
                     InterruptedException
                 {
                     try
                     {
-                        if ( textPage.isDirty() )
-                        {
-                            SigilUI.runInUISync( new Runnable()
-                            {
-                                public void run()
-                                {
-                                    textPage.doSave( monitor );
-                                }
-                            } );
-                            project.setBundle( null );
-                            project.rebuildDependencies(monitor);
-                        }
-                        else if ( isDirty() )
-                        {
-                            commitPages( true );
-                            project.save( monitor );
-                            SigilUI.runInUISync( new Runnable()
-                            {
-                                public void run()
-                                {
-                                    editorDirtyStateChanged();
-                                }
-                            } );
+                        if ( doInternalSave(monitor) ) {
+                            projectx.setBundle( null );
+                            projectx.rebuildDependencies(monitor);                      
     
                         }
 
                         monitor.done();
@@ -135,7 +116,7 @@
         }
         catch ( InvocationTargetException e )
         {
-            SigilCore.error( "Failed to save " + project, e.getTargetException() );
+            SigilCore.error( "Failed to save " + projectx, e.getTargetException() );
         }
         catch ( InterruptedException e )
         {
@@ -150,6 +131,38 @@
     }
 
 
+    private boolean doInternalSave(final IProgressMonitor monitor) throws CoreException
+    {
+        if ( textPage.isDirty() )
+        {
+            SigilUI.runInUISync( new Runnable()
+            {
+                public void run()
+                {
+                    textPage.doSave( monitor );
+                }
+            } );
+            return true;
+        }
+        else if ( isDirty() )
+        {
+            commitPages( true );
+            tempProject.save( monitor );
+            SigilUI.runInUISync( new Runnable()
+            {
+                public void run()
+                {
+                    editorDirtyStateChanged();
+                }
+            } );
+            return true;
+        }
+        
+        // ok no changes
+        return false;
+    }
+
+
     /* (non-Javadoc)
      * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
      */
@@ -158,13 +171,13 @@
     {
         try
         {
-            addPage( new OverviewForm( this, project ) );
-            addPage( new ContentsForm( this, project ) );
-            dependenciesPageIndex = addPage( new DependenciesForm( this, project, unresolvedElements
) );
-            addPage( new ExportsForm( this, project ) );
-            textPage = new PropertiesForm( this, project );
+            addPage( new OverviewForm( this, tempProject ) );
+            addPage( new ContentsForm( this, tempProject ) );
+            dependenciesPageIndex = addPage( new DependenciesForm( this, tempProject, unresolvedElements
) );
+            addPage( new ExportsForm( this, tempProject ) );
+            textPage = new PropertiesForm( this, tempProject );
             addPage( textPage, getEditorInput() );
-            setPartName( project.getSymbolicName() );
+            setPartName( projectx.getSymbolicName() );
 
             refreshTabImages();
         }
@@ -212,9 +225,6 @@
     public void dispose()
     {
         ResourcesPlugin.getWorkspace().removeResourceChangeListener( this );
-        if ( errorImage != null ) {
-            errorImage.dispose();
-        }
         super.dispose();
     }
 
@@ -264,7 +274,7 @@
                                     {
                                         public void run()
                                         {
-                                            setPartName( project.getSymbolicName() );
+                                            setPartName( projectx.getSymbolicName() );
                                         }
                                     } );
                                     break;
@@ -309,7 +319,7 @@
                     }
                 }
                 firePropertyChange( IEditorPart.PROP_DIRTY );
-                setPartName( project.getSymbolicName() );
+                setPartName( projectx.getSymbolicName() );
                 refreshTabImages();
             }
         };
@@ -319,7 +329,7 @@
 
     protected void reload()
     {
-        project.setBundle( null );
+        projectx.setBundle( null );
         refreshAllPages();
     }
 
@@ -331,7 +341,8 @@
 
         try
         {
-            this.project = SigilCore.create( getProject() );
+            this.projectx = SigilCore.create( getProject() );
+            this.tempProject = (ISigilProjectModel) projectx.clone();
         }
         catch ( CoreException e )
         {



Mime
View raw message