Execute a command other than via context menu #1545
-
I have a command registered in the Theia CommandRegistry in my theia frontend module and an entry in the GLSP context menu. This works well. However it's not particularly visible/ obvious to users. I'd like to be able to add a menu entry to a UIExtension such as the ToolPalette. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @madamedefarge, Yes, this is possible. You can inject the Here is a quick overview of the implementation steps for customzing e.g. the
|
Beta Was this translation helpful? Give feedback.
Hi @madamedefarge,
Yes, this is possible. You can inject the
CommandRegistry
into your UIExtension and then setup an event-Listener for an UI-Event e.g. onClick that then callsthis.commandRegistry.executeCommand('my-command-id
);Here is a quick overview of the implementation steps for customzing e.g. the
ToolPalette
:Create a subclass that extends the
ToolPalette
class ( let's call itMyToolPalette
)Inject the Theia
ComandRegistry
into this class:Create the new UI element that you want to use for sending the commands (e.g. …