netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Windows terminal support

Open michelecos opened this issue 2 years ago • 2 comments

Description

NetBeans lacks proper support for launching a command line session with cmd or PowerShell and still requires installation of Cygwin.

Use case/motivation

I would like to be able a command line session in the project or current file directory. Maybe with a chance to choose the shell between the obvious choices for windows: cmd, PowerShell, maybe WSL, maybe Git bash.

Related issues

No response

Are you willing to submit a PR?

  • [X] Yes I am willing to submit a PR!

Code of Conduct

michelecos avatar Apr 11 '22 10:04 michelecos

So would this involve

  1. Implementing new "Terminal Implementations" (see org.netbeans.modules.terminal.ioprovider/Terminal for each applicable shell (i.e. Powershell, WSL, etc).
  2. Update the "Tools...Options...Miscellaneous...Terminals" for any applicable attributes for given shell
  3. Maybe allow to add each shell separately, similar to how a new Platform of Java is added?

ebresie avatar Aug 14 '22 17:08 ebresie

For reference "Terminal.java" has the following comments within:

* A {@link org.netbeans.lib.terminalemulator.Term}-based terminal component for
* inside NetBeans.
* <p>
* The most straightforward way of using it is as follows:
* <pre>
   import org.netbeans.lib.richexecution.Command;
   import org.netbeans.lib.richexecution.Program;
*
   public void actionPerformed(ActionEvent evt) {
       // Ask user what command they want to run
       String cmd = JOptionPane.showInputDialog("Command");
       if (cmd == null || cmd.trim().equals(""))
           return;

       TerminalProvider terminalProvider = TerminalProvider.getDefault();
       Terminal terminal = terminalProvider.createTerminal("command: " + cmd);
       Program program = new Command(cmd);
       terminal.startProgram(program, true);
   }
* </pre>
* @author ivan

So, is this as simple of having the "cmd" to start a given shell defined and executed in some way? Or is there more to it (i.e., IOProvided, etc.)?

ebresie avatar Aug 14 '22 17:08 ebresie

Months probably years ago I also had a look into this, there are some checks for pty stuff and unfortunately I failed get this working without checks for windows. Atm I wanted to update this plugin: https://github.com/fungl164/JConsole it has, unfortunately a couple of bugs with the cursor, but maybe this could be somehow a good start?

Chris2011 avatar Aug 17 '22 15:08 Chris2011

We also talked about it here: https://github.com/apache/netbeans/issues/6210 maybe implementing one of these solutions could help?

Chris2011 avatar Nov 15 '23 09:11 Chris2011