PCLICommand implements the TextInput interface to handle the input. BLD200405041800
authormentlicher@netbeans.org
Tue, 04 May 2004 17:21:37 +0000
changeset 4512503650e5c356
parent 4511 9437e6648136
child 4513 8c2cee752998
PCLICommand implements the TextInput interface to handle the input.
PCLICommandExecutor pass the input to the underlying script command.
Associated issue #34630.
vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/commands/PCLICommand.java
vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/commands/PCLICommandExecutor.java
     1.1 --- a/vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/commands/PCLICommand.java	Tue May 04 17:17:44 2004 +0000
     1.2 +++ b/vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/commands/PCLICommand.java	Tue May 04 17:21:37 2004 +0000
     1.3 @@ -26,6 +26,7 @@
     1.4  import org.netbeans.modules.vcscore.cmdline.exec.ExternalCommand;
     1.5  import org.netbeans.modules.vcscore.commands.CommandOutputListener;
     1.6  import org.netbeans.modules.vcscore.commands.CommandDataOutputListener;
     1.7 +import org.netbeans.modules.vcscore.commands.TextInput;
     1.8  import org.netbeans.modules.vcscore.commands.TextOutputListener;
     1.9  
    1.10  /**
    1.11 @@ -33,7 +34,8 @@
    1.12   *
    1.13   * @author  Martin Entlicher
    1.14   */
    1.15 -public class PCLICommand implements VcsAdditionalCommand, VcsAdditionalCommand.ImmediateOutput {
    1.16 +public class PCLICommand implements VcsAdditionalCommand, VcsAdditionalCommand.ImmediateOutput,
    1.17 +                                    TextInput {
    1.18      
    1.19      private String execStr;
    1.20      private CommandOutputListener stdoutListener;
    1.21 @@ -111,10 +113,15 @@
    1.22          this.stdImmediateErrListeners.add(l);
    1.23      }
    1.24  
    1.25 +    public void sendInput(String text) {
    1.26 +        PCLICommandExecutor.getDefault().sendInput(text);
    1.27 +    }
    1.28 +    
    1.29      void stdOutput(String line) {
    1.30          stdoutListener.outputLine(line);
    1.31          if (dataRegex != null) {
    1.32 -            stdoutDataListener.outputData(ExternalCommand.matchToStringArray(dataRegex, line));
    1.33 +            String[] sa = ExternalCommand.matchToStringArray(dataRegex, line);
    1.34 +            if (sa != null && sa.length > 0) stdoutDataListener.outputData(sa);
    1.35          }
    1.36      }
    1.37      
    1.38 @@ -128,7 +135,8 @@
    1.39      void errOutput(String line) {
    1.40          stderrListener.outputLine(line);
    1.41          if (errorRegex != null) {
    1.42 -            stderrDataListener.outputData(ExternalCommand.matchToStringArray(errorRegex, line));
    1.43 +            String[] sa = ExternalCommand.matchToStringArray(errorRegex, line);
    1.44 +            if (sa != null && sa.length > 0) stderrDataListener.outputData(sa);
    1.45          }
    1.46      }
    1.47      
     2.1 --- a/vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/commands/PCLICommandExecutor.java	Tue May 04 17:17:44 2004 +0000
     2.2 +++ b/vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/commands/PCLICommandExecutor.java	Tue May 04 17:21:37 2004 +0000
     2.3 @@ -227,6 +227,12 @@
     2.4          }
     2.5      }
     2.6      
     2.7 +    public void sendInput(String text) {
     2.8 +        if (cmd != null) {
     2.9 +            cmd.sendInput(text);
    2.10 +        }
    2.11 +    }
    2.12 +    
    2.13      private class PCLIStandardOutputListener implements TextOutputListener {
    2.14          
    2.15          private String lastLine;