Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Changing Perspective(How to close active sockets?)
Changing Perspective [message #556757] Thu, 02 September 2010 14:18 Go to next message
Mathias Zenger is currently offline Mathias ZengerFriend
Messages: 10
Registered: July 2009
Junior Member

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
			// 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!
Re: Changing Perspective [message #556758 is a reply to message #556757] Thu, 02 September 2010 14:23 Go to previous message
eshvar60  is currently offline eshvar60 Friend
Messages: 51
Registered: March 2010
Hey Mathias,

You are on the right track check out IPerspectiveListener3 and IPerspectiveListener4. The ladder has a preDeactivate method which allows you to perform actions before a perspective is destroyed.

The exact API is here:
http:// m.doc.isv/reference/api/org/eclipse/ui/IPerspectiveListener3 .html

and here:
http:// m.doc.isv/reference/api/org/eclipse/ui/IPerspectiveListener4 .html
Previous Topic:Switching Presentations on the fly, programmatically?
Next Topic:RCP Training Classes, Sep-Oct
Goto Forum:

Current Time: Sun Nov 29 10:56:57 GMT 2015

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

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