au.com.swz.swttocom.swt.types
Class AutomationObjectImpl

java.lang.Object
  extended by au.com.swz.swttocom.swt.types.AutomationObjectImpl
All Implemented Interfaces:
IDisposeableResource, IAutomationObject
Direct Known Subclasses:
IFontDisp, IPictureDisp

public class AutomationObjectImpl
extends java.lang.Object
implements IAutomationObject, IDisposeableResource

This is the superclass of all automation objects within the SWT frameworks. It provides for the IDispatch methods in the unlikely event that you want to manually access the object via automation. It also provides for event management and interface reference release management.

Author:
Mark

Constructor Summary
AutomationObjectImpl(org.eclipse.swt.ole.win32.OleAutomation oleAutomation)
           
 
Method Summary
protected  void addEventListener(org.eclipse.swt.internal.ole.win32.GUID riid, int eventID, org.eclipse.swt.ole.win32.OleListener listener)
          Adds the listener to receive events.
 void dispose()
          Called by the SWT UI thread to release resources for this object.
 void dump()
           
protected  void finalize()
           
 int[] getIDsOfNames(java.lang.String[] names)
          Returns the integer values (IDs) that are associated with the specified names by the IDispatch implementor.
 java.lang.String getLastErrorSWT()
          Returns a description of the last error encountered.
 org.eclipse.swt.ole.win32.OleAutomation getOleAutomation()
          Returns the OleAutomation object currently being used to call the COM interface.
 org.eclipse.swt.ole.win32.Variant getProperty(int dispIdMember)
          Returns the value of the property specified by the dispIdMember.
 org.eclipse.swt.ole.win32.Variant getProperty(int dispIdMember, org.eclipse.swt.ole.win32.Variant[] rgvarg)
          Returns the value of the property specified by the dispIdMember.
 org.eclipse.swt.ole.win32.Variant getProperty(int dispIdMember, org.eclipse.swt.ole.win32.Variant[] rgvarg, int[] rgdispidNamedArgs)
          Returns the value of the property specified by the dispIdMember.
 org.eclipse.swt.ole.win32.Variant invoke(int dispIdMember)
          Invokes a method on the OLE Object; the method has no parameters.
 org.eclipse.swt.ole.win32.Variant invoke(int dispIdMember, org.eclipse.swt.ole.win32.Variant[] rgvarg)
          Invokes a method on the OLE Object; the method has no optional parameters.
 org.eclipse.swt.ole.win32.Variant invoke(int dispIdMember, org.eclipse.swt.ole.win32.Variant[] rgvarg, int[] rgdispidNamedArgs)
          Invokes a method on the OLE Object; the method has optional parameters.
 void invokeNoReply(int dispIdMember)
          Invokes a method on the OLE Object; the method has no parameters.
 void invokeNoReply(int dispIdMember, org.eclipse.swt.ole.win32.Variant[] rgvarg)
          Invokes a method on the OLE Object; the method has no optional parameters.
 void invokeNoReply(int dispIdMember, org.eclipse.swt.ole.win32.Variant[] rgvarg, int[] rgdispidNamedArgs)
          Invokes a method on the OLE Object; the method has optional parameters.
 boolean isDisposed()
          Determines if this automation object has been disposed.
protected  void removeEventListener(org.eclipse.swt.internal.ole.win32.GUID riid, int eventID, org.eclipse.swt.ole.win32.OleListener listener)
          Removes the listener.
 boolean setProperty(int dispIdMember, org.eclipse.swt.ole.win32.Variant rgvarg)
          Sets the property specified by the dispIdMember to a new value.
 boolean setProperty(int dispIdMember, org.eclipse.swt.ole.win32.Variant[] rgvarg)
          Sets the property specified by the dispIdMember to a new value.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutomationObjectImpl

public AutomationObjectImpl(org.eclipse.swt.ole.win32.OleAutomation oleAutomation)
Method Detail

getIDsOfNames

public int[] getIDsOfNames(java.lang.String[] names)
Description copied from interface: IAutomationObject
Returns the integer values (IDs) that are associated with the specified names by the IDispatch implementor. If you are trying to get the names of the parameters in a method, the first String in the names array must be the name of the method followed by the names of the parameters.

Specified by:
getIDsOfNames in interface IAutomationObject
Parameters:
names - an array of names for which you require the identifiers
Returns:
integer values that are associated with the specified names in the same order as the names where provided; or null if the names are unknown

getProperty

public org.eclipse.swt.ole.win32.Variant getProperty(int dispIdMember)
Description copied from interface: IAutomationObject
Returns the value of the property specified by the dispIdMember.

Specified by:
getProperty in interface IAutomationObject
Parameters:
dispIdMember - the ID of the property as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
Returns:
the value of the property specified by the dispIdMember or null

getProperty

public org.eclipse.swt.ole.win32.Variant getProperty(int dispIdMember,
                                                     org.eclipse.swt.ole.win32.Variant[] rgvarg)
Description copied from interface: IAutomationObject
Returns the value of the property specified by the dispIdMember.

Specified by:
getProperty in interface IAutomationObject
Parameters:
dispIdMember - the ID of the property as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
rgvarg - an array of arguments for the method. All arguments are considered to be read only unless the Variant is a By Reference Variant type.
Returns:
the value of the property specified by the dispIdMember or null

getProperty

public org.eclipse.swt.ole.win32.Variant getProperty(int dispIdMember,
                                                     org.eclipse.swt.ole.win32.Variant[] rgvarg,
                                                     int[] rgdispidNamedArgs)
Description copied from interface: IAutomationObject
Returns the value of the property specified by the dispIdMember.

Specified by:
getProperty in interface IAutomationObject
Parameters:
dispIdMember - the ID of the property as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
rgvarg - an array of arguments for the method. All arguments are considered to be read only unless the Variant is a By Reference Variant type.
rgdispidNamedArgs - an array of identifiers for the arguments specified in rgvarg; the parameter IDs must be in the same order as their corresponding values; all arguments must have an identifier - identifiers can be obtained using OleAutomation.getIDsOfNames
Returns:
the value of the property specified by the dispIdMember or null

invoke

public org.eclipse.swt.ole.win32.Variant invoke(int dispIdMember)
Description copied from interface: IAutomationObject
Invokes a method on the OLE Object; the method has no parameters.

Specified by:
invoke in interface IAutomationObject
Parameters:
dispIdMember - the ID of the method as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
Returns:
the result of the method or null if the method failed to give result information

invoke

public org.eclipse.swt.ole.win32.Variant invoke(int dispIdMember,
                                                org.eclipse.swt.ole.win32.Variant[] rgvarg)
Description copied from interface: IAutomationObject
Invokes a method on the OLE Object; the method has no optional parameters.

Specified by:
invoke in interface IAutomationObject
Parameters:
dispIdMember - the ID of the method as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
rgvarg - an array of arguments for the method. All arguments are considered to be read only unless the Variant is a By Reference Variant type.
Returns:
the result of the method or null if the method failed to give result information

invoke

public org.eclipse.swt.ole.win32.Variant invoke(int dispIdMember,
                                                org.eclipse.swt.ole.win32.Variant[] rgvarg,
                                                int[] rgdispidNamedArgs)
Description copied from interface: IAutomationObject
Invokes a method on the OLE Object; the method has optional parameters. It is not necessary to specify all the optional parameters, only include the parameters for which you are providing values.

Specified by:
invoke in interface IAutomationObject
Parameters:
dispIdMember - the ID of the method as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
rgvarg - an array of arguments for the method. All arguments are considered to be read only unless the Variant is a By Reference Variant type.
rgdispidNamedArgs - an array of identifiers for the arguments specified in rgvarg; the parameter IDs must be in the same order as their corresponding values; all arguments must have an identifier - identifiers can be obtained using OleAutomation.getIDsOfNames
Returns:
the result of the method or null if the method failed to give result information

invokeNoReply

public void invokeNoReply(int dispIdMember)
Description copied from interface: IAutomationObject
Invokes a method on the OLE Object; the method has no parameters. In the early days of OLE, the IDispatch interface was not well defined and some applications (mainly Word) did not support a return value. For these applications, call this method instead of calling public void invoke(int dispIdMember).

Specified by:
invokeNoReply in interface IAutomationObject
Parameters:
dispIdMember - the ID of the method as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames

invokeNoReply

public void invokeNoReply(int dispIdMember,
                          org.eclipse.swt.ole.win32.Variant[] rgvarg)
Description copied from interface: IAutomationObject
Invokes a method on the OLE Object; the method has no optional parameters. In the early days of OLE, the IDispatch interface was not well defined and some applications (mainly Word) did not support a return value. For these applications, call this method instead of calling public void invoke(int dispIdMember, Variant[] rgvarg).

Specified by:
invokeNoReply in interface IAutomationObject
Parameters:
dispIdMember - the ID of the method as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
rgvarg - an array of arguments for the method. All arguments are considered to be read only unless the Variant is a By Reference Variant type.

invokeNoReply

public void invokeNoReply(int dispIdMember,
                          org.eclipse.swt.ole.win32.Variant[] rgvarg,
                          int[] rgdispidNamedArgs)
Description copied from interface: IAutomationObject
Invokes a method on the OLE Object; the method has optional parameters. It is not necessary to specify all the optional parameters, only include the parameters for which you are providing values. In the early days of OLE, the IDispatch interface was not well defined and some applications (mainly Word) did not support a return value. For these applications, call this method instead of calling public void invoke(int dispIdMember, Variant[] rgvarg, int[] rgdispidNamedArgs).

Specified by:
invokeNoReply in interface IAutomationObject
Parameters:
dispIdMember - the ID of the method as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
rgvarg - an array of arguments for the method. All arguments are considered to be read only unless the Variant is a By Reference Variant type.
rgdispidNamedArgs - an array of identifiers for the arguments specified in rgvarg; the parameter IDs must be in the same order as their corresponding values; all arguments must have an identifier - identifiers can be obtained using OleAutomation.getIDsOfNames

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

dispose

public void dispose()
Description copied from interface: IDisposeableResource
Called by the SWT UI thread to release resources for this object.

Specified by:
dispose in interface IDisposeableResource
Specified by:
dispose in interface IAutomationObject

isDisposed

public boolean isDisposed()
Determines if this automation object has been disposed.

Specified by:
isDisposed in interface IAutomationObject
Returns:
true if this automation object has been disposed.

setProperty

public boolean setProperty(int dispIdMember,
                           org.eclipse.swt.ole.win32.Variant rgvarg)
Description copied from interface: IAutomationObject
Sets the property specified by the dispIdMember to a new value.

Specified by:
setProperty in interface IAutomationObject
Parameters:
dispIdMember - the ID of the property as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
rgvarg - the new value of the property
Returns:
true if the operation was successful

setProperty

public boolean setProperty(int dispIdMember,
                           org.eclipse.swt.ole.win32.Variant[] rgvarg)
Description copied from interface: IAutomationObject
Sets the property specified by the dispIdMember to a new value.

Specified by:
setProperty in interface IAutomationObject
Parameters:
dispIdMember - the ID of the property as specified by the IDL of the ActiveX Control; the value for the ID can be obtained using OleAutomation.getIDsOfNames
rgvarg - an array of arguments for the method. All arguments are considered to be read only unless the Variant is a By Reference Variant type.
Returns:
true if the operation was successful

getLastErrorSWT

public java.lang.String getLastErrorSWT()
Description copied from interface: IAutomationObject
Returns a description of the last error encountered.

Specified by:
getLastErrorSWT in interface IAutomationObject
Returns:
a description of the last error encountered

getOleAutomation

public org.eclipse.swt.ole.win32.OleAutomation getOleAutomation()
Returns the OleAutomation object currently being used to call the COM interface. This method returns a copy of the OleAutomation object and increments the reference count for the underlying COM interface(s). Callers of this method are responsible for disposing of the returned OleAutomation object.

Returns:
the OleAutomation object currently being used to call the COM interface

addEventListener

protected void addEventListener(org.eclipse.swt.internal.ole.win32.GUID riid,
                                int eventID,
                                org.eclipse.swt.ole.win32.OleListener listener)
Adds the listener to receive events.

Parameters:
riid - the guid of the event listener to add or null to use the default
eventID - the id of the event
listener - the listener
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT when listener is null

removeEventListener

protected void removeEventListener(org.eclipse.swt.internal.ole.win32.GUID riid,
                                   int eventID,
                                   org.eclipse.swt.ole.win32.OleListener listener)
Removes the listener.

Parameters:
eventID - the event identifier
listener - the listener
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT when listener is null

dump

public void dump()