Opening a new terminal tab via a Gateway plugin

Planned

I am using IntelliJ 2024.1 to develop a Plugin that should run on a hosted IDE via Gateway.
The Plugin should create a new Terminal tab and then execute a command in it.

I have the following code:

try {
    var commandLine = new GeneralCommandLine($command);
    commandLine.setCharset(StandardCharsets.UTF_8);
    ShellTerminalWidget shellTerminalWidget = TerminalToolWindowManager.getInstance(project).createLocalShellWidget(".", "NewTab");
    shellTerminalWidget.executeCommand(commandLine.getCommandLineString());
} catch (Exception e) {
    // Handling error here;
}

When I debug this from inside the IntelliJ, it is working, but when I create a plugin from it and add that plugin to PhpStorm remotely via Gateway and try to use it, nothing is happening... I don't get the new terminal and I don't know what is going on.

I saw this Stack Overflow post: https://stackoverflow.com/questions/74343236/in-jetbrains-plugin-development-how-to-execute-command-in-the-terminal-from-plu which mentions using the following:

BackendTerminalManager.getInstance(project).shareTerminal(...)

However, I am not sure how to get it to work as I cannot find reference to the BackendTerminalManager class.

Any ideas?

0

Please sign in to leave a comment.