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 182276 Details for
Bug 326393
[Backport] Cannot compare word documents
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix v01
Bug 326393.txt (text/plain), 7.08 KB, created by
Szymon Brandys
on 2010-11-03 05:59:18 EDT
(
hide
)
Description:
Fix v01
Filename:
MIME Type:
Creator:
Szymon Brandys
Created:
2010-11-03 05:59:18 EDT
Size:
7.08 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.compare.win32 >Index: src/org/eclipse/compare/internal/win32/WordMergeViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java,v >retrieving revision 1.1 >diff -u -r1.1 WordMergeViewer.java >--- src/org/eclipse/compare/internal/win32/WordMergeViewer.java 18 Jun 2008 16:07:38 -0000 1.1 >+++ src/org/eclipse/compare/internal/win32/WordMergeViewer.java 3 Nov 2010 09:58:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008 IBM Corporation and others. >+ * Copyright (c) 2008, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -305,8 +305,16 @@ > try { > if (isOneSided()) { > File file = getFileForSingleSide(); >- if (file != null) >- wordArea.openDocument(file.getAbsolutePath(), inplace); >+ if (file != null) { >+ try { >+ wordArea.openDocument(file.getAbsolutePath(), inplace); >+ } catch (SWTException e) { >+ throw new CoreException(new Status(IStatus.ERROR, >+ Activator.PLUGIN_ID, NLS.bind( >+ CompareWin32Messages.WordComparison_16, >+ file.getAbsolutePath()), e)); >+ } >+ } > } else { > File left = getFileForLeft(); > File right = getFileForRight(); >@@ -327,7 +335,14 @@ > resultFileTimestamp = result.lastModified(); > description.setText(getTextDescription()); > } >- wordArea.openDocument(result.getAbsolutePath(), inplace); >+ try { >+ wordArea.openDocument(result.getAbsolutePath(), inplace); >+ } catch (SWTException e) { >+ throw new CoreException(new Status(IStatus.ERROR, >+ Activator.PLUGIN_ID, NLS.bind( >+ CompareWin32Messages.WordComparison_16, >+ result.getAbsolutePath()), e)); >+ } > } > } > } >Index: src/org/eclipse/compare/internal/win32/WordComparison.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordComparison.java,v >retrieving revision 1.2 >diff -u -r1.2 WordComparison.java >--- src/org/eclipse/compare/internal/win32/WordComparison.java 8 Dec 2008 14:43:10 -0000 1.2 >+++ src/org/eclipse/compare/internal/win32/WordComparison.java 3 Nov 2010 09:58:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008 IBM Corporation and others. >+ * Copyright (c) 2008, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -48,6 +48,14 @@ > return auto.invoke(property(auto, command), new Variant[0]); > } > >+ private static Variant invoke(OleAutomation auto, OleAutomation reference, String command) { >+ return auto.invoke(property(auto, reference, command), new Variant[0]); >+ } >+ >+ private static Variant invoke(OleAutomation auto, OleAutomation reference, String command, String value) { >+ return auto.invoke(property(auto, reference, command), new Variant[] { new Variant(value) }); >+ } >+ > private static Variant invoke(OleAutomation auto, String command, int value) { > return auto.invoke(property(auto, command), new Variant[] { new Variant(value) }); > } >@@ -104,6 +112,36 @@ > throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_3, command, value)); > } > >+ >+ /** >+ * <p>This methods workarounds the feature in doc documents. Some properties are not accessible >+ * using names when a diff document is created. The workaround is to obtain the id of the >+ * method from an original document and use it in the newly created one.</p> >+ * >+ * <p>An exception is thrown if the id cannot be retrieved</p> >+ * >+ * Reference information for id assignment: <a href=" >+ * http://msdn.microsoft.com/en-us/library/w7a36sdf%28VS.80%29.aspx">http://msdn.microsoft.com/en-us/library/w7a36sdf%28VS.80%29.aspx</a> >+ * >+ * @param auto - object from which we want to get the property, must not be <code>null</code> >+ * @param reference - an reference object from which the property will be obtained. >+ * @param name - the name of the property, must not be <code>null</code> >+ */ >+ private static int property(OleAutomation auto, OleAutomation reference, String name) { >+ int[] ids = auto.getIDsOfNames(new String[] { name }); >+ if (ids != null) { >+ return ids[0]; >+ } >+ if(reference == null) throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_4, name)) ; >+ >+ // the property was not retrieved at that point, try to get it from the reference object >+ ids = reference.getIDsOfNames(new String[] { name }); >+ if (ids == null) { >+ throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_4, name)); >+ } >+ return ids[0]; >+ } >+ > private static int property(OleAutomation auto, String name) { > int[] ids = auto.getIDsOfNames(new String[] { name }); > if (ids == null) throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_4, name)); >@@ -154,13 +192,13 @@ > compareDocument(document, baseDocument, revisedDocument); > OleAutomation activeDocument = getActiveDocument(application); > try { >- Variant varResult = invoke(activeDocument, "SaveAs", workingCopy); //$NON-NLS-1$ >+ Variant varResult = invoke(activeDocument, document, "SaveAs", workingCopy); //$NON-NLS-1$ > if (varResult == null) > throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_6, workingCopy)); > varResult.dispose(); > } finally { > try { >- closeDocument(activeDocument); >+ closeDocument(activeDocument, document); > } catch (SWTException e) { > // We don't want to throw the exception as we may mask another exception > Activator.log(e); >@@ -170,7 +208,7 @@ > } > } finally { > try { >- closeDocument(document); >+ closeDocument(document, null); > } catch (SWTException e) { > // We don't want to throw the exception as we may mask another exception > Activator.log(e); >@@ -183,9 +221,9 @@ > } > } > >- private void closeDocument(OleAutomation document) { >+ private void closeDocument(OleAutomation document, OleAutomation reference) { > // Close the first document: destination.Close() >- Variant varResult = invoke(document, "Close"); //$NON-NLS-1$ >+ Variant varResult = invoke(document, reference, "Close"); //$NON-NLS-1$ > if (varResult != null) { > varResult.dispose(); > } >@@ -273,7 +311,7 @@ > private void disposeSite() { > if (document != null) { > try { >- closeDocument(document); >+ closeDocument(document, null); > } catch (SWTException e) { > Activator.log(e); > }
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 326393
: 182276