Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Close views
Close views [message #452112] Sat, 01 July 2006 11:29 Go to next message
Eclipse UserFriend
Originally posted by: gsebas27.gmail.com

Hello friends, i have a question: How i can close a view from any point of
my code?

I proved:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findView( "MyViewID").dispose();

But the view still in the screen.

Any idea?
Re: Close views [message #452132 is a reply to message #452112] Mon, 03 July 2006 09:02 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
sebasitu wrote:

> Hello friends, i have a question: How i can close a view from any
> point of my code?
>
> I proved:
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findView( "MyViewID").dispose();
>

Try IWorkbenchPage.hideView(IViewPart)

Dani

>
> But the view still in the screen.
>
> Any idea?
>
>
Re: Close views [message #452133 is a reply to message #452112] Mon, 03 July 2006 09:02 Go to previous messageGo to next message
Heiko Kundlacz is currently offline Heiko KundlaczFriend
Messages: 17
Registered: July 2009
Junior Member
I do for instance in the WorkbenchAdvisor:

public boolean preShutdown() {
// Closing Views
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IViewReference[] viewRefs = window.getActivePage().getViewReferences();
for (int i = 0; i < viewRefs.length; i++) {
if ((viewRefs[i].getSecondaryId() != null) && (viewRefs[i].getId().equals(MyView.ID))) {
viewRefs[i].getPage().hideView(viewRefs[i]);
}
}
return super.preShutdown();
}
Re: Close views [message #452444 is a reply to message #452112] Wed, 05 July 2006 17:57 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

sebasitu wrote:
> Hello friends, i have a question: How i can close a view from any point
> of my code?
>
> I proved:
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findView( "MyViewID").dispose();

Other posts show how, and I'll just comment that client code should
never call dispose() on an IViewPart ... the javadoc forbids it, and it
can only end badly :-)

Later,
PW


Re: Close views [message #452978 is a reply to message #452444] Wed, 19 July 2006 12:19 Go to previous message
Srivatsan is currently offline SrivatsanFriend
Messages: 55
Registered: July 2009
Member
You can also use this code in your View class

getViewSite().getPage().hideView(View.this);

regards,
Srivatsan
Previous Topic:How to communicate with eclipse internal web browser
Next Topic:RCP product export using headless PDE build does not copy Eclipse plugins
Goto Forum:
  


Current Time: Wed Oct 09 22:40:35 GMT 2024

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

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

Back to the top