### Eclipse Workspace Patch 1.0 #P org.eclipse.compare Index: compare/org/eclipse/compare/internal/ComparePreferencePage.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java,v retrieving revision 1.61 diff -u -r1.61 ComparePreferencePage.java --- compare/org/eclipse/compare/internal/ComparePreferencePage.java 21 Apr 2010 10:52:08 -0000 1.61 +++ compare/org/eclipse/compare/internal/ComparePreferencePage.java 20 Sep 2010 14:16:48 -0000 @@ -20,6 +20,7 @@ import org.eclipse.compare.IEncodedStreamContentAccessor; import org.eclipse.compare.ITypedElement; import org.eclipse.compare.contentmergeviewer.TextMergeViewer; +import org.eclipse.compare.internal.core.ComparePlugin; import org.eclipse.compare.structuremergeviewer.DiffNode; import org.eclipse.compare.structuremergeviewer.Differencer; import org.eclipse.jface.dialogs.Dialog; @@ -92,6 +93,7 @@ public static final String USE_SINGLE_LINE= PREFIX + "UseSingleLine"; //$NON-NLS-1$ public static final String HIGHLIGHT_TOKEN_CHANGES= PREFIX + "HighlightTokenChanges"; //$NON-NLS-1$ //public static final String USE_RESOLVE_UI= PREFIX + "UseResolveUI"; //$NON-NLS-1$ + public static final String CAPPING_DISABLED= PREFIX + "CappingDisable"; //$NON-NLS-1$ public static final String PATH_FILTER= PREFIX + "PathFilter"; //$NON-NLS-1$ public static final String ADDED_LINES_REGEX= PREFIX + "AddedLinesRegex"; //$NON-NLS-1$ public static final String REMOVED_LINES_REGEX= PREFIX + "RemovedLinesRegex"; //$NON-NLS-1$ @@ -122,6 +124,7 @@ new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_SINGLE_LINE), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, HIGHLIGHT_TOKEN_CHANGES), //new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_RESOLVE_UI), + new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CAPPING_DISABLED), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PATH_FILTER), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ICompareUIConstants.PREF_NAVIGATION_END_ACTION), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ICompareUIConstants.PREF_NAVIGATION_END_ACTION_LOCAL), @@ -143,6 +146,7 @@ store.setDefault(USE_SINGLE_LINE, true); store.setDefault(HIGHLIGHT_TOKEN_CHANGES, true); //store.setDefault(USE_RESOLVE_UI, false); + store.setDefault(CAPPING_DISABLED, false); store.setDefault(PATH_FILTER, ""); //$NON-NLS-1$ store.setDefault(ICompareUIConstants.PREF_NAVIGATION_END_ACTION, ICompareUIConstants.PREF_VALUE_PROMPT); store.setDefault(ICompareUIConstants.PREF_NAVIGATION_END_ACTION_LOCAL, ICompareUIConstants.PREF_VALUE_LOOP); @@ -183,8 +187,12 @@ fOverlayStore.setValue(ADDED_LINES_REGEX, addedLinesRegex.getText()); fOverlayStore.setValue(REMOVED_LINES_REGEX, removedLinesRegex.getText()); - editor.store(); + editor.store(); fOverlayStore.propagate(); + + ComparePlugin.getDefault().setCappingDisabled( + getPreferenceStore().getBoolean( + ComparePreferencePage.CAPPING_DISABLED)); return true; } @@ -343,6 +351,7 @@ addCheckBox(composite, "ComparePreferencePage.useSingleLine.label", USE_SINGLE_LINE, 0); //$NON-NLS-1$ addCheckBox(composite, "ComparePreferencePage.highlightTokenChanges.label", HIGHLIGHT_TOKEN_CHANGES, 0); //$NON-NLS-1$ //addCheckBox(composite, "ComparePreferencePage.useResolveUI.label", USE_RESOLVE_UI, 0); //$NON-NLS-1$ + addCheckBox(composite, "ComparePreferencePage.disableCapping.label", CAPPING_DISABLED, 0); //$NON-NLS-1$ Composite radioGroup = new Composite(composite, SWT.NULL); radioGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); Index: compare/org/eclipse/compare/internal/CompareUIPlugin.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java,v retrieving revision 1.80 diff -u -r1.80 CompareUIPlugin.java --- compare/org/eclipse/compare/internal/CompareUIPlugin.java 17 Apr 2009 12:39:12 -0000 1.80 +++ compare/org/eclipse/compare/internal/CompareUIPlugin.java 20 Sep 2010 14:16:48 -0000 @@ -32,6 +32,7 @@ import org.eclipse.compare.IStreamContentAccessor; import org.eclipse.compare.IStreamMerger; import org.eclipse.compare.ITypedElement; +import org.eclipse.compare.internal.core.ComparePlugin; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.compare.structuremergeviewer.IStructureCreator; import org.eclipse.compare.structuremergeviewer.StructureDiffViewer; @@ -256,6 +257,10 @@ public void start(BundleContext context) throws Exception { super.start(context); + + ComparePlugin.getDefault().setCappingDisabled( + getPreferenceStore().getBoolean( + ComparePreferencePage.CAPPING_DISABLED)); } public void stop(BundleContext context) throws Exception { Index: compare/org/eclipse/compare/internal/merge/DocumentMerger.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java,v retrieving revision 1.12 diff -u -r1.12 DocumentMerger.java --- compare/org/eclipse/compare/internal/merge/DocumentMerger.java 20 Sep 2010 12:54:32 -0000 1.12 +++ compare/org/eclipse/compare/internal/merge/DocumentMerger.java 20 Sep 2010 14:16:48 -0000 @@ -19,6 +19,7 @@ import org.eclipse.compare.contentmergeviewer.ITokenComparator; import org.eclipse.compare.internal.CompareContentViewerSwitchingPane; import org.eclipse.compare.internal.CompareMessages; +import org.eclipse.compare.internal.ComparePreferencePage; import org.eclipse.compare.internal.CompareUIPlugin; import org.eclipse.compare.internal.DocLineComparator; import org.eclipse.compare.internal.MergeViewerContentProvider; @@ -430,7 +431,7 @@ } }*/ } - + final Object[] result= new Object[1]; final DocLineComparator sa= sancestor, sl= sleft, sr= sright; IRunnableWithProgress runnable= new IRunnableWithProgress() { @@ -558,6 +559,8 @@ private boolean isCapped(DocLineComparator ancestor, DocLineComparator left, DocLineComparator right) { + if (isCappingDisabled()) + return false; int aLength = ancestor == null? 0 : ancestor.getRangeCount(); int lLength = left.getRangeCount(); int rLength = right.getRangeCount(); @@ -674,6 +677,10 @@ return Utilities.getBoolean(getCompareConfiguration(), CompareConfiguration.IGNORE_WHITESPACE, false); } + private boolean isCappingDisabled() { + return CompareUIPlugin.getDefault().getPreferenceStore().getBoolean(ComparePreferencePage.CAPPING_DISABLED); + } + private IDocument getDocument(char contributor) { return fInput.getDocument(contributor); } Index: plugin.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties,v retrieving revision 1.97 diff -u -r1.97 plugin.properties --- plugin.properties 21 Apr 2010 10:52:08 -0000 1.97 +++ plugin.properties 20 Sep 2010 14:16:48 -0000 @@ -130,6 +130,7 @@ ComparePreferencePage.synchronizeScrolling.label= Synchronize &scrolling between panes in compare viewers ComparePreferencePage.useSingleLine.label= Connect &ranges with single line ComparePreferencePage.highlightTokenChanges.label=&Highlight individual changes +ComparePreferencePage.disableCapping.label=Disable &capping when comparing large documents ComparePreferencePage.preview.label= Previe&w: ComparePreferencePage.ancestor.label= Common Ancestor #P org.eclipse.compare.core Index: src/org/eclipse/compare/internal/core/ComparePlugin.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/ComparePlugin.java,v retrieving revision 1.2 diff -u -r1.2 ComparePlugin.java --- src/org/eclipse/compare/internal/core/ComparePlugin.java 9 Feb 2010 12:10:44 -0000 1.2 +++ src/org/eclipse/compare/internal/core/ComparePlugin.java 20 Sep 2010 14:16:49 -0000 @@ -25,7 +25,9 @@ // The shared instance private static ComparePlugin plugin; - + + private boolean cappingDisabled; + /** * The constructor */ @@ -53,7 +55,7 @@ /** * Returns the shared instance - * + * * @return the shared instance */ public static ComparePlugin getDefault() { @@ -61,11 +63,19 @@ } public static void log(Throwable e) { - log(new Status(IStatus.ERROR, PLUGIN_ID, 0, Messages.Activator_1, e)); + log(new Status(IStatus.ERROR, PLUGIN_ID, 0, Messages.Activator_1, e)); } - + public static void log(IStatus status) { getDefault().getLog().log(status); } + public void setCappingDisabled(boolean disable) { + this.cappingDisabled = disable; + } + + public boolean isCappingDisabled() { + return this.cappingDisabled; + } + } Index: src/org/eclipse/compare/internal/core/LCS.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/LCS.java,v retrieving revision 1.3 diff -u -r1.3 LCS.java --- src/org/eclipse/compare/internal/core/LCS.java 27 Mar 2010 09:55:29 -0000 1.3 +++ src/org/eclipse/compare/internal/core/LCS.java 20 Sep 2010 14:16:49 -0000 @@ -52,7 +52,7 @@ } this.max_differences = (length1 + length2 + 1) / 2; // ceil((N+M)/2) - if ((double) length1 * (double) length2 > TOO_LONG) { + if (!isCappingDisabled() && (double) length1 * (double) length2 > TOO_LONG) { // limit complexity to D^POW_LIMIT for long sequences this.max_differences = (int) Math.pow(this.max_differences, POW_LIMIT - 1.0); } @@ -94,6 +94,10 @@ } + private boolean isCappingDisabled() { + return ComparePlugin.getDefault().isCappingDisabled(); + } + /** * The recursive helper function for Myers' LCS. Computes the LCS of * l1[bottoml1 .. topl1] and l2[bottoml2 .. topl2] fills in the appropriate