Eclipse: salida de IProcess en la consola [cerrada]
Tengo un problema cuando intento escribir en la consola.
En el proyecto de complemento, he desarrollado una compilación personalizada que se puede llamar a través de los menús utilizando los comandos que desarrollé. Originalmente, la compilación se llamó dentro delaunch
método de mi clase que implementa ILaunchConfigurationDelegate.
...
String[] commandLine = (String[]) compilerArgs.toArray(new String[compilerArgs.size()]);
Process compilerProcess = DebugPlugin.exec(commandLine, new File(project.getLocation().toString()));
@SuppressWarnings("rawtypes")
Map processAttributes = new HashMap();
processAttributes.put(IProcess.ATTR_PROCESS_TYPE, "XVR");
IProcess dbgProcess = DebugPlugin.newProcess(launch, compilerProcess, "XVR Compiler", processAttributes);
try {
compilerProcess.waitFor();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(compilerProcess.exitValue() != 0) return false;
launch.removeProcess(dbgProcess);
Cuando se realizó una compilación, la salida del proceso se imprime en la consola y se analiza con una clase que implementa IConsoleLineTracker para resaltar los errores.
Moví el método de compilación fuera de la clase que implementa ILaunchConfigurationDelegate y la consola ya no se imprime. La única diferencia entre los dos casos es cómo se proporciona el objeto iLaunch. El nuevo método de compilación sigue
...
String[] commandLine = (String[]) compilerArgs.toArray(new String[compilerArgs.size()]);
Process compilerProcess = DebugPlugin.exec(commandLine, new File(prj.getLocation().toString()));
ILaunch xvrLaunch = XVRUtils.getXVRLaunch();
Map<String, String> processAttributes = new HashMap<String, String>();
processAttributes.put(IProcess.ATTR_PROCESS_TYPE, "XVR");
IProcess dbgProcess = DebugPlugin.newProcess(xvrLaunch, compilerProcess, "XVR Compiler", processAttributes);
try {
compilerProcess.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
if(compilerProcess.exitValue() != 0)
return false;
xvrLaunch.removeProcess(dbgProcess);
el lanzamiento se proporciona con la siguiente función
public static ILaunch getXVRLaunh(){
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunch[] launches = manager.getLaunches();
if(launches.length > 0){
for (ILaunch launch : launches) {
ILaunchConfiguration conf = launch.getLaunchConfiguration();
try {
if(conf.getType().equals(manager.getLaunchConfigurationType(ApplicationLaunchConfigurationDelegate.XVR_LAUNCH_CONFIGURATION_ID)))
return launch;
} catch (CoreException e) {
e.printStackTrace();
}
}
}
ILaunchConfiguration config = getXVRLaunchConfiguration();
Launch l = new Launch(config, "run, debug", null);
l.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
try {
if (l.getSourceLocator() == null) {
String type;
type = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null);
if (type == null) {
type = config.getType().getSourceLocatorId();
}
if (type != null) {
IPersistableSourceLocator locator = manager.newSourceLocator(type);
String memento = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
if (memento == null) {
locator.initializeDefaults(config);
} else {
if(locator instanceof IPersistableSourceLocator2)
((IPersistableSourceLocator2)locator).initializeFromMemento(memento, config);
else
locator.initializeFromMemento(memento);
}
l.setSourceLocator(locator);
}
}
} catch (CoreException e) {
e.printStackTrace();
}
return l;
}
¿Por qué el proceso ya no se imprime en la consola?
¡Gracias