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 07:36
Chaitannya  is currently offline Chaitannya
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 Perspective.java is handling the code for perspective 1 and has mainview ,views1 and views2.

When I open perspective 1, Perspective.java 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, Perspective.java 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) {
			setText(desc.getLabel());
			setImageDescriptor(desc.getImageDescriptor());
		}
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: Mon Jul 28 04:24:10 EDT 2014

Powered by FUDForum. Page generated in 0.01889 seconds