Debug session thread and socket leak fixed:
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / WorkingCopyManager.java
index 38fc5c0..ca09dc9 100644 (file)
@@ -15,17 +15,15 @@ package net.sourceforge.phpeclipse.phpeditor;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.text.Assert;
-
-import org.eclipse.ui.IEditorInput;
-
 import net.sourceforge.phpdt.core.ICompilationUnit;
-
 import net.sourceforge.phpdt.ui.IWorkingCopyManager;
 import net.sourceforge.phpdt.ui.IWorkingCopyManagerExtension;
 
+import org.eclipse.core.runtime.CoreException;
+import net.sourceforge.phpeclipse.phpeditor.ICompilationUnitDocumentProvider;
+import org.eclipse.jface.text.Assert;
+import org.eclipse.ui.IEditorInput;
+
 
 /**
  * This working copy manager works together with a given compilation unit document provider and
@@ -33,7 +31,7 @@ import net.sourceforge.phpdt.ui.IWorkingCopyManagerExtension;
  */
 public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension {
        
-       private PHPDocumentProvider fDocumentProvider;
+       private ICompilationUnitDocumentProvider fDocumentProvider;
        private Map fMap;
        private boolean fIsShuttingDown;
 
@@ -43,27 +41,27 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
         * 
         * @param provider the provider
         */
-       public WorkingCopyManager(PHPDocumentProvider provider) {
+       public WorkingCopyManager(ICompilationUnitDocumentProvider provider) {
                Assert.isNotNull(provider);
                fDocumentProvider= provider;
        }
 
        /*
-        * @see org.eclipse.jdt.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput)
+        * @see net.sourceforge.phpdt.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput)
         */
        public void connect(IEditorInput input) throws CoreException {
                fDocumentProvider.connect(input);
        }
        
        /*
-        * @see org.eclipse.jdt.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput)
+        * @see net.sourceforge.phpdt.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput)
         */
        public void disconnect(IEditorInput input) {
                fDocumentProvider.disconnect(input);
        }
        
        /*
-        * @see org.eclipse.jdt.ui.IWorkingCopyManager#shutdown()
+        * @see net.sourceforge.phpdt.ui.IWorkingCopyManager#shutdown()
         */
        public void shutdown() {
                if (!fIsShuttingDown) {
@@ -81,7 +79,7 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
        }
 
        /*
-        * @see org.eclipse.jdt.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput)
+        * @see net.sourceforge.phpdt.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput)
         */
        public ICompilationUnit getWorkingCopy(IEditorInput input) {
                ICompilationUnit unit= fMap == null ? null : (ICompilationUnit) fMap.get(input);
@@ -89,18 +87,17 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
        }
        
        /*
-        * @see org.eclipse.jdt.internal.ui.javaeditor.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.jdt.core.ICompilationUnit)
+        * @see net.sourceforge.phpdt.internal.ui.javaeditor.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, net.sourceforge.phpdt.core.ICompilationUnit)
         */
        public void setWorkingCopy(IEditorInput input, ICompilationUnit workingCopy) {
-               if (fDocumentProvider.isConnected(input)) {
+               if (fDocumentProvider.getDocument(input) != null) {
                        if (fMap == null)
                                fMap= new HashMap();
                        fMap.put(input, workingCopy);
                }
        }
-       
        /*
-        * @see org.eclipse.jdt.internal.ui.javaeditor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput)
+        * @see net.sourceforge.phpdt.internal.ui.javaeditor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput)
         */
        public void removeWorkingCopy(IEditorInput input) {
                fMap.remove(input);