From 1bc386f02ca225048d9efb855ef8473bad74f72a Mon Sep 17 00:00:00 2001 From: incastrix Date: Mon, 11 Feb 2008 18:03:01 +0000 Subject: [PATCH] Fix source not showed (Ticket #654). --- .../launching/CopyOfPHPDebugModelPresentation.java | 181 -------------------- .../php/launching/PHPDebugModelPresentation.java | 73 ++++++++- 2 files changed, 72 insertions(+), 182 deletions(-) delete mode 100644 net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/CopyOfPHPDebugModelPresentation.java diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/CopyOfPHPDebugModelPresentation.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/CopyOfPHPDebugModelPresentation.java deleted file mode 100644 index dedaaad..0000000 --- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/CopyOfPHPDebugModelPresentation.java +++ /dev/null @@ -1,181 +0,0 @@ -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; -import net.sourceforge.phpeclipse.xdebug.php.model.XDebugThread; -import net.sourceforge.phpeclipse.xdebug.php.model.XDebugValue; -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 CopyOfPHPDebugModelPresentation 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 - - } - - /** - * @see IDebugModelPresentation#getImage(Object) - */ - public Image getImage(Object element) { - if (element instanceof XDebugLineBreakpoint) { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); - } else if (element instanceof IMarker) { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); - } else if (element instanceof XDebugStackFrame || element instanceof XDebugThread || element instanceof XDebugTarget) { - return null; - } else if (element instanceof XDebugVariable) { - return getVariableImage((XDebugVariable)element); - } else if (element instanceof XDebugValue) { - return getValueImage((XDebugValue)element); - } - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT); - } - private Image getVariableImage(XDebugVariable phpVar) { - /* if (phpVar != null) { - if (phpVar.isLocal()) - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); - if (phpVar.isHashValue()) - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); - } - */ - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); - } - - private Image getValueImage(XDebugValue phpVar) { - if (phpVar != null) { - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); - } - return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); - } - - - public String getText(Object element) { - // TODO Auto-generated method stub - return null; - } - - public void computeDetail(IValue value, IValueDetailListener listener) { - // TODO Auto-generated method stub - - } - - public void addListener(ILabelProviderListener listener) { - // TODO Auto-generated method stub - - } - - public void dispose() { - // TODO Auto-generated method stub - - } - - public boolean isLabelProperty(Object element, String property) { - // TODO Auto-generated method stub - return false; - } - - public void removeListener(ILabelProviderListener listener) { - // TODO Auto-generated method stub - - } - - public IEditorInput getEditorInput(Object element) { - - 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()); - } - return null; - } - - public String getEditorId(IEditorInput input, Object element) { - IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry(); - IEditorDescriptor descriptor= registry.getDefaultEditor(input.getName()); - if (descriptor != null) - return descriptor.getId(); - - return null; - } - -} diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java index 6a1dfbb..2aea900 100644 --- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java +++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java @@ -11,6 +11,7 @@ **********************************************************************/ package net.sourceforge.phpeclipse.xdebug.ui.php.launching; +import java.io.File; import java.util.HashMap; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugLineBreakpoint; @@ -21,6 +22,7 @@ import net.sourceforge.phpeclipse.xdebug.php.model.XDebugStackFrame; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugValue; import net.sourceforge.phpeclipse.xdebug.ui.XDebugUIPlugin; +import net.sourceforge.phpeclipse.xdebug.ui.php.launching.CopyOfPHPDebugModelPresentation.StorageEditorInput; //import net.sourceforge.phpdt.internal.debug.core.model.IPHPDebugTarget; @@ -30,19 +32,26 @@ import net.sourceforge.phpeclipse.xdebug.ui.XDebugUIPlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IStorage; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.PlatformObject; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.IBreakpoint; +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.LabelProvider; 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; @@ -85,7 +94,7 @@ public class PHPDebugModelPresentation extends LabelProvider implements /** * @see IDebugModelPresentation#getEditorInput(Object) */ - public IEditorInput getEditorInput(Object item) { + public IEditorInput getEditorInputA(Object item) { if (item instanceof XDebugLineBreakpoint) { IBreakpoint bp = (IBreakpoint) item; @@ -103,6 +112,21 @@ public class PHPDebugModelPresentation extends LabelProvider implements return null; } + public IEditorInput getEditorInput(Object element) { + + 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()); + } + return null; + } + /** * @see IDebugModelPresentation#getImage(Object) */ @@ -236,4 +260,51 @@ public class PHPDebugModelPresentation extends LabelProvider implements } return image; } + + 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(); +} +} } \ No newline at end of file -- 1.7.1