[Pydev-code] Open python console without dialog
Brought to you by:
fabioz
|
From: vincent l. <lap...@ho...> - 2009-11-04 17:40:25
|
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
|