Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 59072 Details for
Bug 174121
SWT - Add resource create/dispose callback to Device
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Better patch with new SWT event types
GDI_listener_2.txt (text/plain), 4.74 KB, created by
Chris Grindstaff
on 2007-02-15 12:15:43 EST
(
hide
)
Description:
Better patch with new SWT event types
Filename:
MIME Type:
Creator:
Chris Grindstaff
Created:
2007-02-15 12:15:43 EST
Size:
4.74 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java,v >retrieving revision 1.47 >diff -u -r1.47 Device.java >--- Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java 14 Dec 2006 16:42:09 -0000 1.47 >+++ Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java 15 Feb 2007 17:09:22 -0000 >@@ -15,6 +15,7 @@ > import org.eclipse.swt.internal.gdip.*; > import org.eclipse.swt.internal.win32.*; > import org.eclipse.swt.*; >+import org.eclipse.swt.widgets.*; > > /** > * This class is the abstract superclass of all device objects, >@@ -30,6 +31,7 @@ > boolean tracking = DEBUG; > Error [] errors; > Object [] objects; >+ Listener listener; > > /** > * Palette >@@ -125,6 +127,7 @@ > if (data != null) { > debug = data.debug; > tracking = data.tracking; >+ listener = data.listener; > } > create (data); > init (); >@@ -270,6 +273,17 @@ > void dispose_Object (Object object) { > for (int i=0; i<objects.length; i++) { > if (objects [i] == object) { >+ if(listener != null) { >+ Event event = new ResourceEvent(object); >+ event.time = OS.GetMessageTime(); >+ event.data = errors[i]; >+ event.type = SWT.ResourceDisposed; >+ try { >+ listener.handleEvent(event); >+ } catch (Throwable t) { >+ SWT.error (SWT.ERROR_FAILED_EXEC, t); >+ } >+ } > objects [i] = null; > errors [i] = null; > return; >@@ -784,6 +798,17 @@ > if (objects [i] == null) { > objects [i] = object; > errors [i] = new Error (); >+ if(listener != null) { >+ Event event = new ResourceEvent(object); >+ event.time = OS.GetMessageTime(); >+ event.type = SWT.ResourceAllocated; >+ event.data = errors[i]; >+ try { >+ listener.handleEvent(event); >+ } catch (Throwable t) { >+ SWT.error (SWT.ERROR_FAILED_EXEC, t); >+ } >+ } > return; > } > } >Index: Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java,v >retrieving revision 1.7 >diff -u -r1.7 DeviceData.java >--- Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java 28 Feb 2005 21:50:52 -0000 1.7 >+++ Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java 15 Feb 2007 17:09:22 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.swt.graphics; > >+import org.eclipse.swt.widgets.Listener; >+ > > public class DeviceData { > /* >@@ -20,4 +22,5 @@ > public boolean tracking; > public Error [] errors; > public Object [] objects; >+ public Listener listener; > } >Index: Eclipse SWT/common/org/eclipse/swt/SWT.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java,v >retrieving revision 1.127 >diff -u -r1.127 SWT.java >--- Eclipse SWT/common/org/eclipse/swt/SWT.java 26 Jan 2007 21:57:15 -0000 1.127 >+++ Eclipse SWT/common/org/eclipse/swt/SWT.java 15 Feb 2007 17:09:22 -0000 >@@ -611,6 +611,30 @@ > */ > public static final int PaintItem = 42; > >+ /** >+ * The resource allocated event type (value is 43). >+ * This is a debug event, not supported on all platforms. >+ * >+ * @see org.eclipse.swt.widgets.Widget#addListener >+ * @see org.eclipse.swt.widgets.Display#addFilter >+ * @see org.eclipse.swt.widgets.Event >+ * >+ * @since 3.3 >+ */ >+ public static final int ResourceAllocated = 43; >+ >+ /** >+ * The resource allocated event type (value is 44). >+ * This is a debug event, not supported on all platforms. >+ * >+ * @see org.eclipse.swt.widgets.Widget#addListener >+ * @see org.eclipse.swt.widgets.Display#addFilter >+ * @see org.eclipse.swt.widgets.Event >+ * >+ * @since 3.3 >+ */ >+ public static final int ResourceDisposed = 44; >+ > /* Event Details */ > > /** >Index: Eclipse SWT/common/org/eclipse/swt/graphics/ResourceEvent.java >=================================================================== >RCS file: Eclipse SWT/common/org/eclipse/swt/graphics/ResourceEvent.java >diff -N Eclipse SWT/common/org/eclipse/swt/graphics/ResourceEvent.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse SWT/common/org/eclipse/swt/graphics/ResourceEvent.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+package org.eclipse.swt.graphics; >+import org.eclipse.swt.widgets.Event; >+ >+ >+public class ResourceEvent extends Event { >+ public Object resource; >+ >+ public ResourceEvent(Object resource) { >+ super(); >+ this.resource = resource; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 174121
:
58942
| 59072