1 11 12 package org.eclipse.jdt.internal.ui.javaeditor; 13 14 import org.eclipse.swt.graphics.Image; 15 16 import org.eclipse.jface.resource.ImageDescriptor; 17 18 import org.eclipse.jface.text.source.Annotation; 19 20 import org.eclipse.ui.texteditor.IAnnotationImageProvider; 21 22 import org.eclipse.jdt.internal.ui.JavaPluginImages; 23 24 29 public class OverrideIndicatorImageProvider implements IAnnotationImageProvider { 30 31 34 private static final String OVERRIDE_IMG_DESC_ID= "JavaPluginImages.DESC_OBJ_OVERRIDES"; private static final String OVERWRITE_IMG_DESC_ID= "JavaPluginImages.DESC_OBJ_IMPLEMENTS"; public Image getManagedImage(Annotation annotation) { 37 return null; 38 } 39 40 43 public String getImageDescriptorId(Annotation annotation) { 44 if (!isImageProviderFor(annotation)) 45 return null; 46 47 if (isOverwriting(annotation)) 48 return OVERWRITE_IMG_DESC_ID; 49 else 50 return OVERRIDE_IMG_DESC_ID; 51 } 52 53 56 public ImageDescriptor getImageDescriptor(String imageDescritporId) { 57 if (OVERWRITE_IMG_DESC_ID.equals(imageDescritporId)) 58 return JavaPluginImages.DESC_OBJ_IMPLEMENTS; 59 else if (OVERRIDE_IMG_DESC_ID.equals(imageDescritporId)) 60 return JavaPluginImages.DESC_OBJ_OVERRIDES; 61 62 return null; 63 } 64 65 private boolean isImageProviderFor(Annotation annotation) { 66 return annotation != null && OverrideIndicatorManager.ANNOTATION_TYPE.equals(annotation.getType()); 67 } 68 69 private boolean isOverwriting(Annotation annotation) { 70 return ((OverrideIndicatorManager.OverrideIndicator)annotation).isOverwriteIndicator(); 71 } 72 } 73 | Popular Tags |