Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2001-08-22 10:04:37 +0000
committerAndre Weinand2001-08-22 10:04:37 +0000
commit5275453cac391e36c4f7d2a01c2ee8b73cb42112 (patch)
treef1a6833554d0093a09e5d5a844f5cddb4f7167d7
parent4045267e1f33e643e81d09dbcb4249fe93e13504 (diff)
downloadeclipse.platform.team-5275453cac391e36c4f7d2a01c2ee8b73cb42112.tar.gz
eclipse.platform.team-5275453cac391e36c4f7d2a01c2ee8b73cb42112.tar.xz
eclipse.platform.team-5275453cac391e36c4f7d2a01c2ee8b73cb42112.zip
1GIURNB: ITPUI:ALL - property file of EditionSelectionDialog contains configuration options
-rw-r--r--bundles/org.eclipse.compare/buildnotes_compare.html3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java15
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java114
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java253
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StoppableThread.java50
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java7
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html3
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java15
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java114
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java253
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/StoppableThread.java50
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java7
14 files changed, 170 insertions, 718 deletions
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
index 4a4399699..0320d2686 100644
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/buildnotes_compare.html
@@ -23,6 +23,7 @@ API changes</h3>
API Additions</h3>
new method EditionSelectionDialog.setHideIdenticalEntries(boolean)<br>
new method EditionSelectionDialog.setTargetIsRight(boolean)<br>
+new method EditionSelectionDialog.setAddMode(boolean)<br>
new method CompareEditorInput.saveChanges(...)<br>
<h3>
@@ -48,6 +49,8 @@ Problem reports fixed</h2>
1GGZ8DO: ITPJUI:WIN - MergeViewer invalid selection range<br>
1GIIBHM: ITPUI:WIN2000 - Problems when comparing zip files<br>
1GIKKOZ: ITPUI:ALL - alt copyright text in html doc needs update<br>
+1GIURNB: ITPUI:ALL - property file of EditionSelectionDialog contains configuration options<br>
+1GIUS6L: ITPUI:ALL - TextMergeViewer uses deprecated Thread.stop()<br>
<h2>
Problem reports closed</h2>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
index d216df6f8..c5a4e0152 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
@@ -189,7 +189,6 @@ public class EditionSelectionDialog extends Dialog {
* title String dialog title
* width Integer initial width of dialog
* height Integer initial height of dialog
- * mode String "replace" or "add"; default is "replace"
* treeTitleFormat MessageFormat pane title for edition tree; arg 0 is the target
* dateIcon String icon for node in edition tree; path relative to plugin
* timeIcon String icon for leaf in edition tree; path relative to plugin
@@ -210,8 +209,6 @@ public class EditionSelectionDialog extends Dialog {
fBundle= bundle;
- fReplaceMode= "replace".equals(Utilities.getString(fBundle, "mode", "replace")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
fCompareConfiguration= new CompareConfiguration();
fCompareConfiguration.setLeftEditable(false);
fCompareConfiguration.setRightEditable(false);
@@ -225,7 +222,7 @@ public class EditionSelectionDialog extends Dialog {
if (id != null)
fTimeImage= id.createImage();
}
-
+
/**
* Presents this modal dialog with the functionality described in the class comment above.
*
@@ -386,6 +383,16 @@ public class EditionSelectionDialog extends Dialog {
}
/**
+ * Controls whether the EditionSelectionDialog is in 'replace' mode
+ * or 'add' mode.
+ *
+ * @param addMode if true dialog is in 'add' mode.
+ */
+ public void setAddMode(boolean addMode) {
+ fReplaceMode= !addMode;
+ }
+
+ /**
* Returns the input target that has been specified with the most recent call
* to <code>selectEdition</code>. If a not <code>null</code> path was specified this method
* returns a subsection of this target (<code>IStructureCreator.locate(path, target)</code>)
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
index 61150fdab..c38d5a70b 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -449,20 +449,6 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
/* package */ void propertyChange(PropertyChangeEvent event) {
String key= event.getProperty();
-// if (key.equals(ICompareConfiguration.MERGE_DIRECTION)) {
-// if (isDirty() && !saveContents(true, true))
-// return;
-// ToolBarManager tbm= null;
-// IVisualContainer vc= getContainer();
-// if (vc instanceof Pane)
-// tbm= ((Pane)vc).getToolBarManager();
-// if (tbm != null) {
-// updateToolItems();
-// tbm.update(true);
-// }
-//
-// updateDirectionLabel();
-// } else
if (key.equals(ANCESTOR_ENABLED)) {
fAncestorEnabled= Utilities.getBoolean(getCompareConfiguration(), ANCESTOR_ENABLED, fAncestorEnabled);
@@ -639,9 +625,9 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
tbm.removeAll();
// define groups
- tbm.add(new Separator("modes")); //$NON-NLS-1$
- tbm.add(new Separator("merge")); //$NON-NLS-1$
- tbm.add(new Separator("navigation")); //$NON-NLS-1$
+ tbm.add(new Separator("modes")); //$NON-NLS-1$
+ tbm.add(new Separator("merge")); //$NON-NLS-1$
+ tbm.add(new Separator("navigation")); //$NON-NLS-1$
CompareConfiguration cc= getCompareConfiguration();
@@ -670,7 +656,7 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
Action a= new ChangePropertyAction(fBundle, fCompareConfiguration, "action.EnableAncestor.", ANCESTOR_ENABLED); //$NON-NLS-1$
a.setChecked(fAncestorEnabled);
fAncestorItem= new ActionContributionItem(a);
- //fAncestorItem.setVisible(false);
+ fAncestorItem.setVisible(false);
tbm.appendToGroup("modes", fAncestorItem); //$NON-NLS-1$
createToolItems(tbm);
@@ -781,64 +767,6 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
}
}
-// protected void createToolItems(ToolBarManager tbm) {
-//
-// if (USE_MORE_CONTROLS) {
-// fBothItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptBoth.") {
-// public void actionPerformed(Window w) {
-// accept(fCurrentDiff, true, false);
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fBothItem);
-//
-// fAutoItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptAll.") {
-// public void actionPerformed(Window w) {
-// autoResolve();
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fAutoItem);
-// }
-// fRejectItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptIgnoreNow.") {
-// public void actionPerformed(Window w) {
-// reject(fCurrentDiff, true);
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fRejectItem);
-//
-// Action a= new ChangePropertyAction(getBundle(), TextMergeViewer.class, getCompareConfiguration(), "action.SynchMode.", SYNC_SCROLLING);
-// a.setChecked(fSynchronizedScrolling);
-//// tbm.appendToGroup("modes", a);
-// tbm.add(a);
-//
-// tbm.add(new Separator());
-//
-// a= new Action() {
-// public void actionPerformed() {
-// navigate(true);
-// }
-// };
-// CompareUIPlugin.init(a, TextMergeViewer.class, getBundle(), "action.NextDiff.");
-// fNextItem= new ActionContributionItem(a);
-// //tbm.appendToGroup("navigation", fNextItem);
-// tbm.add(fNextItem);
-//
-// a= new Action() {
-// public void actionPerformed() {
-// navigate(false);
-// }
-// };
-// CompareUIPlugin.init(a, TextMergeViewer.class, getBundle(), "action.PrevDiff.");
-// fPreviousItem= new ActionContributionItem(a);
-// //tbm.appendToGroup("navigation", fPreviousItem);
-// tbm.add(fPreviousItem);
-// }
-
/**
* Updates the headers of the three areas
* by querying the content provider for a name and image for
@@ -865,8 +793,6 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
fRightLabel.setImage(content.getRightImage(input));
fRightLabel.setText(content.getRightLabel(input));
}
-
- updateDirectionLabel();
}
private Image loadImage(String name) {
@@ -875,37 +801,7 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
return id.createImage();
return null;
}
-
- private void updateDirectionLabel() {
-// if (fDirectionLabel != null) {
-// Image image= null;
-//
-// //if (fMergePolicy.hasMergeDirection()) {
-// boolean y= fCompareConfiguration.isLeftEditable();
-// boolean m= fCompareConfiguration.isRightEditable();
-//
-// if (y && m) {
-// if (fBothArrow == null)
-// fBothArrow= loadImage("images/both.gif");
-// image= fBothArrow;
-// } else if (y) {
-// if (fLeftArrow == null)
-// fLeftArrow= loadImage("images/yours.gif");
-// image= fLeftArrow;
-// } else if (m) {
-// if (fRightArrow == null)
-// fRightArrow= loadImage("images/mine.gif");
-// image= fRightArrow;
-// }
-// //}
-//
-// if (image != null)
-// fDirectionLabel.setImage(image);
-// else
-// fDirectionLabel.setText("");
-// }
- }
-
+
/**
* Calculates the height of the header.
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index 458c07d1e..97e12dffd 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -55,6 +55,7 @@ import org.eclipse.compare.internal.CompareUIPlugin;
import org.eclipse.compare.internal.MergeViewerAction;
import org.eclipse.compare.internal.INavigatable;
import org.eclipse.compare.internal.CompareNavigator;
+import org.eclipse.compare.internal.StoppableThread;
import org.eclipse.compare.rangedifferencer.RangeDifference;
import org.eclipse.compare.rangedifferencer.RangeDifferencer;
@@ -1100,32 +1101,23 @@ public class TextMergeViewer extends ContentMergeViewer {
}
}
- // perform the compare within TIMEOUT milli seconds
- RangeDifference[] e= null;
-
- final Object[] result= new Object[1];
final DocLineComparator sa= sancestor, sl= sleft, sr= sright;
- Thread t= new Thread() {
- public void run() {
- result[0]= RangeDifferencer.findRanges(sa, sl, sr);
+ StoppableThread t= new StoppableThread() {
+ public Object doRun() {
+ return RangeDifferencer.findRanges(sa, sl, sr);
}
};
- t.start();
- try {
- t.join(TIMEOUT);
- e= (RangeDifference[]) result[0];
- } catch(InterruptedException ex) {
- }
- t.stop();
+ RangeDifference[] e= (RangeDifference[]) t.getResult(TIMEOUT);
if (e == null) {
+ // timeout
ResourceBundle bundle= getResourceBundle();
String title= Utilities.getString(bundle, "tooComplexError.title"); //$NON-NLS-1$
String format= Utilities.getString(bundle, "tooComplexError.format"); //$NON-NLS-1$
String msg= MessageFormat.format(format, new Object[] { Integer.toString(TIMEOUT/1000) } );
MessageDialog.openError(fComposite.getShell(), title, msg);
- // timeout: we create a NOCHANGE range for the whole document
+ // we create a NOCHANGE range for the whole document
Diff diff= new Diff(null, RangeDifference.NOCHANGE,
aDoc, 0, aDoc != null ? aDoc.getLength() : 0,
lDoc, 0, lDoc.getLength(),
@@ -1390,83 +1382,6 @@ public class TextMergeViewer extends ContentMergeViewer {
((Action)fCopyDiffLeftToRightItem.getAction()).setEnabled(leftToRight);
if (fCopyDiffRightToLeftItem != null)
((Action)fCopyDiffRightToLeftItem.getAction()).setEnabled(rightToLeft);
-//
-// int fAutoResolve= 0;
-// int fUnresolvedDiffs= 0;
-// if (fChangeDiffs != null) {
-// fUnresolvedDiffs= fChangeDiffs.size();
-// if (fUnresolvedDiffs > 0) {
-// Iterator e= fChangeDiffs.iterator();
-// while (e.hasNext()) {
-// Diff diff= (Diff) e.next();
-// if (diff.isResolved()) {
-// fUnresolvedDiffs--;
-// } else {
-// if (diff.fDirection == RangeDifference.RIGHT || diff.fDirection == RangeDifference.LEFT) {
-// fAutoResolve++;
-// }
-// }
-// }
-// }
-// }
-//
-// boolean acceptReject= false;
-// boolean both= false;
-//
-// String s= "";
-//
-// if (fCurrentDiff != null) {
-// if (fCurrentDiff.isResolved()) {
-// s= "resolved";
-// } else {
-// s= "unresolved";
-//
-// IMergeViewerContentProvider twr= getContentProvider();
-// Object input= getInput();
-// boolean rightEditable= twr.isRightEditable(input);
-// boolean leftEditable= twr.isLeftEditable(input);
-//
-// switch (fCurrentDiff.fDirection) {
-// case RangeDifference.RIGHT: // outgoing
-// if (rightEditable)
-// acceptReject= true;
-// break;
-// case RangeDifference.LEFT: // incoming
-// if (leftEditable)
-// acceptReject= true;
-// break;
-// case RangeDifference.CONFLICT:
-// if (rightEditable) {
-// acceptReject= true;
-// both= true;
-// }
-// break;
-// }
-// }
-// } else {
-// if (fUnresolvedDiffs <= 0)
-// s= "allresolved";
-// else
-// s= "same";
-// }
-//
-// getAction(fTakeLeftActionItem).setEnabled(acceptReject);
-// getAction(fRejectItem).setEnabled(acceptReject);
-// if (fBothItem != null)
-// getAction(fBothItem).setEnabled(both);
-// if (fAutoItem != null)
-// getAction(fAutoItem).setEnabled(fAutoResolve > 0);
-//
-// if (s.length() > 0)
-// s= getBundle().getString("status." + s);
-//
-// ApplicationWindow b= getApplicationWindow();
-// if (b != null) {
-// String format= fBundle.getString(fUnresolvedDiffs > 0
-// ? "status.unresolvedformat"
-// : "status.resolvedformat");
-// b.setStatus(MessageFormat.format(format, new String[] { s, "" + fUnresolvedDiffs } ));
-// }
}
@@ -1474,15 +1389,6 @@ public class TextMergeViewer extends ContentMergeViewer {
super.updateHeader();
- IMergeViewerContentProvider content= getMergeContentProvider();
- Object input= getInput();
- boolean m= content.isRightEditable(input);
- boolean y= content.isLeftEditable(input);
-
- CompareConfiguration mp= getCompareConfiguration();
- //fLeft.setEditable(y && mp.isLeftEditable());
- //fRight.setEditable(m && mp.isRightEditable());
-
updateControls();
}
@@ -1492,38 +1398,6 @@ public class TextMergeViewer extends ContentMergeViewer {
*/
protected void createToolItems(ToolBarManager tbm) {
-// if (USE_MORE_CONTROLS) {
-// fBothItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptBoth.") {
-// public void actionPerformed(Window w) {
-// accept(fCurrentDiff, true, false);
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fBothItem);
-//
-// fAutoItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptAll.") {
-// public void actionPerformed(Window w) {
-// autoResolve();
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fAutoItem);
-// }
-// fRejectItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptIgnoreNow.") {
-// public void actionPerformed(Window w) {
-// reject(fCurrentDiff, true);
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fRejectItem);
-//
-// Action a= new ChangePropertyAction(getResourceBundle(), getCompareConfiguration(), "action.SynchMode.", SYNC_SCROLLING);
-// a.setChecked(fSynchronizedScrolling);
-// tbm.appendToGroup("modes", a);
-
tbm.add(new Separator());
Action a= new Action() {
@@ -1593,19 +1467,12 @@ public class TextMergeViewer extends ContentMergeViewer {
updateFont(ps, fComposite);
invalidateLines();
}
-
-// } else if (key.equals(SYNC_SCROLLING)) {
-//
-// boolean b= Utilities.getBoolean(getCompareConfiguration(), SYNC_SCROLLING, true);
-// if (b != fSynchronizedScrolling)
-// toggleSynchMode();
-
+
} else if (key.equals(ComparePreferencePage.SYNCHRONIZE_SCROLLING)) {
IPreferenceStore ps= CompareUIPlugin.getDefault().getPreferenceStore();
boolean b= ps.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
- //boolean b= Utilities.getBoolean(getCompareConfiguration(), SYNC_SCROLLING, true);
if (b != fSynchronizedScrolling)
toggleSynchMode();
@@ -1635,40 +1502,9 @@ public class TextMergeViewer extends ContentMergeViewer {
fLeft.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
fRight.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
- // recreates central control (Sash or Canvas)
- //handleResize();
fComposite.layout(true);
}
-
- protected void updateToolItems() {
- boolean visible= false;
- Object input= getInput();
- if (input != null) {
- visible= true;
-
- IMergeViewerContentProvider content= getMergeContentProvider();
-
- //boolean y= getMergePolicy().isLeftEditable();
- //boolean m= getMergePolicy().isRightEditable();
-
- //destinationEditable= content.isRightEditable(getInput());
- //destinationEditable= content.isLeftEditable(getInput());
- /*
- if (USE_MORE_CONTROLS) {
- fBothItem.setVisible(destinationEditable);
- fAutoItem.setVisible(destinationEditable);
- }
- fRejectItem.setVisible(destinationEditable);
- */
- }
-
- //fNextItem.setVisible(visible);
- //fPreviousItem.setVisible(visible);
-
- super.updateToolItems();
- }
-
//---- painting lines
/**
@@ -2214,14 +2050,7 @@ public class TextMergeViewer extends ContentMergeViewer {
private void copyDiffRightToLeft() {
copy(fCurrentDiff, false, false, false);
}
-
-// private void accept(Diff diff, boolean both, boolean gotoNext) {
-// if (getCompareConfiguration().isRightEditable())
-// copy(diff, true, both, gotoNext);
-// else if (getCompareConfiguration().isLeftEditable())
-// copy(diff, false, both, gotoNext);
-// }
-
+
private void copy(Diff diff, boolean leftToRight, boolean both, boolean gotoNext) {
if (diff != null && !diff.isResolved()) {
@@ -2290,65 +2119,6 @@ public class TextMergeViewer extends ContentMergeViewer {
}
}
- /**
- */
-// private void reject(Diff diff, boolean gotoNext) {
-//
-// if (diff != null && !diff.isResolved()) {
-//
-// switch (diff.fDirection) {
-// case RangeDifference.RIGHT:
-// setRightDirty(true); // mark dirty to force save!
-// break;
-// case RangeDifference.LEFT:
-// setLeftDirty(true); // mark dirty to force save!
-// break;
-// case RangeDifference.ANCESTOR:
-// break;
-// case RangeDifference.CONFLICT:
-// setLeftDirty(true); // mark dirty to force save!
-// setRightDirty(true); // mark dirty to force save!
-// break;
-// }
-//
-// diff.setResolved(true);
-//
-// if (gotoNext) {
-// navigate(true/*, true*/);
-// } else {
-// revealDiff(diff, true);
-// updateControls();
-// }
-// }
-// }
-
-
-// private void autoResolve() {
-// fCurrentDiff= null;
-// Diff firstConflict= null;
-//
-// Iterator e= fChangeDiffs.iterator();
-// for (int i= 0; e.hasNext(); i++) {
-// Diff diff= (Diff) e.next();
-// if (!diff.isResolved()) {
-// switch (diff.fDirection) {
-// case RangeDifference.RIGHT: // outgoing
-// case RangeDifference.LEFT: // incoming
-// accept(diff, false, false);
-// break;
-// case RangeDifference.CONFLICT: // incoming
-// if (firstConflict == null)
-// firstConflict= diff;
-// break;
-// }
-// }
-// }
-//
-// if (firstConflict == null)
-// firstConflict= (Diff) fChangeDiffs.get(0);
-// setCurrentDiff(firstConflict, true);
-// }
-
//---- scrolling
/**
@@ -2511,17 +2281,14 @@ public class TextMergeViewer extends ContentMergeViewer {
private void updateVScrollBar() {
if (Utilities.okToUse(fVScrollBar) && fSynchronizedScrolling) {
-// int selection= fVScrollBar.getSelection();
int virtualHeight= getVirtualHeight();
int viewPortHeight= getViewportHeight();
int pageIncrement= viewPortHeight-1;
int thumb= (viewPortHeight > virtualHeight) ? virtualHeight : viewPortHeight;
fVScrollBar.setPageIncrement(pageIncrement);
- fVScrollBar.setMaximum(virtualHeight); // XXX: sometimes the last line isn't visible
+ fVScrollBar.setMaximum(virtualHeight);
fVScrollBar.setThumb(thumb);
-
- //fVScrollBar.setValues(selection, 0, virtualHeight, thumb, 1, pageIncrement);
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
index ec0bc6d97..b585315cc 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
@@ -9,8 +9,6 @@
title= Replace from Local History
-mode= replace
-
treeTitleFormat= Local History of ''{0}''
dateIcon= obj16/day_obj.gif
timeIcon= obj16/resource_obj.gif
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StoppableThread.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StoppableThread.java
new file mode 100644
index 000000000..cf8f81f48
--- /dev/null
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StoppableThread.java
@@ -0,0 +1,50 @@
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+package org.eclipse.compare.internal;
+
+/**
+ * Run a (cooperative) piece of code under timeout control.
+ */
+public abstract class StoppableThread extends Thread {
+
+ boolean fStopped= false;
+ Object fResult= null;
+
+ private synchronized boolean isStopped2() {
+ return fStopped;
+ }
+
+ public void run() {
+ fResult= doRun();
+ }
+
+ private synchronized void setStopped() {
+ fStopped= true;
+ }
+
+ abstract public Object doRun();
+
+ public synchronized Object getResult(int timeout) {
+
+ start();
+ try {
+ join(timeout);
+ } catch(InterruptedException ex) {
+ fResult= null;
+ }
+ setStopped();
+ return fResult;
+ }
+
+ public static boolean isStopped() {
+ Thread t= Thread.currentThread();
+ if (t instanceof StoppableThread) {
+ StoppableThread st= (StoppableThread) t;
+ return st.isStopped2();
+ }
+ return false;
+ }
+}
+
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
index 0bbd686f6..17a3a7e5e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
@@ -9,6 +9,8 @@ import java.util.List;
import org.eclipse.jface.util.Assert;
+import org.eclipse.compare.internal.StoppableThread;
+
/**
* For finding the differences between two or three <code>IRangeComparator</code>s.
* <p>
@@ -84,13 +86,16 @@ public final class RangeDifferencer {
// for each value of the edit distance
for (int d= 1; d <= maxDiagonal; ++d) { // d is the current edit distance
-
+
if (right.skipRangeComparison(d, maxDiagonal, left))
return EMPTY_RESULT; // should be something we already found
// for each relevant diagonal (-d, -d+2 ..., d-2, d)
for (int k= lower; k <= upper; k += 2) { // k is the current diagonal
LinkedRangeDifference edit;
+
+ if (StoppableThread.isStopped())
+ return EMPTY_RESULT;
if (k == origin - d || k != origin + d && lastDiagonal[k + 1] >= lastDiagonal[k - 1]) {
//
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
index 4a4399699..0320d2686 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
@@ -23,6 +23,7 @@ API changes</h3>
API Additions</h3>
new method EditionSelectionDialog.setHideIdenticalEntries(boolean)<br>
new method EditionSelectionDialog.setTargetIsRight(boolean)<br>
+new method EditionSelectionDialog.setAddMode(boolean)<br>
new method CompareEditorInput.saveChanges(...)<br>
<h3>
@@ -48,6 +49,8 @@ Problem reports fixed</h2>
1GGZ8DO: ITPJUI:WIN - MergeViewer invalid selection range<br>
1GIIBHM: ITPUI:WIN2000 - Problems when comparing zip files<br>
1GIKKOZ: ITPUI:ALL - alt copyright text in html doc needs update<br>
+1GIURNB: ITPUI:ALL - property file of EditionSelectionDialog contains configuration options<br>
+1GIUS6L: ITPUI:ALL - TextMergeViewer uses deprecated Thread.stop()<br>
<h2>
Problem reports closed</h2>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
index d216df6f8..c5a4e0152 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
@@ -189,7 +189,6 @@ public class EditionSelectionDialog extends Dialog {
* title String dialog title
* width Integer initial width of dialog
* height Integer initial height of dialog
- * mode String "replace" or "add"; default is "replace"
* treeTitleFormat MessageFormat pane title for edition tree; arg 0 is the target
* dateIcon String icon for node in edition tree; path relative to plugin
* timeIcon String icon for leaf in edition tree; path relative to plugin
@@ -210,8 +209,6 @@ public class EditionSelectionDialog extends Dialog {
fBundle= bundle;
- fReplaceMode= "replace".equals(Utilities.getString(fBundle, "mode", "replace")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
fCompareConfiguration= new CompareConfiguration();
fCompareConfiguration.setLeftEditable(false);
fCompareConfiguration.setRightEditable(false);
@@ -225,7 +222,7 @@ public class EditionSelectionDialog extends Dialog {
if (id != null)
fTimeImage= id.createImage();
}
-
+
/**
* Presents this modal dialog with the functionality described in the class comment above.
*
@@ -386,6 +383,16 @@ public class EditionSelectionDialog extends Dialog {
}
/**
+ * Controls whether the EditionSelectionDialog is in 'replace' mode
+ * or 'add' mode.
+ *
+ * @param addMode if true dialog is in 'add' mode.
+ */
+ public void setAddMode(boolean addMode) {
+ fReplaceMode= !addMode;
+ }
+
+ /**
* Returns the input target that has been specified with the most recent call
* to <code>selectEdition</code>. If a not <code>null</code> path was specified this method
* returns a subsection of this target (<code>IStructureCreator.locate(path, target)</code>)
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
index 61150fdab..c38d5a70b 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -449,20 +449,6 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
/* package */ void propertyChange(PropertyChangeEvent event) {
String key= event.getProperty();
-// if (key.equals(ICompareConfiguration.MERGE_DIRECTION)) {
-// if (isDirty() && !saveContents(true, true))
-// return;
-// ToolBarManager tbm= null;
-// IVisualContainer vc= getContainer();
-// if (vc instanceof Pane)
-// tbm= ((Pane)vc).getToolBarManager();
-// if (tbm != null) {
-// updateToolItems();
-// tbm.update(true);
-// }
-//
-// updateDirectionLabel();
-// } else
if (key.equals(ANCESTOR_ENABLED)) {
fAncestorEnabled= Utilities.getBoolean(getCompareConfiguration(), ANCESTOR_ENABLED, fAncestorEnabled);
@@ -639,9 +625,9 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
tbm.removeAll();
// define groups
- tbm.add(new Separator("modes")); //$NON-NLS-1$
- tbm.add(new Separator("merge")); //$NON-NLS-1$
- tbm.add(new Separator("navigation")); //$NON-NLS-1$
+ tbm.add(new Separator("modes")); //$NON-NLS-1$
+ tbm.add(new Separator("merge")); //$NON-NLS-1$
+ tbm.add(new Separator("navigation")); //$NON-NLS-1$
CompareConfiguration cc= getCompareConfiguration();
@@ -670,7 +656,7 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
Action a= new ChangePropertyAction(fBundle, fCompareConfiguration, "action.EnableAncestor.", ANCESTOR_ENABLED); //$NON-NLS-1$
a.setChecked(fAncestorEnabled);
fAncestorItem= new ActionContributionItem(a);
- //fAncestorItem.setVisible(false);
+ fAncestorItem.setVisible(false);
tbm.appendToGroup("modes", fAncestorItem); //$NON-NLS-1$
createToolItems(tbm);
@@ -781,64 +767,6 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
}
}
-// protected void createToolItems(ToolBarManager tbm) {
-//
-// if (USE_MORE_CONTROLS) {
-// fBothItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptBoth.") {
-// public void actionPerformed(Window w) {
-// accept(fCurrentDiff, true, false);
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fBothItem);
-//
-// fAutoItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptAll.") {
-// public void actionPerformed(Window w) {
-// autoResolve();
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fAutoItem);
-// }
-// fRejectItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptIgnoreNow.") {
-// public void actionPerformed(Window w) {
-// reject(fCurrentDiff, true);
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fRejectItem);
-//
-// Action a= new ChangePropertyAction(getBundle(), TextMergeViewer.class, getCompareConfiguration(), "action.SynchMode.", SYNC_SCROLLING);
-// a.setChecked(fSynchronizedScrolling);
-//// tbm.appendToGroup("modes", a);
-// tbm.add(a);
-//
-// tbm.add(new Separator());
-//
-// a= new Action() {
-// public void actionPerformed() {
-// navigate(true);
-// }
-// };
-// CompareUIPlugin.init(a, TextMergeViewer.class, getBundle(), "action.NextDiff.");
-// fNextItem= new ActionContributionItem(a);
-// //tbm.appendToGroup("navigation", fNextItem);
-// tbm.add(fNextItem);
-//
-// a= new Action() {
-// public void actionPerformed() {
-// navigate(false);
-// }
-// };
-// CompareUIPlugin.init(a, TextMergeViewer.class, getBundle(), "action.PrevDiff.");
-// fPreviousItem= new ActionContributionItem(a);
-// //tbm.appendToGroup("navigation", fPreviousItem);
-// tbm.add(fPreviousItem);
-// }
-
/**
* Updates the headers of the three areas
* by querying the content provider for a name and image for
@@ -865,8 +793,6 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
fRightLabel.setImage(content.getRightImage(input));
fRightLabel.setText(content.getRightLabel(input));
}
-
- updateDirectionLabel();
}
private Image loadImage(String name) {
@@ -875,37 +801,7 @@ public abstract class ContentMergeViewer extends ContentViewer implements IPrope
return id.createImage();
return null;
}
-
- private void updateDirectionLabel() {
-// if (fDirectionLabel != null) {
-// Image image= null;
-//
-// //if (fMergePolicy.hasMergeDirection()) {
-// boolean y= fCompareConfiguration.isLeftEditable();
-// boolean m= fCompareConfiguration.isRightEditable();
-//
-// if (y && m) {
-// if (fBothArrow == null)
-// fBothArrow= loadImage("images/both.gif");
-// image= fBothArrow;
-// } else if (y) {
-// if (fLeftArrow == null)
-// fLeftArrow= loadImage("images/yours.gif");
-// image= fLeftArrow;
-// } else if (m) {
-// if (fRightArrow == null)
-// fRightArrow= loadImage("images/mine.gif");
-// image= fRightArrow;
-// }
-// //}
-//
-// if (image != null)
-// fDirectionLabel.setImage(image);
-// else
-// fDirectionLabel.setText("");
-// }
- }
-
+
/**
* Calculates the height of the header.
*/
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index 458c07d1e..97e12dffd 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -55,6 +55,7 @@ import org.eclipse.compare.internal.CompareUIPlugin;
import org.eclipse.compare.internal.MergeViewerAction;
import org.eclipse.compare.internal.INavigatable;
import org.eclipse.compare.internal.CompareNavigator;
+import org.eclipse.compare.internal.StoppableThread;
import org.eclipse.compare.rangedifferencer.RangeDifference;
import org.eclipse.compare.rangedifferencer.RangeDifferencer;
@@ -1100,32 +1101,23 @@ public class TextMergeViewer extends ContentMergeViewer {
}
}
- // perform the compare within TIMEOUT milli seconds
- RangeDifference[] e= null;
-
- final Object[] result= new Object[1];
final DocLineComparator sa= sancestor, sl= sleft, sr= sright;
- Thread t= new Thread() {
- public void run() {
- result[0]= RangeDifferencer.findRanges(sa, sl, sr);
+ StoppableThread t= new StoppableThread() {
+ public Object doRun() {
+ return RangeDifferencer.findRanges(sa, sl, sr);
}
};
- t.start();
- try {
- t.join(TIMEOUT);
- e= (RangeDifference[]) result[0];
- } catch(InterruptedException ex) {
- }
- t.stop();
+ RangeDifference[] e= (RangeDifference[]) t.getResult(TIMEOUT);
if (e == null) {
+ // timeout
ResourceBundle bundle= getResourceBundle();
String title= Utilities.getString(bundle, "tooComplexError.title"); //$NON-NLS-1$
String format= Utilities.getString(bundle, "tooComplexError.format"); //$NON-NLS-1$
String msg= MessageFormat.format(format, new Object[] { Integer.toString(TIMEOUT/1000) } );
MessageDialog.openError(fComposite.getShell(), title, msg);
- // timeout: we create a NOCHANGE range for the whole document
+ // we create a NOCHANGE range for the whole document
Diff diff= new Diff(null, RangeDifference.NOCHANGE,
aDoc, 0, aDoc != null ? aDoc.getLength() : 0,
lDoc, 0, lDoc.getLength(),
@@ -1390,83 +1382,6 @@ public class TextMergeViewer extends ContentMergeViewer {
((Action)fCopyDiffLeftToRightItem.getAction()).setEnabled(leftToRight);
if (fCopyDiffRightToLeftItem != null)
((Action)fCopyDiffRightToLeftItem.getAction()).setEnabled(rightToLeft);
-//
-// int fAutoResolve= 0;
-// int fUnresolvedDiffs= 0;
-// if (fChangeDiffs != null) {
-// fUnresolvedDiffs= fChangeDiffs.size();
-// if (fUnresolvedDiffs > 0) {
-// Iterator e= fChangeDiffs.iterator();
-// while (e.hasNext()) {
-// Diff diff= (Diff) e.next();
-// if (diff.isResolved()) {
-// fUnresolvedDiffs--;
-// } else {
-// if (diff.fDirection == RangeDifference.RIGHT || diff.fDirection == RangeDifference.LEFT) {
-// fAutoResolve++;
-// }
-// }
-// }
-// }
-// }
-//
-// boolean acceptReject= false;
-// boolean both= false;
-//
-// String s= "";
-//
-// if (fCurrentDiff != null) {
-// if (fCurrentDiff.isResolved()) {
-// s= "resolved";
-// } else {
-// s= "unresolved";
-//
-// IMergeViewerContentProvider twr= getContentProvider();
-// Object input= getInput();
-// boolean rightEditable= twr.isRightEditable(input);
-// boolean leftEditable= twr.isLeftEditable(input);
-//
-// switch (fCurrentDiff.fDirection) {
-// case RangeDifference.RIGHT: // outgoing
-// if (rightEditable)
-// acceptReject= true;
-// break;
-// case RangeDifference.LEFT: // incoming
-// if (leftEditable)
-// acceptReject= true;
-// break;
-// case RangeDifference.CONFLICT:
-// if (rightEditable) {
-// acceptReject= true;
-// both= true;
-// }
-// break;
-// }
-// }
-// } else {
-// if (fUnresolvedDiffs <= 0)
-// s= "allresolved";
-// else
-// s= "same";
-// }
-//
-// getAction(fTakeLeftActionItem).setEnabled(acceptReject);
-// getAction(fRejectItem).setEnabled(acceptReject);
-// if (fBothItem != null)
-// getAction(fBothItem).setEnabled(both);
-// if (fAutoItem != null)
-// getAction(fAutoItem).setEnabled(fAutoResolve > 0);
-//
-// if (s.length() > 0)
-// s= getBundle().getString("status." + s);
-//
-// ApplicationWindow b= getApplicationWindow();
-// if (b != null) {
-// String format= fBundle.getString(fUnresolvedDiffs > 0
-// ? "status.unresolvedformat"
-// : "status.resolvedformat");
-// b.setStatus(MessageFormat.format(format, new String[] { s, "" + fUnresolvedDiffs } ));
-// }
}
@@ -1474,15 +1389,6 @@ public class TextMergeViewer extends ContentMergeViewer {
super.updateHeader();
- IMergeViewerContentProvider content= getMergeContentProvider();
- Object input= getInput();
- boolean m= content.isRightEditable(input);
- boolean y= content.isLeftEditable(input);
-
- CompareConfiguration mp= getCompareConfiguration();
- //fLeft.setEditable(y && mp.isLeftEditable());
- //fRight.setEditable(m && mp.isRightEditable());
-
updateControls();
}
@@ -1492,38 +1398,6 @@ public class TextMergeViewer extends ContentMergeViewer {
*/
protected void createToolItems(ToolBarManager tbm) {
-// if (USE_MORE_CONTROLS) {
-// fBothItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptBoth.") {
-// public void actionPerformed(Window w) {
-// accept(fCurrentDiff, true, false);
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fBothItem);
-//
-// fAutoItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptAll.") {
-// public void actionPerformed(Window w) {
-// autoResolve();
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fAutoItem);
-// }
-// fRejectItem= new ActionContributionItem(
-// new Action(fBundle, "action.AcceptIgnoreNow.") {
-// public void actionPerformed(Window w) {
-// reject(fCurrentDiff, true);
-// }
-// }
-// );
-// tbm.appendToGroup("merge", fRejectItem);
-//
-// Action a= new ChangePropertyAction(getResourceBundle(), getCompareConfiguration(), "action.SynchMode.", SYNC_SCROLLING);
-// a.setChecked(fSynchronizedScrolling);
-// tbm.appendToGroup("modes", a);
-
tbm.add(new Separator());
Action a= new Action() {
@@ -1593,19 +1467,12 @@ public class TextMergeViewer extends ContentMergeViewer {
updateFont(ps, fComposite);
invalidateLines();
}
-
-// } else if (key.equals(SYNC_SCROLLING)) {
-//
-// boolean b= Utilities.getBoolean(getCompareConfiguration(), SYNC_SCROLLING, true);
-// if (b != fSynchronizedScrolling)
-// toggleSynchMode();
-
+
} else if (key.equals(ComparePreferencePage.SYNCHRONIZE_SCROLLING)) {
IPreferenceStore ps= CompareUIPlugin.getDefault().getPreferenceStore();
boolean b= ps.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
- //boolean b= Utilities.getBoolean(getCompareConfiguration(), SYNC_SCROLLING, true);
if (b != fSynchronizedScrolling)
toggleSynchMode();
@@ -1635,40 +1502,9 @@ public class TextMergeViewer extends ContentMergeViewer {
fLeft.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
fRight.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
- // recreates central control (Sash or Canvas)
- //handleResize();
fComposite.layout(true);
}
-
- protected void updateToolItems() {
- boolean visible= false;
- Object input= getInput();
- if (input != null) {
- visible= true;
-
- IMergeViewerContentProvider content= getMergeContentProvider();
-
- //boolean y= getMergePolicy().isLeftEditable();
- //boolean m= getMergePolicy().isRightEditable();
-
- //destinationEditable= content.isRightEditable(getInput());
- //destinationEditable= content.isLeftEditable(getInput());
- /*
- if (USE_MORE_CONTROLS) {
- fBothItem.setVisible(destinationEditable);
- fAutoItem.setVisible(destinationEditable);
- }
- fRejectItem.setVisible(destinationEditable);
- */
- }
-
- //fNextItem.setVisible(visible);
- //fPreviousItem.setVisible(visible);
-
- super.updateToolItems();
- }
-
//---- painting lines
/**
@@ -2214,14 +2050,7 @@ public class TextMergeViewer extends ContentMergeViewer {
private void copyDiffRightToLeft() {
copy(fCurrentDiff, false, false, false);
}
-
-// private void accept(Diff diff, boolean both, boolean gotoNext) {
-// if (getCompareConfiguration().isRightEditable())
-// copy(diff, true, both, gotoNext);
-// else if (getCompareConfiguration().isLeftEditable())
-// copy(diff, false, both, gotoNext);
-// }
-
+
private void copy(Diff diff, boolean leftToRight, boolean both, boolean gotoNext) {
if (diff != null && !diff.isResolved()) {
@@ -2290,65 +2119,6 @@ public class TextMergeViewer extends ContentMergeViewer {
}
}
- /**
- */
-// private void reject(Diff diff, boolean gotoNext) {
-//
-// if (diff != null && !diff.isResolved()) {
-//
-// switch (diff.fDirection) {
-// case RangeDifference.RIGHT:
-// setRightDirty(true); // mark dirty to force save!
-// break;
-// case RangeDifference.LEFT:
-// setLeftDirty(true); // mark dirty to force save!
-// break;
-// case RangeDifference.ANCESTOR:
-// break;
-// case RangeDifference.CONFLICT:
-// setLeftDirty(true); // mark dirty to force save!
-// setRightDirty(true); // mark dirty to force save!
-// break;
-// }
-//
-// diff.setResolved(true);
-//
-// if (gotoNext) {
-// navigate(true/*, true*/);
-// } else {
-// revealDiff(diff, true);
-// updateControls();
-// }
-// }
-// }
-
-
-// private void autoResolve() {
-// fCurrentDiff= null;
-// Diff firstConflict= null;
-//
-// Iterator e= fChangeDiffs.iterator();
-// for (int i= 0; e.hasNext(); i++) {
-// Diff diff= (Diff) e.next();
-// if (!diff.isResolved()) {
-// switch (diff.fDirection) {
-// case RangeDifference.RIGHT: // outgoing
-// case RangeDifference.LEFT: // incoming
-// accept(diff, false, false);
-// break;
-// case RangeDifference.CONFLICT: // incoming
-// if (firstConflict == null)
-// firstConflict= diff;
-// break;
-// }
-// }
-// }
-//
-// if (firstConflict == null)
-// firstConflict= (Diff) fChangeDiffs.get(0);
-// setCurrentDiff(firstConflict, true);
-// }
-
//---- scrolling
/**
@@ -2511,17 +2281,14 @@ public class TextMergeViewer extends ContentMergeViewer {
private void updateVScrollBar() {
if (Utilities.okToUse(fVScrollBar) && fSynchronizedScrolling) {
-// int selection= fVScrollBar.getSelection();
int virtualHeight= getVirtualHeight();
int viewPortHeight= getViewportHeight();
int pageIncrement= viewPortHeight-1;
int thumb= (viewPortHeight > virtualHeight) ? virtualHeight : viewPortHeight;
fVScrollBar.setPageIncrement(pageIncrement);
- fVScrollBar.setMaximum(virtualHeight); // XXX: sometimes the last line isn't visible
+ fVScrollBar.setMaximum(virtualHeight);
fVScrollBar.setThumb(thumb);
-
- //fVScrollBar.setValues(selection, 0, virtualHeight, thumb, 1, pageIncrement);
}
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
index ec0bc6d97..b585315cc 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.properties
@@ -9,8 +9,6 @@
title= Replace from Local History
-mode= replace
-
treeTitleFormat= Local History of ''{0}''
dateIcon= obj16/day_obj.gif
timeIcon= obj16/resource_obj.gif
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/StoppableThread.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/StoppableThread.java
new file mode 100644
index 000000000..cf8f81f48
--- /dev/null
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/StoppableThread.java
@@ -0,0 +1,50 @@
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+package org.eclipse.compare.internal;
+
+/**
+ * Run a (cooperative) piece of code under timeout control.
+ */
+public abstract class StoppableThread extends Thread {
+
+ boolean fStopped= false;
+ Object fResult= null;
+
+ private synchronized boolean isStopped2() {
+ return fStopped;
+ }
+
+ public void run() {
+ fResult= doRun();
+ }
+
+ private synchronized void setStopped() {
+ fStopped= true;
+ }
+
+ abstract public Object doRun();
+
+ public synchronized Object getResult(int timeout) {
+
+ start();
+ try {
+ join(timeout);
+ } catch(InterruptedException ex) {
+ fResult= null;
+ }
+ setStopped();
+ return fResult;
+ }
+
+ public static boolean isStopped() {
+ Thread t= Thread.currentThread();
+ if (t instanceof StoppableThread) {
+ StoppableThread st= (StoppableThread) t;
+ return st.isStopped2();
+ }
+ return false;
+ }
+}
+
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
index 0bbd686f6..17a3a7e5e 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeDifferencer.java
@@ -9,6 +9,8 @@ import java.util.List;
import org.eclipse.jface.util.Assert;
+import org.eclipse.compare.internal.StoppableThread;
+
/**
* For finding the differences between two or three <code>IRangeComparator</code>s.
* <p>
@@ -84,13 +86,16 @@ public final class RangeDifferencer {
// for each value of the edit distance
for (int d= 1; d <= maxDiagonal; ++d) { // d is the current edit distance
-
+
if (right.skipRangeComparison(d, maxDiagonal, left))
return EMPTY_RESULT; // should be something we already found
// for each relevant diagonal (-d, -d+2 ..., d-2, d)
for (int k= lower; k <= upper; k += 2) { // k is the current diagonal
LinkedRangeDifference edit;
+
+ if (StoppableThread.isStopped())
+ return EMPTY_RESULT;
if (k == origin - d || k != origin + d && lastDiagonal[k + 1] >= lastDiagonal[k - 1]) {
//

Back to the top