Hi,
In my RCP application I run two plug-ins. Both of them provide a perspective. Both plug-ins use the same socket address (IP + port number) for network communication. When changing perspective the inactive perspective/plug-in must free the socket otherwise the active perspective/plug-in can't initialize its socket.
I have a listener in my RCP application's ApplicationWorkbenchWindowAdvisor which could perhaps take care of the needed action:
/**
* Listener for perspective changes.
*/
private IPerspectiveListener listener = new IPerspectiveListener() {
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
// Close all open editors when changing perspective
page.closeAllEditors(true);
// TODO:
// Take action to close all open socket connections when switching perspectives.
}
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
// No action
}
};
Can anybody give me a hint how to access the inactive perspective/plug-in to close the sockets? Any other ideas?
Thank you!