Hi,
 
I'm using the following code (extract from the PydevConsoleFactory) to open 
programmatically a python console. When the createInteractiveLaunch method is 
called, the application prompt for the type of dialog I want to open. Is there 
a way to open the console without showing the dialog and to automatically 
select the Python Console type?
 
 
private void function() {
  ScriptConsoleManager manager = ScriptConsoleManager.getInstance();
  try {
    PydevConsoleInterpreter interpreter = createDefaultPydevInterpreter();
    if(interpreter != null){
      PydevConsole console = new PydevConsole(interpreter);
      manager.add(console, true);
    }
  } catch (Exception e) {
    PydevPlugin.log(e);
  }
}
 
private PydevConsoleInterpreter createDefaultPydevInterpreter() throws 
Exception, UserCanceledException {
        IProcessFactory iprocessFactory = new IProcessFactory();
        Tuple3<Launch, Process, Integer> launchAndProcess = 
iprocessFactory.createInteractiveLaunch();
                
        if(launchAndProcess == null){
            return null;
        }
        final ILaunch launch = launchAndProcess.o1;
        if(launch == null){
            return null;
        }
        PydevConsoleInterpreter consoleInterpreter = new 
PydevConsoleInterpreter();
        int port = 
Integer.parseInt(launch.getAttribute(IProcessFactory.INTERACTIVE_LAUNCH_PORT));
        consoleInterpreter.setConsoleCommunication(new 
PydevConsoleCommunication(port, launchAndProcess.o2, launchAndProcess.o3));
        consoleInterpreter.setNaturesUsed(iprocessFactory.getNaturesUsed());
        
        PydevDebugPlugin.getDefault().addConsoleLaunch(launch);
        
        consoleInterpreter.addCloseOperation(new Runnable() {
            public void run() {
                PydevDebugPlugin.getDefault().removeConsoleLaunch(launch);
            }
        });
        return consoleInterpreter;
}
 
Thank
 
Vincent
 
                                          
_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://go.microsoft.com/?linkid=9691815
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pydev-code mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to