Plugin action icon


I developed a language plugin for MPS. If I want to set a icon on my action, it always takes the absolute path to the selected image. Is there a way to set a relative path? Cause I want to distribute this MPS plugin, without having the next user to select the respective image again.

Regards msch95

Comment actions Permalink

You can achieve this by adding your images to a jar file and then adding that jar to the class path (In mps you can try putting it inside lib folder as that gets loaded by default):

Java code Something like this:

public BufferedImage loadImage(String fileName){

    BufferedImage buff = null;
    try {
        buff =;
    } catch (IOException e) {
        // TODO Auto-generated catch block
        return null;
    return buff;


Note: In idea platform we have IconUtil class which makes out job much easier while reading image.
Comment actions Permalink

When you specify an icon that is inside the module's directory or inside a directory defined by a path variable (Settings -> Path Variables), its path should be automatically changed ("shrunk") to include a macro for the module directory, so the path should effectively become relative.

Comment actions Permalink

Thanks to both of you!


Please sign in to leave a comment.