Skip to main content



      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 08:15 Go to next message
Eclipse UserFriend
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 09:37 Go to previous messageGo to next message
Eclipse UserFriend
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 12:17 Go to previous messageGo to next message
Eclipse UserFriend
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 03:59 Go to previous messageGo to next message
Eclipse UserFriend
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 03:59 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 04:24:44 EDT 2025

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

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

Back to the top