Could not executeCommand of theia modules in my own customized module

Hi , I’m stuck with this problem

import { FileNavigatorCommands } from '@theia/navigator/lib/browser/navigator-contribution';
prop.commandService.executeCommand( );

then some error showed in the console

The command 'navigator.reveal' cannot be executed. There are no active handlers available for the command.

so, what is wrong with this logic??

PS : this command is executed in a react component

Hi @zhoujingfighting, this error is shown when the command has not been registered (we can safely assume it has been registered here) or if its handler returns false on the isEnabled function call:

I assume your selected widget at the time of calling the command is not a navigatable (i.e. It’s not an item that exists inside of the navigator widget). What exactly are you trying to accomplish by revealing your widget in the navigator?

@msujew hi , thk for your reply
actually . i want to execute the command of open explorer, then I found that in the module Navigator
the situation i use this command is that

  • firstly, I was working in my own customized mudule
  • then , a situation happend when I need to jump from my XXX wdiegt to open the widget of explorer
  • maybe I chosed the wrong command

Alright I see, that makes sense. If you just want to open the explorer, I think the FileNavigatorCommands.FOCUS command is what you’re looking for:

@msujew .Hi, I just tried what you said , it works
Thanks for taking your time , I really appreciate it !! :two_hearts:

1 Like