Search in sources :

Example 1 with ObjectType

use of org.erlide.cover.views.model.ObjectType in project erlide_eclipse by erlang.

the class StatsViewLabelProvider method getColumnImage.

@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 = ErlangEngine.getInstance().getModel().findModule(statsEl.getLabel());
                    } catch (final ErlModelException e) {
                        ErlLogger.error(e);
                        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;
                default:
                    break;
            }
            break;
        case 3:
            img = drawPercentage(statsEl.getPercentage());
            break;
        default:
    }
    return img;
}
Also used : ICoverageObject(org.erlide.cover.views.model.ICoverageObject) ObjectType(org.erlide.cover.views.model.ObjectType) ErlModelException(org.erlide.engine.model.ErlModelException) IErlModule(org.erlide.engine.model.root.IErlModule) Image(org.eclipse.swt.graphics.Image)

Aggregations

Image (org.eclipse.swt.graphics.Image)1 ICoverageObject (org.erlide.cover.views.model.ICoverageObject)1 ObjectType (org.erlide.cover.views.model.ObjectType)1 ErlModelException (org.erlide.engine.model.ErlModelException)1 IErlModule (org.erlide.engine.model.root.IErlModule)1