Need to superimpose an existing icon in the Project view

Hi,

I want to superimpose the file node icon in the project view with myown
custom icon.
E.g. If I open some read only file in IntelliJ, I can see a lock icon
superimposed on the file node icon, if I make that file writable that
superimposed lock icon disappears.

I want to implement the same behaviour for my plugin. The icon to be
superimposed will be decided at runtime.
It would be really great if some one can guide me on how to do this?

Thanks,
Priya



6 comments

I don't think it's in the Open API but here you go:

public Icon buildRowIcon(Icon ... icons) {
RowIcon row = new RowIcon(icons.length);
int i = 0;
for (Icon icon : icons) {
row.setIcon(icon, i++);
}

return row;
}

This takes a list of icons and superimposes them on each other. You can treat the result as a regular Icon.

0

RowIcon class is in the com.intellij.ui package of 'idea.jar' and this class is not visible when I try to import it.

If I add the idea.jar to the classpath it gives me compliation error. Is there any way to access classes in idea.jar?

0

RowIcon class is in the com.intellij.ui package of
'idea.jar' and this class is not visible when I try
to import it.

If I add the idea.jar to the classpath it gives me
compliation error. Is there any way to access classes
in idea.jar?


You have to add idea.jar to the classpath of your IDEA SDK.

0

I tried using RowIcon, but I am getting ClassCastException. I tried debugging to check the instance of the Icon, it shows it is RowIcon and when I try to check it as 'instance of' RowIcon it returns false.

Any idea why this is happening?

0

That's most probably because you have (or had) idea.jar on your classpath. Make sure it isn't on your classpath but on the classpath of the IDEA SDK. And then make sure that there's no idea.jar left over which have been copied to the sandbox previously.

0

Please sign in to leave a comment.