Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to handle perspective switching
How to handle perspective switching [message #684299] Wed, 15 June 2011 11:36
Chaitannya  is currently offline Chaitannya Friend
Messages: 14
Registered: May 2010
Junior Member
Hello everyone,

I am handling a project where there are multiple perspectives (close to 15). So when a perspective is opened by the user the corresponding code executed.

E.g. the name is handling the code for perspective 1 and has mainview ,views1 and views2.

When I open perspective 1, executes code in

public void createInitialLayout(IPageLayout layout)

section is executed.

Now after a few operation I close perspective with an event and close all the views with hideView directive. Now next time when I open perspective 1, code is ignored and i get the views which are in the old state (i.e. the constructor is not executed). I want the perspective to open as if it is opening for the first time everytime. How to handle this.

code for opening the perspective is
		IPerspectiveDescriptor desc = PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id);

		if (desc != null) {
try {
			PlatformUI.getWorkbench().showPerspective(id, window);
		} catch (WorkbenchException e) {
			MessageDialog.openError(window.getShell(), "Error",
					"Error opening perspective:" + e.getMessage());
		}catch (Exception e) {
			MessageDialog.openError(window.getShell(), "Error",
					"Error opening perspective:" + e.getMessage());

Previous Topic:TableViewer question
Next Topic:Removal of perspective in RCP application
Goto Forum:

Current Time: Thu Nov 26 23:31:04 GMT 2015

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

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