1 11 package org.eclipse.ui.internal.misc; 12 13 import org.eclipse.jface.resource.ImageDescriptor; 14 import org.eclipse.swt.graphics.Image; 15 import org.eclipse.swt.graphics.ImageData; 16 import org.eclipse.ui.ISharedImages; 17 import org.eclipse.ui.internal.WorkbenchImages; 18 19 22 public class ProgramImageDescriptor extends ImageDescriptor { 23 private String filename; 24 25 private int offset; 26 27 31 public ProgramImageDescriptor(String fullPath, int offsetInFile) { 32 filename = fullPath; 33 offset = offsetInFile; 34 } 35 36 39 public boolean equals(Object o) { 40 if (!(o instanceof ProgramImageDescriptor)) { 41 return false; 42 } 43 ProgramImageDescriptor other = (ProgramImageDescriptor) o; 44 return filename.equals(other.filename) && offset == other.offset; 45 } 46 47 51 public Image getImage() { 52 return createImage(); 53 } 54 55 59 public ImageData getImageData() { 60 62 63 return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE) 64 .getImageData(); 65 } 66 67 70 public int hashCode() { 71 return filename.hashCode() + offset; 72 } 73 } 74 | Popular Tags |