Commit ad2afc3e authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Added optional local echo (for generated commands) on remote console

parent c5781ccb
Loading
Loading
Loading
Loading
+23 −35
Original line number Original line Diff line number Diff line
@@ -236,7 +236,6 @@ public class VDTRunner {
			, IProgressMonitor monitor 
			, IProgressMonitor monitor 
			) throws CoreException{
			) throws CoreException{
		//TODO: Handle monitor
		//TODO: Handle monitor
		System.out.println("VDTLaunchConfigurationDelegate.doLaunch: console ("+consolePrefix+") commands not yet implemented");
		// Find console with name starting with consolePrefix
		// Find console with name starting with consolePrefix
		IConsoleManager man = ConsolePlugin.getDefault().getConsoleManager(); // debugging
		IConsoleManager man = ConsolePlugin.getDefault().getConsoleManager(); // debugging
		IConsole[] consoles=(IConsole[]) man.getConsoles();
		IConsole[] consoles=(IConsole[]) man.getConsoles();
@@ -254,6 +253,9 @@ public class VDTRunner {
		// try to send 
		// try to send 
        String[] arguments = configuration.getToolArguments();
        String[] arguments = configuration.getToolArguments();
        if (arguments == null) arguments=new String[0];
        if (arguments == null) arguments=new String[0];
        log("Writing to console "+iCons.getName()+":", arguments, null, false, true); /* Appears in the console of the target Eclipse (immediately erased) */
        log("Writing to console "+iCons.getName()+":", arguments, null, false, false); /* Appears in the console of the parent Eclipse */

//        IOConsoleInputStream inStream= iCons.getInputStream();
//        IOConsoleInputStream inStream= iCons.getInputStream();
        IOConsoleOutputStream 	outStream= iCons.newOutputStream();
        IOConsoleOutputStream 	outStream= iCons.newOutputStream();
        IProcess process=((ProcessConsole)iCons).getProcess();
        IProcess process=((ProcessConsole)iCons).getProcess();
@@ -261,7 +263,9 @@ public class VDTRunner {
        
        
        try {
        try {
        	for (int i=0;i<arguments.length;i++){
        	for (int i=0;i<arguments.length;i++){
//        		outStream.write(arguments[i]); // writes to console itself
				if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.LOCAL_ECHO)) {
					outStream.write(arguments[i]+"\n"); // writes to console itself
				}
        		iStreamProxy.write(arguments[i]+"\n");
        		iStreamProxy.write(arguments[i]+"\n");
        	}
        	}
        } catch (IOException e) {
        } catch (IOException e) {
@@ -273,26 +277,6 @@ public class VDTRunner {
		
		
	}
	}
        		
        		
 /*       		process.getStreamsProxy().getOutputStreamMonitor().addListener(new IStreamListener(){
        		    public void streamAppended (String text, IStreamMonitor monitor){
        		       //TODO: As per user requirement. 
        		    }
        		});
*/

 /*
 
  	public void parserSetup(
			VDTRunnerConfiguration configuration,
			IProcess process
			){
	    iCons=           (IOConsole) DebugUITools.getConsole(process); // had non-null fPatternMatcher , fType="org.eclipse.debug.ui.ProcessConsoleType"
		if (iCons==null){
			System.out.println("Could not get a console for the specified process");
		}
    	
    }
*/    
     
     
    public void resumeLaunch( String consoleName ) throws CoreException 
    public void resumeLaunch( String consoleName ) throws CoreException 
    {
    {
@@ -400,8 +384,8 @@ public class VDTRunner {
        	}
        	}
        }
        }
        String[] controlFiles = configuration.getControlFiles();
        String[] controlFiles = configuration.getControlFiles();
        log(cmdLine, controlFiles, false, true); /* Appears in the console of the target Eclipse (immediately erased) */
        log(null,cmdLine, controlFiles, false, true); /* Appears in the console of the target Eclipse (immediately erased) */
        log(cmdLine, controlFiles, false, false); /* Appears in the console of the parent Eclipse */
        log(null,cmdLine, controlFiles, false, false); /* Appears in the console of the parent Eclipse */


        String[] envp = configuration.getEnvironment();
        String[] envp = configuration.getEnvironment();
        
        
@@ -458,22 +442,26 @@ public class VDTRunner {


    } // run()
    } // run()
        
        
    private void log(String[] strings, 
    private void log(String header,
    		         String[] strings, 
                     String[] controlFiles, 
                     String[] controlFiles, 
                     boolean formatColumn, 
                     boolean formatColumn, 
                     boolean printToUser) 
                     boolean printToUser) 
    {
    {
        if(controlFiles!=null) {
        	println("Control files created:", printToUser);
        	println("Control files created:", printToUser);
        
        	if(controlFiles.length == 0) {
        	if(controlFiles.length == 0) {
        		println("(none)", printToUser);
        		println("(none)", printToUser);
        	} else {
        	} else {
        		for(int i = 0; i < controlFiles.length; i++)
        		for(int i = 0; i < controlFiles.length; i++)
        			println(controlFiles[i], printToUser);
        			println(controlFiles[i], printToUser);
        	}
        	}
        
        }
        println(printToUser);
        println(printToUser);
        println("Launching:", printToUser);
        if (header==null) {
        	header="Launching:";
        }
        println(header, printToUser);
        
        
        if(formatColumn)
        if(formatColumn)
            println(printToUser);
            println(printToUser);
+9 −8
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@


<vdt-project>
<vdt-project>
    <interface name="RemoteInterface" extends="project_interface">
    <interface name="RemoteInterface" extends="project_interface">
    		<syntax name="ProgramSyntax" format="%(%%ParamValue%|\n%)" />
    </interface>
    </interface>
    <tool name        = "RemotePython"
    <tool name        = "RemotePython"
          project     = "FPGA_project"
          project     = "FPGA_project"
@@ -127,9 +128,9 @@


        <parameter id       = "RemoteCommand"
        <parameter id       = "RemoteCommand"
                   label    = "Remote Command to send"
                   label    = "Remote Command to send"
                   type     = "String"
                   type     = "Stringlist"
                   format   = "CopyValue"
                   format   = "ProgramSyntax"
                   default  = "print &quot;Hello, World!&quot;"
                   default  = "print &quot;Hello, World!, 2*2=&quot;,2*2"
                   readonly = "false"
                   readonly = "false"
                   visible  = "true"/>
                   visible  = "true"/>
                   
                   
@@ -145,8 +146,8 @@
        <output>
        <output>
            <line name="command_line">
            <line name="command_line">
                "-c"
                "-c"
                "echo 'Nothing to do, sleepiing 15' ;"
                "echo 'Nothing to do, sleeping 5' ;"
                "sleep 15 ;"
                "sleep 5 ;"
                "echo 'Nothing to do, awakening' ;"
                "echo 'Nothing to do, awakening' ;"
            </line>
            </line>
			<line name="console_line" dest="python_console_name" sep="\n">
			<line name="console_line" dest="python_console_name" sep="\n">
@@ -154,9 +155,9 @@
            </line>
            </line>
            <line name="command_line">
            <line name="command_line">
                "-c"
                "-c"
                "echo 'Nothing to do second time, sleeping 25' ;"
                "echo 'Nothing to do second time, sleeping 10' ;"
                "sleep 25 ;"
                "sleep 10 ;"
                "echo 'Nothing to do again, awakening after sleep 25' ;"
                "echo 'Nothing to do again, awakening after sleep 10' ;"
            </line>
            </line>
        </output>
        </output>