apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.6k stars 835 forks source link

Windows terminal support #3959

Open michelecos opened 2 years ago

michelecos commented 2 years ago

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?

Code of Conduct

ebresie commented 1 year ago

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 commented 1 year ago

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.)?

Chris2011 commented 1 year ago

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 commented 8 months ago

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