How to programatically close the osgi console [message #1464492] |
Fri, 07 November 2014 11:19  |
Eclipse User |
|
|
|
Hello
I have an eclipse application , which is being invoked from the command line using a command like
eclipse.exe -consoleLog -console -application <ApplicationId>
This opens another command window , which closes immediately after the application finishes. In order to review the console output the command line was modified to add the 'noExit' parameter
eclipse.exe -consoleLog -console -noExit -application <ApplicationId>
With this the new console window stays open. The user has to explcitly type 'Exit' to quit the console. When I do it , the new console window stays as is, but the osgi console session is closed
The question is
How can i do this from within the code, so that the user does not have to interact with the app to do it
I did notice the 'DisconnectCommand' or 'CloseSession' osgi console classes . not sure if these can be used.
ANy pointers is greatly appreciated
Thanks
Ani
|
|
|
|
Re: How to programatically close the osgi console [message #1468290 is a reply to message #1468034] |
Mon, 10 November 2014 13:38  |
Eclipse User |
|
|
|
Hi Thomas
Thanks for your reply. I will log a defect and update this with the details.
In the mean time , i was wondering if there was any way of
a) Getting a handle to the console / osgi console in this case
b) Execute the Exit command programatically.
I tried the following code snippet mentioned . For some reason i do get a lost of consoles , using this code.
https://wiki.eclipse.org/FAQ_How_do_I_write_to_the_console_from_a_plug-in%3F
private MessageConsole findConsole(String name) {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager conMan = plugin.getConsoleManager();
IConsole[] existing = conMan.getConsoles();
for (int i = 0; i < existing.length; i++)
if (name.equals(existing[i].getName()))
return (MessageConsole) existing[i];
//no console found, so create a new one
MessageConsole myConsole = new MessageConsole(name, null);
conMan.addConsoles(new IConsole[]{myConsole});
return myConsole;
}
Thanks
Ani
|
|
|
Powered by
FUDForum. Page generated in 0.03325 seconds