1 package net.sourceforge.phpeclipse.xdebug.ui.php.launching;
3 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugLineBreakpoint;
4 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugStackFrame;
5 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget;
6 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugThread;
7 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugValue;
8 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable;
10 import org.eclipse.core.resources.IFile;
11 import org.eclipse.core.resources.IMarker;
12 import org.eclipse.debug.core.model.ILineBreakpoint;
13 import org.eclipse.debug.core.model.IValue;
14 import org.eclipse.debug.ui.DebugUITools;
15 import org.eclipse.debug.ui.IDebugModelPresentation;
16 import org.eclipse.debug.ui.IDebugUIConstants;
17 import org.eclipse.debug.ui.IValueDetailListener;
18 import org.eclipse.jface.viewers.ILabelProviderListener;
19 import org.eclipse.swt.graphics.Image;
20 import org.eclipse.ui.IEditorDescriptor;
21 import org.eclipse.ui.IEditorInput;
22 import org.eclipse.ui.IEditorRegistry;
23 import org.eclipse.ui.PlatformUI;
24 import org.eclipse.ui.part.FileEditorInput;
26 public class PHPDebugModelPresentation implements IDebugModelPresentation {
28 public void setAttribute(String attribute, Object value) {
29 // TODO Auto-generated method stub
34 * @see IDebugModelPresentation#getImage(Object)
36 public Image getImage(Object element) {
37 if (element instanceof XDebugLineBreakpoint) {
38 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
39 } else if (element instanceof IMarker) {
40 return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
41 } else if (element instanceof XDebugStackFrame
42 || element instanceof XDebugThread
43 || 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);
53 private Image getVariableImage(XDebugVariable phpVar) {
55 * if (phpVar != null) { if (phpVar.isLocal()) return
56 * DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); if
57 * (phpVar.isHashValue()) return
58 * 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);
70 public String getText(Object element) {
71 // TODO Auto-generated method stub
75 public void computeDetail(IValue value, IValueDetailListener listener) {
76 // TODO Auto-generated method stub
80 public void addListener(ILabelProviderListener listener) {
81 // TODO Auto-generated method stub
85 public void dispose() {
86 // TODO Auto-generated method stub
90 public boolean isLabelProperty(Object element, String property) {
91 // TODO Auto-generated method stub
95 public void removeListener(ILabelProviderListener listener) {
96 // TODO Auto-generated method stub
100 public IEditorInput getEditorInput(Object element) {
102 if (element instanceof IFile) {
103 return new FileEditorInput((IFile) element);
105 if (element instanceof ILineBreakpoint) {
106 return new FileEditorInput((IFile) ((ILineBreakpoint) element)
107 .getMarker().getResource());
112 public String getEditorId(IEditorInput input, Object element) {
113 IEditorRegistry registry = PlatformUI.getWorkbench()
114 .getEditorRegistry();
115 IEditorDescriptor descriptor = registry.getDefaultEditor(input
117 if (descriptor != null)
118 return descriptor.getId();