/** Add any overlays to the image as specified in the flags. */
 protected void drawOverlays() {
   int flags = getFlags();
   ImageData data = null;
   if ((flags & ERROR) != 0) {
     data = DebugUITools.getImage(IDebugUIConstants.IMG_OVR_ERROR).getImageData();
     drawImage(data, 0, 0);
   }
 }
  /* (non-Javadoc)
   * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
   */
  public Image getImage(Object element) {
    IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) element;
    IResource resource = entry.getResource();
    switch (entry.getType()) {
      case IRuntimeClasspathEntry.PROJECT:
        IJavaElement proj = JavaCore.create(resource);
        if (proj == null) {
          return PlatformUI.getWorkbench()
              .getSharedImages()
              .getImage(SharedImages.IMG_OBJ_PROJECT_CLOSED);
        } else {
          return lp.getImage(proj);
        }
      case IRuntimeClasspathEntry.ARCHIVE:
        if (resource instanceof IContainer) {
          return lp.getImage(resource);
        }
        if (resource != null && resource.getLocation().toFile().isDirectory()) {
          return PlatformUI.getWorkbench()
              .getSharedImages()
              .getImage(org.eclipse.ui.ISharedImages.IMG_OBJ_FOLDER);
        }

        boolean external = resource == null;
        boolean source = true; // (entry.getSourceAttachmentPath() != null &&
        // !Path.EMPTY.equals(entry.getSourceAttachmentPath()));
        String key = null;
        if (external) {
          IPath path = entry.getPath();
          if (path != null) {
            File file = path.toFile();
            if (file.exists() && file.isDirectory()) {
              key = ISharedImages.IMG_OBJS_PACKFRAG_ROOT;
            } else {
              key = ISharedImages.IMG_OBJS_EXTERNAL_ARCHIVE;
            }
          }

        } else {
          if (source) {
            key = ISharedImages.IMG_OBJS_JAR_WITH_SOURCE;
          } else {
            key = ISharedImages.IMG_OBJS_JAR;
          }
        }
        return JavaUI.getSharedImages().getImage(key);
      case IRuntimeClasspathEntry.VARIABLE:
        return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_ENV_VAR);
      case IRuntimeClasspathEntry.CONTAINER:
        return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_LIBRARY);
      case IRuntimeClasspathEntry.OTHER:
        IRuntimeClasspathEntry delegate = entry;
        if (entry instanceof ClasspathEntry) {
          delegate = ((ClasspathEntry) entry).getDelegate();
        }
        Image image = lp.getImage(delegate);
        if (image != null) {
          return image;
        }
        if (resource == null) {
          return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_LIBRARY);
        }
        return lp.getImage(resource);
    }
    return null;
  }
Exemplo n.º 3
0
 /* (non-Javadoc)
  * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
  */
 public Image getImage() {
   return DebugUITools.getImage(IInternalDebugUIConstants.IMG_OBJS_COMMON_TAB);
 }