Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to programatically close the osgi console
How to programatically close the osgi console [message #1464492] Fri, 07 November 2014 16:19 Go to next message
Aniruddha Shevade is currently offline Aniruddha ShevadeFriend
Messages: 14
Registered: July 2009
Junior Member
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 #1468034 is a reply to message #1464492] Mon, 10 November 2014 14:20 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 486
Registered: July 2009
Senior Member
I find this behavior of the concole to be rather annoying but I have not spent the time necessary to investigate why this thread just hangs out after the gogo and equinox console bundles have been stopped. Ideally they should clean up properly on shutdown. Could you please open a bug and we can investigate. Thanks.

... and no I am not aware of a programmatic way to shutdown the running thread, but perhaps there is some gogo API we are not calling correctly when our equinox console bundle stops.
Re: How to programatically close the osgi console [message #1468290 is a reply to message #1468034] Mon, 10 November 2014 18:38 Go to previous message
Aniruddha Shevade is currently offline Aniruddha ShevadeFriend
Messages: 14
Registered: July 2009
Junior Member
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
Previous Topic:Webstart java 8 update 25
Next Topic:p2 director, "missing requirements" that are totally there
Goto Forum:
  


Current Time: Wed Sep 19 20:30:22 GMT 2018

Powered by FUDForum. Page generated in 0.01295 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top