Project Resource Export Category/Name

What do I need to do to change my resource category name/display name in the export window?

My module id:

    public static final String MODULE_ID = "com.mussonind.ignition.ColorUtilities";

My resource:

    public static final String TYPE_ID = "color-ramp";
    public static final ResourceType RESOURCE_TYPE = new ResourceType(MODULE_ID, TYPE_ID);

And DesignerHook:

    @Override
    public String getResourceCategoryKey(ProjectResourceId id) {
        if (Ramp.RESOURCE_TYPE.equals(id.getResourceType())) {
            return "Color Ramps";
        } else {
            return super.getResourceCategoryKey(id);
        }
    }

    @Override
    public String getResourceDisplayName(ProjectResourceId id) {
        if (Ramp.RESOURCE_TYPE.equals(id.getResourceType())) {
            return "Color Ramp";
        } else {
            return super.getResourceDisplayName(id);
        }
    }

getResourceCategoryKey is the correct method, but you should return a path to a key in a bundle you’ve already loaded via BundleUtil.addBundle().

Your getResourceDisplayName override looks correct; does your MODULE_ID constant exactly match your module’s ID? That’s the only way I could see it failing…

1 Like

:+1: Thanks! This combined with a complete clean/build actually solved both issues somehow.

For posterities sake, here's what I changed:

  1. Created a Ramp.properties file located in resources/com/mussonind/ignition/color/common/.
category.name = Color Ramp
  1. Loaded the bundle in my DesignerHook.
BundleUtil.get().addBundle("Ramp", Ramp.class, "Ramp");
  1. Updated my getResourceCategoryKey to return the key specified in the properties file.
    @Override
    public String getResourceCategoryKey(ProjectResourceId id) {
        if (Ramp.RESOURCE_TYPE.equals(id.getResourceType())) {
            return "Ramp.category.name";
        } else {
            return super.getResourceCategoryKey(id);
        }
    }