1 package net.sourceforge.phpeclipse.xdebug.ui.php.launching;
5 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugLineBreakpoint;
6 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugStackFrame;
7 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget;
8 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugThread;
9 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugValue;
10 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable;
12 import org.eclipse.core.resources.IFile;
13 import org.eclipse.core.resources.IMarker;
14 import org.eclipse.debug.core.model.ILineBreakpoint;
15 import org.eclipse.debug.core.model.IValue;
16 import org.eclipse.debug.ui.DebugUITools;
17 import org.eclipse.debug.ui.IDebugModelPresentation;
18 import org.eclipse.debug.ui.IDebugUIConstants;
19 import org.eclipse.debug.ui.IValueDetailListener;
20 import org.eclipse.jface.viewers.ILabelProviderListener;
21 import org.eclipse.swt.graphics.Image;
22 import org.eclipse.ui.IEditorDescriptor;
23 import org.eclipse.ui.IEditorInput;
24 import org.eclipse.ui.IEditorRegistry;
25 import org.eclipse.ui.PlatformUI;
26 import org.eclipse.ui.part.FileEditorInput;
28 public class PHPDebugModelPresentation implements IDebugModelPresentation {
30 public void setAttribute(String attribute, Object value) {
31 // TODO Auto-generated method stub
36 * @see IDebugModelPresentation#getImage(Object)
38 public Image getImage(Object element) {
39 if (element instanceof XDebugLineBreakpoint) {
40 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
41 } else if (element instanceof IMarker) {
42 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
43 } else if (element instanceof XDebugStackFrame || element instanceof XDebugThread || element instanceof XDebugTarget) {
45 } else if (element instanceof XDebugVariable) {
46 return getVariableImage((XDebugVariable)element);
47 } else if (element instanceof XDebugValue) {
48 return getValueImage((XDebugValue)element);
50 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
52 private Image getVariableImage(XDebugVariable phpVar) {
53 /* if (phpVar != null) {
55 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
56 if (phpVar.isHashValue())
57 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
60 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
63 private Image getValueImage(XDebugValue phpVar) {
65 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
67 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
71 public String getText(Object element) {
72 // TODO Auto-generated method stub
76 public void computeDetail(IValue value, IValueDetailListener listener) {
77 // TODO Auto-generated method stub
81 public void addListener(ILabelProviderListener listener) {
82 // TODO Auto-generated method stub
86 public void dispose() {
87 // TODO Auto-generated method stub
91 public boolean isLabelProperty(Object element, String property) {
92 // TODO Auto-generated method stub
96 public void removeListener(ILabelProviderListener listener) {
97 // TODO Auto-generated method stub
101 public IEditorInput getEditorInput(Object element) {
103 if (element instanceof IFile) {
104 return new FileEditorInput((IFile)element);
106 if (element instanceof ILineBreakpoint) {
107 return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource());
112 public String getEditorId(IEditorInput input, Object element) {
113 IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry();
114 IEditorDescriptor descriptor= registry.getDefaultEditor(input.getName());
115 if (descriptor != null)
116 return descriptor.getId();