When a right click a folder how to add some menu options

hi , I customizeds a tool based on theia extension , now , the tool is used based on the situation like this “when i right click certain folder, there show a menu ‘apply XXX tool’ like blow”

how can do this?or how to add "right click’ event to certain folder

@zhoujingfighting thank you for the discussion!

In order to understand the implementation of any feature in the default framework, the best way is to simply look at the sources (you can find how upload files... works simply by searching for it in the code-base).

The idea is to:

  • create a command
  • implement the execute callback (which does the actual work of the command itself)
  • register the command with a uriAwareCommandHandler (so it knows about resource URI selections)
  • register the context menu (ex: the file context-menu)

If we look at the upload files... example:

command declaration:

registering the command:

implementing callbacks:

registering the menu(s)

1 Like