Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » ViewPart closing - causing content provider to be disposed(ViewPart closing - causing content provider to be disposed)
ViewPart closing - causing content provider to be disposed [message #665749] Fri, 15 April 2011 17:54 Go to next message
anna.w.teittinen is currently offline anna.w.teittinenFriend
Messages: 23
Registered: February 2011
Junior Member
Hello,

I hope I am posting this question in the correct forum and express my question clearly.

I have 2 ViewPart(s), say, ViewPart1 and ViewPart2; both implement ISelectionListener.
ViewPart1 has a tree where if a user clicks on a node, it updates a table in ViewPart2.

If a user does that and ViewPart2 had been closed by the user already, I noticed that method ViewPart2::selectionChanged(...) still gets called, without ViewPart2::createPartControl(...) getting called first. ViewPart2::createPartControl(...) is where the table and its content provider get set. When a view, ViewPart2 is closed, why does the content provider get disposed? This causes the problem where a list is getting set as input to the table with an assertion error thrown: "ContentViewer must have a content provider when input is set."

When a ViewPart is closed, can we prevent the content provider from getting disposed?

Thanks so much.
Re: ViewPart closing - causing content provider to be disposed [message #665760 is a reply to message #665749] Fri, 15 April 2011 18:43 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/15/2011 01:54 PM, Anna T. wrote:
> Hello,
>
> I hope I am posting this question in the correct forum and express my
> question clearly.
>
> I have 2 ViewPart(s), say, ViewPart1 and ViewPart2; both implement
> ISelectionListener.
> ViewPart1 has a tree where if a user clicks on a node, it updates a
> table in ViewPart2.
>
> If a user does that and ViewPart2 had been closed by the user already, I
> noticed that method ViewPart2::selectionChanged(...)

If you add listeners in your createPartControl(*) you are required (with
a few minor exceptions) to remove them in your part#dispose() method.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: ViewPart closing - causing content provider to be disposed [message #665780 is a reply to message #665760] Fri, 15 April 2011 21:04 Go to previous message
anna.w.teittinen is currently offline anna.w.teittinenFriend
Messages: 23
Registered: February 2011
Junior Member
Thanks Paul! It worked!
Previous Topic:Helios: Unhandled event loop exception
Next Topic:Menu imple be a code
Goto Forum:
  


Current Time: Wed Apr 24 20:49:08 GMT 2024

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

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

Back to the top