Universal Robots Forum

Add URCap program node to TreeNode

Hello,

I’m trying to add a URCap program node to the tree node architecture of another URCap node like this:

ProgramModel programModel = api.getProgramModel();
ProgramNodeFactory programNodeFactory = programModel.getProgramNodeFactory();
TreeNode treeNode = programModel.getRootTreeNode(this);

try {
    treeNode.addChild(programNodeFactory.createURCapProgramNode(MyCustomProgramNodeService.class));
} catch (TreeStructureException e) {
}

This is working fine. The thing is, this doesn’t work if MyCustomProgramNodeService is not registered to the BundleContext in Activator.

Is there a way to do that without adding MyCustomProgramNode under the list of URCaps available program nodes? I don’t want to let a user to add MyCustomProgramNode alone.

The ProgramNodeService of the MyCustomProgramNode should implement NonUserInsertable along with ProgramNodeService - then the user will not be able to select it from the Structure tab.

1 Like