1 11 package org.eclipse.debug.internal.ui; 12 13 14 import org.eclipse.debug.ui.DebugUITools; 15 import org.eclipse.debug.ui.IDebugUIConstants; 16 import org.eclipse.jface.resource.CompositeImageDescriptor; 17 import org.eclipse.swt.graphics.Image; 18 import org.eclipse.swt.graphics.ImageData; 19 import org.eclipse.swt.graphics.Point; 20 21 25 public class CompositeDebugImageDescriptor extends CompositeImageDescriptor { 26 27 28 public final static int SKIP_BREAKPOINT= 0x0001; 29 30 private Image fBaseImage; 31 private int fFlags; 32 private Point fSize; 33 34 41 public CompositeDebugImageDescriptor(Image baseImage, int flags) { 42 setBaseImage(baseImage); 43 setFlags(flags); 44 } 45 46 49 protected Point getSize() { 50 if (fSize == null) { 51 ImageData data= getBaseImage().getImageData(); 52 setSize(new Point(data.width, data.height)); 53 } 54 return fSize; 55 } 56 57 60 public boolean equals(Object object) { 61 if (!(object instanceof CompositeDebugImageDescriptor)){ 62 return false; 63 } 64 CompositeDebugImageDescriptor other= (CompositeDebugImageDescriptor)object; 65 return (getBaseImage().equals(other.getBaseImage()) && getFlags() == other.getFlags()); 66 } 67 68 71 public int hashCode() { 72 return getBaseImage().hashCode() | getFlags(); 73 } 74 75 78 protected void drawCompositeImage(int width, int height) { 79 ImageData bg= getBaseImage().getImageData(); 80 if (bg == null) { 81 bg= DEFAULT_IMAGE_DATA; 82 } 83 drawImage(bg, 0, 0); 84 drawOverlays(); 85 } 86 87 90 protected void drawOverlays() { 91 int flags= getFlags(); 92 int x= 0; 93 int y= 0; 94 ImageData data= null; 95 if ((flags & SKIP_BREAKPOINT) != 0) { 96 x= 0; 97 y= 0; 98 data= DebugUITools.getImage(IDebugUIConstants.IMG_OVR_SKIP_BREAKPOINT).getImageData(); 99 drawImage(data, x, y); 100 } 101 } 102 103 protected Image getBaseImage() { 104 return fBaseImage; 105 } 106 107 protected void setBaseImage(Image image) { 108 fBaseImage = image; 109 } 110 111 protected int getFlags() { 112 return fFlags; 113 } 114 115 protected void setFlags(int flags) { 116 fFlags = flags; 117 } 118 119 protected void setSize(Point size) { 120 fSize = size; 121 } 122 } 123 | Popular Tags |