Extend already existing Designer Resource Popup


I already managed to create a popupmenu on a resource tree in a new Workspace with a new RootFolder. Now I’m wondering how I can extend an existing popup? I can’t figure out how to inject a new Action in the initPopupMenu of the standard popupmenu.

Any hint on this?

Thank you very much,

You’re extending AbstractNavTreeNode or AbstractResourceNavTreeNode? You should be able to just override initPopupMenu (you probably want to call super), or you could override addEditActions (also call super) and provide your own implementation. If you’re providing a PopupAction (you probably want to), then be sure to add your popup action to the sequence provided by getPopupActions, so that the edit action handler(s) properly set up your popup actions.


Thank you for your reply. What I really would like to do is to add a popupAction to an existing Tree. For example to the PerspectiveTree. In my DesignerHook I should be able to get ProjectBrowserRoot. But I can’t figure out how to extend an existing TreeNode without overriding?

I’m trying to add a Source Control Action to each resource. So we can check in to GIT.

Kind Regards,

You’re really not going to have an easy time doing that. You’re asking to break the encapsulation of what modules are expected to be able to do. Within the designer, it would theoretically be possible - from the DesignerContext, you can getProjectBrowserRoot. You’ll then have to (recursively) walk its children, find which node(s) represent resources (ie, inherit from AbstractResourceNavTreeNode) and then extend their popup menu. Because your custom menu item(s) won’t be registered, they won’t be populated with the contextual information I mentioned, so figuring out the resource information might be tricky.