Important Note
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 |
|---|---|
| pack-priv long | |
| pack-priv int | |
| pack-priv long | |
| pack-priv static final boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv String | |
| pack-priv Object | |
| pack-priv static final String | |
| pack-priv String | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String |
| Access | Constructor and Description |
|---|---|
| public | Callback(Object
the object to send the message to object, String the name of the method to invoke method, int the number of arguments that the method takes 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. |
| public | Callback(Object
the object to send the message to object, String the name of the method to invoke method, int the number of arguments that the method takes argCount, boolean true if the arguments should be passed in an array and false otherwiseConstructs 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. |
| public | Callback(Object
the object to send the message to object, String the name of the method to invoke method, int the number of arguments that the method takes argCount, boolean true if the arguments should be passed in an array and false otherwisethe return value if the java code throws an exception 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. |
| public | Callback(Object
the object to send the message to object, String method the name of the method to invoke method, Type specify the type like returnType, Type[] void.class, long.class, double.class specify the list of arguments like arguments) new Type [] {long.class, double.class } Register the java method to be a C callback. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static synchronized native long | bind(Callback
the callback to bind callback, Object the callback's object object, String the callback's method method, String the callback's method signature signature, int the callback's method argument count argCount, boolean whether the callback's method is static isStatic, boolean whether the callback's method is array based isArrayBased, long the callback's error result errorResult)Allocates the native level resources associated with the callback. |
| public void | dispose()
Releases the native level resources associated with the callback, and removes all references between the callback and other objects. |
| public long | Returns: the callback addressReturns the address of a block of machine code which will invoke the callback represented by the receiver. |
| public static final synchronized native boolean | Returns: true if callbacks should not be invokedReturns whether or not callbacks which are triggered at the
native level should cause the messages described by the matching
|
| public static native int | Returns: the entry countReturns the number of times the system has been recursively entered through a callback. |
| public static native String | |
| pack-priv static String | |
| pack-priv static final void | ignoreCallbacks(boolean
true if callbacks should not be invoked ignore)
Deprecated
This might be called directly from native code in environments
which can generate spurious events.
|
| public static final synchronized native void | |
| public static final synchronized native void | setEnabled(boolean
true if callbacks should be invoked enable)Indicates whether or not callbacks which are triggered at the
native level should cause the messages described by the matching
|
| pack-priv static final synchronized native void |
| address | back to summary |
|---|---|
| pack-priv long address | |
| argCount | back to summary |
|---|---|
| pack-priv int argCount | |
| errorResult | back to summary |
|---|---|
| pack-priv long errorResult | |
| is32Bit | back to summary |
|---|---|
| pack-priv static final boolean is32Bit | |
| isArrayBased | back to summary |
|---|---|
| pack-priv boolean isArrayBased | |
| isStatic | back to summary |
|---|---|
| pack-priv boolean isStatic | |
| method | back to summary |
|---|---|
| pack-priv String method | |
| object | back to summary |
|---|---|
| pack-priv Object object | |
| PTR_SIGNATURE | back to summary |
|---|---|
| pack-priv static final String PTR_SIGNATURE | |
| signature | back to summary |
|---|---|
| pack-priv String signature | |
| SIGNATURE_0 | back to summary |
|---|---|
| pack-priv static final String SIGNATURE_0 | |
| SIGNATURE_1 | back to summary |
|---|---|
| pack-priv static final String SIGNATURE_1 | |
| SIGNATURE_2 | back to summary |
|---|---|
| pack-priv static final String SIGNATURE_2 | |
| SIGNATURE_3 | back to summary |
|---|---|
| pack-priv static final String SIGNATURE_3 | |
| SIGNATURE_4 | back to summary |
|---|---|
| pack-priv static final String SIGNATURE_4 | |
| SIGNATURE_N | back to summary |
|---|---|
| pack-priv static final String SIGNATURE_N | |
| Callback | back to summary |
|---|---|
| public Callback(Object object, 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. Note that, if the object
is an instance of Note, do not use this if the method arguments have a double, as arguments will be
shifted/corrupted. See Bug 510538. Instead use the following constructor: | |
| Callback | back to summary |
|---|---|
| public Callback(Object object, 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. Note
that, if the object is an instance of Note, do not use this if the method arguments have a double, as arguments will be
shifted/corrupted. See Bug 510538. Instead use the following constructor: | |
| Callback | back to summary |
|---|---|
| public Callback(Object object, String method, int argCount, boolean isArrayBased, long 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. Note that, if
the object is an instance of Note, do not use this if the method arguments have a double, as arguments will be
shifted/corrupted. See Bug 510538. Instead use the following constructor:
| |
| Callback | back to summary |
|---|---|
| public Callback(Object object, String method, Type returnType, Type[] arguments) Register the java method to be a C callback. I.e, C will be able to make a call to this java method directly (through callback.c) The other constructors hard-code int/long into the method signature: Note:
The following types are supported:
For example if you want to link the following method: | |
| bind | back to summary |
|---|---|
| pack-priv static synchronized native long bind(Callback callback, Object object, String method, String signature, int argCount, boolean isStatic, boolean isArrayBased, long errorResult) Allocates the native level resources associated with the callback. This method is only invoked from within the constructor for the argument.
| |
| dispose | back to summary |
|---|---|
| public void dispose() Releases the native level resources associated with the callback, and removes all references between the callback and other objects. This helps to prevent (bad) application code from accidentally holding onto extraneous garbage. | |
| getAddress | back to summary |
|---|---|
| public long getAddress() Returns the address of a block of machine code which will invoke the callback represented by the receiver.
| |
| getEnabled | back to summary |
|---|---|
| public static final synchronized native boolean getEnabled() Returns whether or not callbacks which are triggered at the
native level should cause the messages described by the matching
Note This should not be called by application code.
| |
| getEntryCount | back to summary |
|---|---|
| public static native int getEntryCount() Returns the number of times the system has been recursively entered through a callback. Note This should not be called by application code.
| |
| getPlatform | back to summary |
|---|---|
| public static native String getPlatform() Returns the SWT platform name.
| |
| getSignature | back to summary |
|---|---|
| pack-priv static String getSignature(int argCount) | |
| ignoreCallbacks | back to summary |
|---|---|
| pack-priv static final void ignoreCallbacks(boolean ignore)
Deprecated
This might be called directly from native code in environments which can generate spurious events. Check before removing it.
| |
| reset | back to summary |
|---|---|
| public static final synchronized native void reset() Immediately wipes out all native level state associated with all callbacks. Warning This operation is extremely dangerous, and should never be performed by application code. | |
| setEnabled | back to summary |
|---|---|
| public static final synchronized native void setEnabled(boolean enable) Indicates whether or not callbacks which are triggered at the
native level should cause the messages described by the matching
Note This should not be called by application code.
| |
| unbind | back to summary |
|---|---|
| pack-priv static final synchronized native void unbind(Callback callback) Releases the native level resources associated with the callback.
| |