Set different icons for each module in project.

Hi,

I have multiple modules in my Project and I need to decorate these modules with my custom icons which are decided at run-time based on certain conditions.

I am currently using Presentation object(from the AbstractTreeNode) to get the image icon object and I superimpose my image icon using setImage on that icon object retrieved from Presentation object. When I superimpose my icon on any one of the modules, the icon for other module also changes. This is because the ImageIcon object retrieved from Presentation is common or same for all modules under one project.

Is it possible to set different icons for modules under one project? If yes, Can you someone provide me with pointers on how to go about it.

TIA

Thanks and Regards,
Priya

3 comments

You should not change the image of the icons but the icon itself. You will probably need to create your own module-node class that extends AbstractTreeNode which delegates to the original node and provides your customized icon.

You can then return your custom node(s) from your implementation of com.intellij.ide.projectView.TreeStructureProvider#modify()

0

Hi,

We get the icon from PresentationData object from AbstractTreeNode object.If we have to set our icon we have to change the presentation data in AbstractTreeNode. To change the Presentation data for a given abstractTreeNode we have no API .On extending AbstractTreeNode i am not getting how I am going to set it in a TreeStructureProvider implementation modify method . The return value of this is Collection. Please point me out how I can set my custom node from modify method.

TIA

Regards,
Priya

0

You should be more specific about where you get the AbstractTreeNode instances from then. Anyway, the Javadoc for TreeStructureProvider in IDEA 6.0 is quite detailed and should provide the information you're looking for.

0

Please sign in to leave a comment.