How to overlay a small decoration on top of existing icon.

Imagine a usecase where multiple users are accessing the same project and editing files via a 3rd party plugin. I want to add a decoration to the project viewis file icons indicating the files that are being currenly edited. Is it possible with Open API to add a small decoration to the existing icon or is there any workaround?

3 comments
Comment actions Permalink

Please see com.intellij.ide.IconProvider, there's a couple of threads in forum on how to use it

0
Comment actions Permalink

yes I tried implementing IconProvider and I could replace the existing icon of any file. But I only want to put an ovelay to the existing icon. Please guide me how to do this if it is possible with IconProvider. Shown below is what I tried.

 
public class FileIconProvider extends IconProvider {

    private static final String INUSE_ICON_URL = "/awareness/inuseIcon.png";

    @Nullable
    @Override
    public
Icon getIcon(PsiElement element, int flags) {
        PsiFile containingFile = element.getContainingFile();

        if
(containingFile != null) {
            if(//some condition) {
                return
IconLoader.getIcon(INUSE_ICON_URL);
            
}
        }
        return null;
    
}
}

0
Comment actions Permalink

see com.intellij.ui.LayeredIcon

1

Please sign in to leave a comment.