Very ugly start of a first wizard page. Needs a lot of cleanup!
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.ui / src / net / sourceforge / phpeclipse / xdebug / ui / XDebugModelPresentation.java
1 /*
2  * Created on 25.11.2004
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */
7 package net.sourceforge.phpeclipse.xdebug.ui;
8
9 import org.eclipse.core.resources.IFile;
10 import org.eclipse.debug.core.DebugException;
11 import org.eclipse.debug.core.model.ILineBreakpoint;
12 import org.eclipse.debug.core.model.IValue;
13 import org.eclipse.debug.ui.IDebugModelPresentation;
14 import org.eclipse.debug.ui.IValueDetailListener;
15 import org.eclipse.jface.viewers.LabelProvider;
16 import org.eclipse.swt.graphics.Image;
17 import org.eclipse.ui.IEditorInput;
18 import org.eclipse.ui.part.FileEditorInput;
19
20 /**
21  * @author Axel
22  *
23  * TODO To change the template for this generated type comment go to
24  * Window - Preferences - Java - Code Style - Code Templates
25  */
26 public class XDebugModelPresentation  extends LabelProvider implements IDebugModelPresentation {
27         /* (non-Javadoc)
28          * @see org.eclipse.debug.ui.IDebugModelPresentation#setAttribute(java.lang.String, java.lang.Object)
29          */
30         public void setAttribute(String attribute, Object value) {
31         }
32         /* (non-Javadoc)
33          * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
34          */
35         public Image getImage(Object element) {
36                 return null;
37         }
38         /* (non-Javadoc)
39          * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
40          */
41         public String getText(Object element) {
42                 return null;
43         }
44         /* (non-Javadoc)
45          * @see org.eclipse.debug.ui.IDebugModelPresentation#computeDetail(org.eclipse.debug.core.model.IValue, org.eclipse.debug.ui.IValueDetailListener)
46          */
47         public void computeDetail(IValue value, IValueDetailListener listener) {
48                 String detail = "";
49                 try {
50                         detail = value.getValueString();
51                 } catch (DebugException e) {
52                 }
53                 listener.detailComputed(value, detail);
54         }
55         /* (non-Javadoc)
56          * @see org.eclipse.debug.ui.ISourcePresentation#getEditorInput(java.lang.Object)
57          */
58         public IEditorInput getEditorInput(Object element) {
59                 if (element instanceof IFile) {
60                         return new FileEditorInput((IFile)element);
61                 }
62                 if (element instanceof ILineBreakpoint) {
63                         return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource());
64                 }
65                 return null;
66         }
67         /* (non-Javadoc)
68          * @see org.eclipse.debug.ui.ISourcePresentation#getEditorId(org.eclipse.ui.IEditorInput, java.lang.Object)
69          */
70         public String getEditorId(IEditorInput input, Object element) {
71                 if (element instanceof IFile || element instanceof ILineBreakpoint) {
72                         return "org.eclipse.ui.DefaultTextEditor";
73                 }
74                 return null;
75         }
76 }