Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » [Nebula Gallery] The best way to dispose of items
[Nebula Gallery] The best way to dispose of items [message #783303] Wed, 25 January 2012 13:15 Go to next message
Ivan Larionov is currently offline Ivan Larionov
Messages: 37
Registered: July 2009
Member
Hi All,

What is the best way to dispose of items of a virtual Gallery?
I save an object in the data field of each gallery item. for instance a
SWT.SetData listener:
public void handleEvent(Event event) {
GalleryItem item = (GalleryItem) event.item;
GalleryItem parent = item.getParentItem();

//!!!
item.setData(getObject(item));

if (parent == null) {
// group
processGroup(item, event.index);
} else {
// regular item
processItem(item, event.index);
}
}

How do I know when the item is disposed to clear my object. I tried
using item.addDisposeListener(...); and it was never called. And
Gallery.removeAll() and Gallery.remove(int) seem to behave differently:
remove(int) doesn't seem to call dispose() for an item.

Best regards,
Ivan
Re: [Nebula Gallery] The best way to dispose of items [message #787396 is a reply to message #783303] Tue, 31 January 2012 14:37 Go to previous messageGo to next message
Wim Jongman is currently offline Wim Jongman
Messages: 279
Registered: July 2009
Senior Member

Hi Ivan,

Can you please check if this is a bug in remove(int) and provide a patch for it? If you do this and attach the pacth to a bug against technology.nebula then I will make sure it gets patched.

Regards,

Wim Jongman
Re: [Nebula Gallery] The best way to dispose of items [message #787523 is a reply to message #783303] Tue, 31 January 2012 17:17 Go to previous messageGo to next message
Nicolas Richeton is currently offline Nicolas Richeton
Messages: 179
Registered: July 2009
Senior Member
Hi Ivan

Gallery should behave exactly as Tree or Table. Try to replace Gallery and GalleryItem by Tree and TreeItem. If this works with Tree, then this is a Gallery bug. If not this is how swt works. There is a unit test which ensure that Gallery and Tree uses the same API. You can add some more tests to show the differences you found and submit a patch.

Btw if I remember correctly, listening to dispose is not the right way to release ressources since It may not be called or not in the order you expect because it is os-dependent.

Nicolas
Re: [Nebula Gallery] The best way to dispose of items [message #791785 is a reply to message #787396] Mon, 06 February 2012 08:59 Go to previous messageGo to next message
Ivan Larionov is currently offline Ivan Larionov
Messages: 37
Registered: July 2009
Member
Hi,

I can't as I don't know really what is expected behaviour. I'll try to
follow the next piece of advice first, from Nicolas Richeton.

On 31.01.2012 16:37, Wim Jongman wrote:
> Hi Ivan,
>
> Can you please check if this is a bug in remove(int) and provide a patch
> for it? If you do this and attach the pacth to a bug against
> technology.nebula then I will make sure it gets patched.
>
> Regards,
>
> Wim Jongman
Re: [Nebula Gallery] The best way to dispose of items [message #791786 is a reply to message #787523] Mon, 06 February 2012 08:59 Go to previous message
Ivan Larionov is currently offline Ivan Larionov
Messages: 37
Registered: July 2009
Member
Hi Nicolas,

Thanks, I will try this.

On 31.01.2012 19:17, Nicolas RICHETON wrote:
> Hi Ivan
>
> Gallery should behave exactly as Tree or Table. Try to replace Gallery
> and GalleryItem by Tree and TreeItem. If this works with Tree, then this
> is a Gallery bug. If not this is how swt works. There is a unit test
> which ensure that Gallery and Tree uses the same API. You can add some
> more tests to show the differences you found and submit a patch.
>
> Btw if I remember correctly, listening to dispose is not the right way
> to release ressources since It may not be called or not in the order you
> expect because it is os-dependent.
>
> Nicolas
Previous Topic:GridTreeViewer refresh question
Next Topic:CSS Styling for Nebula Widgets
Goto Forum:
  


Current Time: Tue Oct 21 07:22:23 GMT 2014

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

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