How to set up icons for stereotypes

Hi all!

I’m creating stereotypes using my plugin. Everything works fine except setting the icon path. I use the setIconPath method, specifying an absolute path to the file (like “C:\users\user\appdata…”). In this case, in the stereotype configuration window - the icon is displayed, but in the elements to which this stereotype is assigned - no.

When I try to see the path to the icon in an other good working stereotype (using getIconPath), I get something like this: stereotypeIcons/hMRq9F6FYFVAAQWb

It looks like the icon needs to be loaded into the project somehow first, and then use the internal path?
Sorry if my question is naive (I’m just learning Java and creating plugins), but - how, after all, to correctly set the icon for stereotype?

Thanks in advance for the help!

Hi Starpes,

Thank you for your post. I have forwarded your question to our team. When there is any feedback, I will let you know.

Best regards,
Jick Yeung

Hi Starpes,

Currently, our Open API does not support setting up icons for stereotypes. We will consider supporting it in the future. When it is available, I will post here.

Best regards,
Jick Yeung

1 Like

thanks for the awesome information.

My pleasure. :slight_smile:

Hi Starpes,

3 functions are supported in com.vp.plugin.ProjectManager:

public String getStereotypeIconPath(IStereotype stereotype);
public void importStereotypeIcon(String aIconPath, File aImageFile, IProject aProject) throws Exception;
public InputStream readStereotypeIcon(String aDisplayImagePath, IProject aProject) throws Exception;

You can update to the latest patch build (16_3_20220441aj or newer) to obtain the enhancements. The article below shows you the steps:

Best regards,
Jick Yeung