Adding actions to TabbedResourceWorkspace's NavTreeNodes

As per the title, I’d like to add some right click options (similar to Vision/Perspective’s “copy/paste as XML/JSON”) to my resource nodes in the Designer Nav Tree that are created by a TabbedResourceWorkspace.

Is there any easier way to do this besides iterating through the tree (starting from my workspace’s root node) and adding my actions to the leaves?

Not sure what you are wanting to do but TabbedResourceWorkspace has a this in the docs getTabPopupMenu​(ResourceEditor resourceEditor) Extend to add custom right click actions to individual tabs

https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/designer/tabbedworkspace/TabbedResourceWorkspace.html#getTabPopupMenu(com.inductiveautomation.ignition.designer.tabbedworkspace.ResourceEditor)

One thing for sure you should not have to iterate over anything

That function adds right click actions to the tabs of the workspace, I’m looking to add my actions to the designer’s NavTree.

so you want this? (shift + right click)

image
image

Yup, that’s exactly what I’m going for. My resources are already being serialized as JSON, so I’m looking to add convenience actions for an export → edit in a text editor → import workflow.

https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/designer/navtree/GatewayEventScriptNode.html#addEditActions(javax.swing.JPopupMenu)
?
no idea, im sure its somewhere to be found xd im not really home in vision/java

You should be implementing your own node types from AbstractNavTreeNode. Override .initPopupMenu to supply the custom actions you need.

3 Likes

My EtherNet/IP Module does this in the designer startup hook method:

	backplane = new EnipBackplaneNode(workspace, context);
	context.getProjectBrowserRoot().addChild(backplane);
	GatewayConnectionManager.getInstance().addPushNotificationListener(new DesignListener(backplane));
1 Like

Aha! All the dots are connected now.
Thanks as always Phil.