You can not do this regularely. However you can try something like this:

Free program AutoHotkey (www.autohotkey.com) react on right click (Alt+Right click or Esc+Right click or something similar) and displays is own GUI. Than depending on action, it starts your java script which then run your plugin.

Your plugin must be scripting Avare.

It is not most elegant but if you absolutely need response to right click (modified ) this can be the way.