Bug 174121 - SWT - Add resource create/dispose callback to Device
Summary: SWT - Add resource create/dispose callback to Device
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-13 23:12 EST by Chris Grindstaff CLA
Modified: 2021-11-12 11:45 EST (History)
6 users (show)

See Also:


Attachments
Patch to add resource callbacks (4.17 KB, patch)
2007-02-13 23:12 EST, Chris Grindstaff CLA
no flags Details | Diff
Better patch with new SWT event types (4.74 KB, patch)
2007-02-15 12:15 EST, Chris Grindstaff CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Grindstaff CLA 2007-02-13 23:12:09 EST
Tools like Sleak could better be written by having a callback during Device.new_Object and Device.dispose_Object.
Comment 1 Chris Grindstaff CLA 2007-02-13 23:12:57 EST
Created attachment 58942 [details]
Patch to add resource callbacks
Comment 2 Randy Hudson CLA 2007-02-14 09:54:07 EST
If you want to reuse the Listener interface, the pattern would suggest defining new event types.  e.g. SWT.ResourceAllocated, SWT.ResourceDisposed.

Another option might be to move the tracking code (Device#new_Object, dispose_Object) into the DeviceData class, and allowing DeviceData to be extended with the usual "not intended to be subclassed" warning.
Comment 3 Chris Grindstaff CLA 2007-02-14 10:19:20 EST
I think defining new event types is the way to go.
I 'appropriated' a couple for my patch since I was trying to minimize my changes.

I also like Randy's suggestion of moving the tracking code to DeviceData since it seems like a debug only class.
Comment 4 Chris Grindstaff CLA 2007-02-15 12:15:43 EST
Created attachment 59072 [details]
Better patch with new SWT event types

Added ResourceAllocated/ResourceDisposed SWT event types.
Wrapped the listener in a try/finally to guard against bad listeners.
Comment 5 Carolyn MacLeod CLA 2007-03-02 11:31:53 EST
Unfortunately we can't use the patch as-is, because we don't want to reference the widgets package from the graphics package. We have gone to great lengths to ensure that the graphics package remains completely stand-alone.

However, we are looking at alternatives that will still achieve your objective. Stand by...
Comment 6 Carolyn MacLeod CLA 2007-03-02 15:40:29 EST
FYI, we are looking at a general solution for notifying when resources are created or deleted. We want to track widgets as resources also. And we want this new solution to be compatible with the current resource tracking mechanism. It's going to be a lot of changes and we have not finalized our thinking, so we will not have this solution today... in case you were hoping for something in time for EclipseCon.  :(
Comment 7 Chris Grindstaff CLA 2007-03-02 15:48:16 EST
That's fine. It would have been nice to have for EclipseCon, but as long as it makes it in for 3.3 I'll be tickled pink.
Comment 8 Steve Northover CLA 2007-03-31 20:47:42 EDT
Sorry but it won't be making it.  We're into 3.3 M6 API freeze and won't get to this.
Comment 9 Chris Grindstaff CLA 2007-08-22 01:03:41 EDT
With 3.3 out the door and 3.4 planning started (or finished, not
sure) I wanted to bring up this feature request again.

As a reminder, the feature request is to add resource and widget
create/dispose callbacks to device. This would make building tools
like Sleak much easier and wouldn't require changes to SWT (after this
one of course :-) )

Steve and I spoke about this at EclipseCon - if I recall correctly,
Steve was concerned about the "boil the ocean" nature of this change
and the API issue.

Anything I can do to help push this along? Is now a good time to make
this change?
Comment 10 Eclipse Webmaster CLA 2019-09-06 16:03:46 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.