Esempio n. 1
0
  @Override
  public Image getColumnImage(final Object element, final int columnIndex) {
    Image img = null;

    final ICoverageObject statsEl = (ICoverageObject) element;

    switch (columnIndex) {
      case 0:
        final ObjectType type = statsEl.getType();

        switch (type) {
          case FUNCTION:
            img = Activator.getImageDescriptor(Images.FUNCTION).createImage();
            break;
          case MODULE:
            IErlModule m;
            try {
              m = ErlModelManager.getErlangModel().findModule(statsEl.getLabel());
            } catch (final ErlModelException e) {
              e.printStackTrace();
              return null;
            }
            img =
                ErlangElementImageProvider.getErlImageDescriptor(
                        m, ErlangElementImageProvider.SMALL_ICONS)
                    .createImage();
            break;
          case FOLDER:
            img =
                PlatformUI.getWorkbench()
                    .getSharedImages()
                    .getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER)
                    .createImage();
            break;
          case PROJECT:
            img =
                PlatformUI.getWorkbench()
                    .getSharedImages()
                    .getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT)
                    .createImage();
            break;
        }
        break;
      case 3:
        img = drawPercentage(statsEl.getPercentage());
        break;
      default:
    }

    return img;
  }
Esempio n. 2
0
 @Override
 public Object[] getChildren(final Object parent) {
   if (parent instanceof IParent) {
     final IParent p = (IParent) parent;
     try {
       return p.getChildren().toArray();
     } catch (final ErlModelException x) {
       if (!x.isDoesNotExist()) {
         ErlLogger.debug("element missing: " + x.getMessage());
       }
     }
   }
   return NO_CHILDREN;
 }