Importing the XDebugProxy code in the HEAD. The repo was tagged with T_BEFORE_XDEBUGP...
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.ui / src / net / sourceforge / phpeclipse / xdebug / ui / php / launching / PHPDebugModelPresentation.java
index 858937f..567771e 100644 (file)
@@ -2,6 +2,8 @@ package net.sourceforge.phpeclipse.xdebug.ui.php.launching;
 
 
 
+import java.io.File;
+
 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugLineBreakpoint;
 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugStackFrame;
 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget;
@@ -11,21 +13,75 @@ import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.PlatformObject;
 import org.eclipse.debug.core.model.ILineBreakpoint;
 import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
 import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.debug.ui.IDebugModelPresentation;
 import org.eclipse.debug.ui.IDebugUIConstants;
 import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.ILabelProviderListener;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.IEditorDescriptor;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IStorageEditorInput;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.FileEditorInput;
 
 public class PHPDebugModelPresentation implements IDebugModelPresentation {
+       
+    class StorageEditorInput extends PlatformObject implements
+                       IStorageEditorInput {
+               private File fFile;
+
+               private IStorage fStorage;
+
+               public StorageEditorInput(IStorage storage, File file) {
+                       super();
+                       fStorage = storage;
+                       fFile = file;
+               }
+
+               public IStorage getStorage() {
+                       return fStorage;
+               }
+
+               public ImageDescriptor getImageDescriptor() {
+                       return null;
+               }
+
+               public String getName() {
+                       return getStorage().getName();
+               }
+
+               public IPersistableElement getPersistable() {
+                       return null;
+               }
+
+               public String getToolTipText() {
+                       return getStorage().getFullPath().toOSString();
+               }
+
+               public boolean equals(Object object) {
+                       return object instanceof StorageEditorInput
+                                       && getStorage().equals(
+                                                       ((StorageEditorInput) object).getStorage());
+               }
+
+               public int hashCode() {
+                       return getStorage().hashCode();
+               }
+
+               public boolean exists() {
+                       return fFile.exists();
+               }
+       }
+
 
        public void setAttribute(String attribute, Object value) {
                // TODO Auto-generated method stub
@@ -103,6 +159,10 @@ public class PHPDebugModelPresentation implements IDebugModelPresentation {
                if (element instanceof IFile) {
                        return new FileEditorInput((IFile)element);
                }
+               if( element instanceof LocalFileStorage) {
+                       LocalFileStorage lfc= (LocalFileStorage)element;
+                       return new StorageEditorInput(lfc,lfc.getFile());
+               }
                if (element instanceof ILineBreakpoint) {
                        return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource());
                }