added h4 (====) gheader template
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / BreakpointImageProvider.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpeclipse.phpeditor;
12
13 import org.eclipse.core.resources.IMarker;
14 import org.eclipse.debug.ui.DebugUITools;
15 import org.eclipse.debug.ui.IDebugModelPresentation;
16 import org.eclipse.jface.resource.ImageDescriptor;
17 import org.eclipse.jface.text.source.Annotation;
18 import org.eclipse.swt.graphics.Image;
19 import org.eclipse.ui.texteditor.IAnnotationImageProvider;
20 import org.eclipse.ui.texteditor.MarkerAnnotation;
21
22 /**
23  * BreakpointImageProvider
24  * @since 3.0
25  */
26 public class BreakpointImageProvider implements IAnnotationImageProvider {
27         
28         private IDebugModelPresentation fPresentation;
29
30         /*
31          * @see org.eclipse.jface.text.source.IAnnotationImageProvider#getManagedImage(org.eclipse.jface.text.source.Annotation)
32          */
33         public Image getManagedImage(Annotation annotation) {
34                 if (annotation instanceof MarkerAnnotation) {
35                         MarkerAnnotation markerAnnotation= (MarkerAnnotation) annotation;
36                         IMarker marker= markerAnnotation.getMarker();
37                         if (marker != null && marker.exists())
38                                 return getPresentation().getImage(marker);
39                 }
40                 
41                 return null;
42         }
43
44         /*
45          * @see org.eclipse.jface.text.source.IAnnotationImageProvider#getImageDescriptorId(org.eclipse.jface.text.source.Annotation)
46          */
47         public String getImageDescriptorId(Annotation annotation) {
48                 return null;
49         }
50
51         /*
52          * @see org.eclipse.jface.text.source.IAnnotationImageProvider#getImageDescriptor(java.lang.String)
53          */
54         public ImageDescriptor getImageDescriptor(String imageDescritporId) {
55                 return null;
56         }
57         
58         private IDebugModelPresentation getPresentation() {
59                 if (fPresentation == null) 
60                         fPresentation= DebugUITools.newDebugModelPresentation();
61                 return fPresentation;
62         }
63 }