Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » how to open a new view and close existing view
how to open a new view and close existing view [message #670909] Mon, 16 May 2011 03:24 Go to next message
raghav Missing name is currently offline raghav Missing name
Messages: 18
Registered: May 2011
Junior Member

hello im new to eclipse rcp

problem:
i added a button click event and i wish to open a new view and close the current view

i could do the second one closing the current view but unable to do the first

Regards,
Raghav
Re: how to open a new view and close existing view [message #670955 is a reply to message #670909] Mon, 16 May 2011 07:17 Go to previous messageGo to next message
Aleksandar Pavlov is currently offline Aleksandar Pavlov
Messages: 79
Registered: July 2009
Member
Hi, the code you need is:
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		
String viewIdToClose = OneView.ID;
IViewReference viewToClose = activePage.findViewReference(viewIdToClose);
activePage.hideView(viewToClose);
		
try {
	String viewIdToOpen = OtherView.ID;
	activePage.showView(viewIdToOpen);
} catch (PartInitException e) {
	e.printStackTrace();
}
Re: how to open a new view and close existing view [message #671187 is a reply to message #670955] Tue, 17 May 2011 00:32 Go to previous messageGo to next message
raghav Missing name is currently offline raghav Missing name
Messages: 18
Registered: May 2011
Junior Member

thanks pavlov

its working fine
Re: how to open a new view and close existing view [message #674538 is a reply to message #671187] Fri, 27 May 2011 05:41 Go to previous message
Eclipse User is currently offline Eclipse User
Messages: 1
Registered: May 2011
Junior Member
Hi there,
I am facing a similar problem like above. The code delivered in this thread works quite fine, but does not cover my problem completely.

I need to open two views when the top one (like a welcome page similar to the eclipse welcome page) closes. One of the views is supposed to open on the left side holding a picklist and the second view will manage the content of the item to be picked. As a standalone without the welcome page this works fine.

Right now, I am able to open both views (picklist and content) from the welcome view, but they appear just as two tabs on top of each other, which cuts the usability extremly down.

As a newby to Eclipse RCP I am running out of ideas. I tried a little bit to work with placeholders, but did not come to a sattisfying solution.

Any idea is more than welcome.

Thanks for your time
TG

[Updated on: Fri, 27 May 2011 05:42]

Report message to a moderator

Previous Topic:Help! How to change 'Loading Workbench' in splash screen?
Next Topic:How to add a progress bar as a component in a view
Goto Forum:
  


Current Time: Fri Jul 25 09:53:04 EDT 2014

Powered by FUDForum. Page generated in 0.02051 seconds