Opening ServerSocket from plugin [message #448364] |
Sun, 23 April 2006 19:10 |
Davor Cengija Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hi,
Is it possible to activate a (non-gui) plugin at the platform startup,
without having it opening views or editors? Actually, the plugin in
question shouldn't have views nor editors at all.
My situation:
I'm looking for the possibility for plugins to load at startup, without
opening views or editors. Actually, my plugin should open a ServerSocket
and listen for connections as soon as RCP application is started. Once the
connection is received and a 'command' is issued by the client, plugin
should open some view or editor from other plugins (e.g. open specified
file for editing).
I'm having troubles activating a plugin if it doesn't have a view or
editor opened. I'm not quite sure if it's possible to initialize plugin at
platform startup if it doesn't contribute to GUI.
If not possible, where would be the right place to put ServerSocket,
having in mind that other views and editors must be visible and ready to
open.
Code related to opening a server socket is plain simple:
// class extends thread, this is in run()
ServerSocket serverSocket = new ServerSocket(PORT);
while (true) {
Socket clientSocket = serverSocket.accept();
BufferedReader in = new BufferedReader(new InputStreamReader(
clientSocket.getInputStream()));
String inputLine, outputLine;
while ((inputLine = in.readLine()) != null) {
if (inputLine.equals("some command")) {
// parse command, activate view in the window
// which is in focus
}
// close connection
clientSocket.close();
break;
}
}
}
Any advices, thought or ideas are greatly welcome.
Thanks in advance
Davor
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03366 seconds