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 144248 Details for
Bug 68194
[OLE] OLE components w/o visual representation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
new patch
68194.patch (text/plain), 4.06 KB, created by
Felipe Heidrich
on 2009-08-12 11:36:52 EDT
(
hide
)
Description:
new patch
Filename:
MIME Type:
Creator:
Felipe Heidrich
Created:
2009-08-12 11:36:52 EDT
Size:
4.06 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java,v >retrieving revision 1.28 >diff -u -r1.28 OleAutomation.java >--- Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java 1 Jul 2009 14:49:25 -0000 1.28 >+++ Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java 12 Aug 2009 15:30:25 -0000 >@@ -11,6 +11,7 @@ > package org.eclipse.swt.ole.win32; > > >+import org.eclipse.swt.*; > import org.eclipse.swt.internal.ole.win32.*; > import org.eclipse.swt.internal.win32.*; > >@@ -83,6 +84,7 @@ > * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Examples: OLEExample, OleWebBrowser</a> > */ > public final class OleAutomation { >+ private IUnknown objIUnknown; > private IDispatch objIDispatch; > private String exceptionDescription; > private ITypeInfo objITypeInfo; >@@ -111,7 +113,7 @@ > * <li>ERROR_INVALID_INTERFACE_ADDRESS when called with an invalid client site > * </ul> > */ >- public OleAutomation(OleClientSite clientSite) { >+public OleAutomation(OleClientSite clientSite) { > if (clientSite == null) OLE.error(OLE.ERROR_INVALID_INTERFACE_ADDRESS); > objIDispatch = clientSite.getAutomationObject(); > >@@ -123,7 +125,49 @@ > if (result == OLE.S_OK) { > objITypeInfo = new ITypeInfo(ppv[0]); > } >- } >+} >+/** >+ * Creates an OleAutomation object for the specified progID. >+ * >+ * @param progId the unique program identifier of an OLE Document application; >+ * the value of the ProgID key or the value of the VersionIndependentProgID key specified >+ * in the registry for the desired OLE Document (for example, the VersionIndependentProgID >+ * for Word is Word.Document) >+ * >+ * @exception SWTException >+ * <ul><li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID >+ * <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object >+ * <li>ERROR_INTERFACE_NOT_FOUND when the OLE object specified does not implement IDispatch >+ * </ul> >+ * >+ * @since 3.6 >+ */ >+public OleAutomation(String progId) { >+ try { >+ OS.OleInitialize(0); >+ GUID appClsid = getClassID(progId); >+ if (appClsid == null) OLE.error(OLE.ERROR_INVALID_CLASSID); >+ >+ int[] ppvObject = new int[1]; >+ int result = COM.CoCreateInstance(appClsid, 0, COM.CLSCTX_INPROC_SERVER, COM.IIDIUnknown, ppvObject); >+ if (result != COM.S_OK) OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result); >+ objIUnknown = new IUnknown(ppvObject[0]); >+ >+ ppvObject[0] = 0; >+ result = objIUnknown.QueryInterface(COM.IIDIDispatch, ppvObject); >+ if (result != COM.S_OK) OLE.error(OLE.ERROR_INTERFACE_NOT_FOUND); >+ objIDispatch = new IDispatch(ppvObject[0]); >+ >+ ppvObject[0] = 0; >+ result = objIDispatch.GetTypeInfo(0, COM.LOCALE_USER_DEFAULT, ppvObject); >+ if (result == OLE.S_OK) { >+ objITypeInfo = new ITypeInfo(ppvObject[0]); >+ } >+ } catch (SWTException e) { >+ dispose(); >+ throw e; >+ } >+} > /** > * Disposes the automation object. > * <p> >@@ -141,11 +185,33 @@ > objITypeInfo.Release(); > } > objITypeInfo = null; >- >+ >+ if (objIUnknown != null){ >+ objIUnknown.Release(); >+ OS.OleUninitialize(); >+ } >+ objIUnknown = null; > } > int /*long*/ getAddress() { > return objIDispatch.getAddress(); > } >+GUID getClassID(String clientName) { >+ // create a GUID struct to hold the result >+ GUID guid = new GUID(); >+ >+ // create a null terminated array of char >+ char[] buffer = null; >+ if (clientName != null) { >+ int count = clientName.length(); >+ buffer = new char[count + 1]; >+ clientName.getChars(0, count, buffer, 0); >+ } >+ if (COM.CLSIDFromProgID(buffer, guid) != COM.S_OK){ >+ int result = COM.CLSIDFromString(buffer, guid); >+ if (result != COM.S_OK) return null; >+ } >+ return guid; >+} > /** > * Returns the fully qualified name of the Help file for the given member ID. > *
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 68194
:
12661
|
54838
|
143762
|
143763
| 144248