diff options
author | Darin Wright | 2002-05-26 18:56:28 +0000 |
---|---|---|
committer | Darin Wright | 2002-05-26 18:56:28 +0000 |
commit | a787cdee9f80855c45cd1809357fd0a0ad8a90a0 (patch) | |
tree | 154be5c99c6a5137b030a9716324230366e5c3e9 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabImageDescriptor.java | |
parent | 00bf1701d4558dd7404273dd1350c296ebb74a92 (diff) | |
download | eclipse.platform.debug-a787cdee9f80855c45cd1809357fd0a0ad8a90a0.tar.gz eclipse.platform.debug-a787cdee9f80855c45cd1809357fd0a0ad8a90a0.tar.xz eclipse.platform.debug-a787cdee9f80855c45cd1809357fd0a0ad8a90a0.zip |
bug 16378
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabImageDescriptor.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabImageDescriptor.java | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabImageDescriptor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabImageDescriptor.java new file mode 100644 index 000000000..d01ec08e9 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabImageDescriptor.java @@ -0,0 +1,117 @@ +package org.eclipse.debug.internal.ui.launchConfigurations; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.debug.internal.ui.DebugPluginImages; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.resource.CompositeImageDescriptor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.Point; + +/** + * A JDIImageDescriptor consists of a main icon and several adornments. The adornments + * are computed according to flags set on creation of the descriptor. + */ +public class LaunchConfigurationTabImageDescriptor extends CompositeImageDescriptor { + + /** Flag to render the error adornment */ + public final static int ERROR= 0x001; + + private Image fBaseImage; + private int fFlags; + private Point fSize; + + /** + * Create a new JDIImageDescriptor. + * + * @param baseImage an image descriptor used as the base image + * @param flags flags indicating which adornments are to be rendered + * + */ + public LaunchConfigurationTabImageDescriptor(Image baseImage, int flags) { + setBaseImage(baseImage); + setFlags(flags); + } + + /** + * @see CompositeImageDescriptor#getSize() + */ + protected Point getSize() { + if (fSize == null) { + ImageData data= getBaseImage().getImageData(); + setSize(new Point(data.width, data.height)); + } + return fSize; + } + + /** + * @see Object#equals(java.lang.Object) + */ + public boolean equals(Object object) { + if (!(object instanceof LaunchConfigurationTabImageDescriptor)){ + return false; + } + + LaunchConfigurationTabImageDescriptor other= (LaunchConfigurationTabImageDescriptor)object; + return (getBaseImage().equals(other.getBaseImage()) && getFlags() == other.getFlags()); + } + + /** + * @see Object#hashCode() + */ + public int hashCode() { + return getBaseImage().hashCode() | getFlags(); + } + + /** + * @see CompositeImageDescriptor#drawCompositeImage(int, int) + */ + protected void drawCompositeImage(int width, int height) { + ImageData bg= getBaseImage().getImageData(); + if (bg == null) { + bg= DEFAULT_IMAGE_DATA; + } + drawImage(bg, 0, 0); + drawOverlays(); + } + + /** + * Add any overlays to the image as specified in the flags. + */ + protected void drawOverlays() { + int flags= getFlags(); + int x= 0; + int y= 0; + ImageData data= null; + if ((flags & ERROR) != 0) { + data= DebugUITools.getImage(IDebugUIConstants.IMG_OVR_ERROR).getImageData(); + drawImage(data, 0, 0); + } + } + + protected Image getBaseImage() { + return fBaseImage; + } + + protected void setBaseImage(Image baseImage) { + fBaseImage = baseImage; + } + + protected int getFlags() { + return fFlags; + } + + protected void setFlags(int flags) { + fFlags = flags; + } + + protected void setSize(Point size) { + fSize = size; + } +}
\ No newline at end of file |