public class Callback
extends java.lang.Object
IMPORTANT: A callback is only valid when invoked on the thread which created it. The results are undefined (and typically bad) when a callback is passed out to the operating system (or other code) in such a way that the callback is called from a different thread.
Modifier and Type | Field and Description |
---|---|
(package private) int |
address |
(package private) int |
argCount |
(package private) int |
errorResult |
(package private) boolean |
isArrayBased |
(package private) boolean |
isStatic |
(package private) java.lang.String |
method |
(package private) java.lang.Object |
object |
(package private) static java.lang.String |
PTR_SIGNATURE |
(package private) java.lang.String |
signature |
(package private) static java.lang.String |
SIGNATURE_0 |
(package private) static java.lang.String |
SIGNATURE_1 |
(package private) static java.lang.String |
SIGNATURE_2 |
(package private) static java.lang.String |
SIGNATURE_3 |
(package private) static java.lang.String |
SIGNATURE_4 |
(package private) static java.lang.String |
SIGNATURE_N |
Constructor and Description |
---|
Callback(java.lang.Object object,
java.lang.String method,
int argCount)
Constructs a new instance of this class given an object
to send the message to, a string naming the method to
invoke and an argument count.
|
Callback(java.lang.Object object,
java.lang.String method,
int argCount,
boolean isArrayBased)
Constructs a new instance of this class given an object
to send the message to, a string naming the method to
invoke, an argument count and a flag indicating whether
or not the arguments will be passed in an array.
|
Callback(java.lang.Object object,
java.lang.String method,
int argCount,
boolean isArrayBased,
int errorResult)
Constructs a new instance of this class given an object
to send the message to, a string naming the method to
invoke, an argument count, a flag indicating whether
or not the arguments will be passed in an array and a value
to return when an exception happens.
|
Modifier and Type | Method and Description |
---|---|
(package private) static int |
bind(Callback callback,
java.lang.Object object,
java.lang.String method,
java.lang.String signature,
int argCount,
boolean isStatic,
boolean isArrayBased,
int errorResult)
Allocates the native level resources associated with the
callback.
|
void |
dispose()
Releases the native level resources associated with the callback,
and removes all references between the callback and
other objects.
|
int |
getAddress()
Returns the address of a block of machine code which will
invoke the callback represented by the receiver.
|
static boolean |
getEnabled()
Returns whether or not callbacks which are triggered at the
native level should cause the messages described by the matching
Callback objects to be invoked. |
static int |
getEntryCount()
Returns the number of times the system has been recursively entered
through a callback.
|
static java.lang.String |
getPlatform()
Returns the SWT platform name.
|
(package private) static java.lang.String |
getSignature(int argCount) |
(package private) static void |
ignoreCallbacks(boolean ignore)
Deprecated.
|
static void |
reset()
Immediately wipes out all native level state associated
with all callbacks.
|
static void |
setEnabled(boolean enable)
Indicates whether or not callbacks which are triggered at the
native level should cause the messages described by the matching
Callback objects to be invoked. |
(package private) static void |
unbind(Callback callback)
Releases the native level resources associated with the callback.
|
java.lang.Object object
java.lang.String method
java.lang.String signature
int argCount
int address
int errorResult
boolean isStatic
boolean isArrayBased
static final java.lang.String PTR_SIGNATURE
static final java.lang.String SIGNATURE_0
static final java.lang.String SIGNATURE_1
static final java.lang.String SIGNATURE_2
static final java.lang.String SIGNATURE_3
static final java.lang.String SIGNATURE_4
static final java.lang.String SIGNATURE_N
public Callback(java.lang.Object object, java.lang.String method, int argCount)
Class
it is assumed that
the method is a static method on that class.object
- the object to send the message tomethod
- the name of the method to invokeargCount
- the number of arguments that the method takespublic Callback(java.lang.Object object, java.lang.String method, int argCount, boolean isArrayBased)
Class
it is assumed that the method is a static method on that
class.object
- the object to send the message tomethod
- the name of the method to invokeargCount
- the number of arguments that the method takesisArrayBased
- true
if the arguments should be passed in an array and false otherwisepublic Callback(java.lang.Object object, java.lang.String method, int argCount, boolean isArrayBased, int errorResult)
Class
it is assumed that the method is a static method on that
class.object
- the object to send the message tomethod
- the name of the method to invokeargCount
- the number of arguments that the method takesisArrayBased
- true
if the arguments should be passed in an array and false otherwiseerrorResult
- the return value if the java code throws an exceptionstatic int bind(Callback callback, java.lang.Object object, java.lang.String method, java.lang.String signature, int argCount, boolean isStatic, boolean isArrayBased, int errorResult)
callback
- the callback to bindobject
- the callback's objectmethod
- the callback's methodsignature
- the callback's method signatureargCount
- the callback's method argument countisStatic
- whether the callback's method is staticisArrayBased
- whether the callback's method is array basederrorResult
- the callback's error resultpublic void dispose()
public int getAddress()
public static java.lang.String getPlatform()
public static int getEntryCount()
Note: This should not be called by application code.
static java.lang.String getSignature(int argCount)
public static final void setEnabled(boolean enable)
Callback
objects to be invoked. This method is used
to safely shut down SWT when it is run within environments
which can generate spurious events.
Note: This should not be called by application code.
enable
- true if callbacks should be invokedpublic static final boolean getEnabled()
Callback
objects to be invoked. This method is used
to safely shut down SWT when it is run within environments
which can generate spurious events.
Note: This should not be called by application code.
static final void ignoreCallbacks(boolean ignore)
ignore
- true if callbacks should not be invokedpublic static final void reset()
WARNING: This operation is extremely dangerous, and should never be performed by application code.