Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2002-01-25 11:44:12 +0000
committerAndre Weinand2002-01-25 11:44:12 +0000
commit05864ccf18ec80a817b279606d9085c8c0091d0f (patch)
tree5f97736378e81053f4add6245d4715a3b643ae1f
parent339c579161e8541c1f4f117a3f92698c463ccdbc (diff)
downloadeclipse.platform.team-05864ccf18ec80a817b279606d9085c8c0091d0f.tar.gz
eclipse.platform.team-05864ccf18ec80a817b279606d9085c8c0091d0f.tar.xz
eclipse.platform.team-05864ccf18ec80a817b279606d9085c8c0091d0f.zip
#6271, #2519, #8363, #2501
-rw-r--r--bundles/org.eclipse.compare/buildnotes_compare.html28
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java78
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java23
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java11
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties6
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html28
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java78
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java23
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java11
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties6
14 files changed, 258 insertions, 42 deletions
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
index e402bd077..6a0fe18f6 100644
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/buildnotes_compare.html
@@ -11,6 +11,34 @@
<h1>
Eclipse Platform Build Notes<br>
Compare</h1>
+Eclipse Build Input January ??th 2002
+
+<h2>
+What's new in this drop</h2>
+
+<h3>
+API changes</h3>
+
+<h3>
+API Additions</h3>
+
+<h3>
+Other highlights</h3>
+
+<h2>
+Known deficiencies</h2>
+
+<h2>
+Problem reports fixed</h2>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6271">#6271</a>: Can't tell which file is which in Compare browser<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2519">#2519</a>: next/prev arrows active when only one difference in compare (1GFIQX3)<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8363">#8363</a>: NPE comparing two resources in the navigator.<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2501">#2501</a>: Empty menu in compare browser (1GFBQKE)<br>
+
+<h2>
+Problem reports closed</h2>
+
+<hr WIDTH="100%"></h1>
Eclipse Build Input January 23th 2002
<h2>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index 4d2d60bbd..8720f025f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -455,7 +455,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
BusyIndicator.showWhile(fComposite.getDisplay(),
new Runnable() {
public void run() {
- if (selection.isEmpty()) {
+ if (selection == null || selection.isEmpty()) {
Object input= fStructureInputPane.getInput();
fContentInputPane.setInput(input);
fStructurePane2.setInput(null); // clear downstream pane
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 4c755f2cc..5b294c778 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
@@ -433,7 +433,7 @@ public class EditionSelectionDialog extends Dialog {
private Pair createPair(IStructureCreator sc, Object path, ITypedElement input) {
IStructureComparator scmp= sc.locate(path, input);
- if (scmp == null && sc.getStructure(input) == null) { // parse error
+ if (scmp == null && sc.getStructure(input) == null) { // parse error
Pair p= new Pair(sc, input);
p.fHasError= true;
return p;
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 b9e0c8bfd..a0f6077d6 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
@@ -122,7 +122,6 @@ public class TextMergeViewer extends ContentMergeViewer {
IWorkbenchActionConstants.PASTE,
IWorkbenchActionConstants.DELETE,
IWorkbenchActionConstants.SELECT_ALL,
- //IWorkbenchActionConstants.SAVE
};
private static final String[] TEXT_ACTIONS= {
MergeSourceViewer.UNDO_ID,
@@ -132,7 +131,6 @@ public class TextMergeViewer extends ContentMergeViewer {
MergeSourceViewer.PASTE_ID,
MergeSourceViewer.DELETE_ID,
MergeSourceViewer.SELECT_ALL_ID,
- //MergeSourceViewer.SAVE_ID
};
private static final String MY_UPDATER= "my_updater"; //$NON-NLS-1$
@@ -162,6 +160,8 @@ public class TextMergeViewer extends ContentMergeViewer {
// determines whether a change between left and right is considered incoming or outgoing
private boolean fLeftIsLocal;
+ private boolean fShowCurrentOnly= false;
+ private boolean fShowCurrentOnly2= false;
private int fMarginWidth= MARGIN_WIDTH;
private int fTopInset;
@@ -181,6 +181,21 @@ public class TextMergeViewer extends ContentMergeViewer {
private static final RGB SELECTED_OUTGOING= new RGB(0, 0, 0);
private static final RGB SELECTED_OUTGOING_FILL= new RGB(255, 255, 255);
+// private static final RGB INCOMING= new RGB(230, 230, 240);
+// private static final RGB INCOMING_FILL= new RGB(250, 250, 255);
+// private static final RGB SELECTED_INCOMING= new RGB(0, 0, 255);
+// private static final RGB SELECTED_INCOMING_FILL= new RGB(255, 255, 255);
+//
+// private static final RGB CONFLICT= new RGB(240, 230, 230);
+// private static final RGB CONFLICT_FILL= new RGB(255, 250, 250);
+// private static final RGB SELECTED_CONFLICT= new RGB(255, 0, 0);
+// private static final RGB SELECTED_CONFLICT_FILL= new RGB(255, 255, 255);
+//
+// private static final RGB OUTGOING= new RGB(230, 230, 230);
+// private static final RGB OUTGOING_FILL= new RGB(250, 250, 250);
+// private static final RGB SELECTED_OUTGOING= new RGB(0, 0, 0);
+// private static final RGB SELECTED_OUTGOING_FILL= new RGB(255, 255, 255);
+
private IDocumentListener fDocumentListener;
private IPropertyChangeListener fPreferenceChangeListener;
@@ -787,14 +802,26 @@ public class TextMergeViewer extends ContentMergeViewer {
invalidateLines();
updateVScrollBar();
- if (!emptyInput)
- selectFirstDiff();
+ if (!emptyInput && !fComposite.isDisposed()) {
+ // delay so that StyledText widget gets a chance to resize itself
+ // (otherwise selectFirstDiff would not know its visible area)
+ fComposite.getDisplay().asyncExec(
+ new Runnable() {
+ public void run() {
+ selectFirstDiff();
+ }
+ }
+ );
+ }
}
private void updateDiffBackground(Diff diff) {
if (diff == null || diff.fIsToken)
return;
+
+ if (fShowCurrentOnly && !isCurrentDiff(diff))
+ return;
Color c= getColor(getFillColor(diff));
if (c == null)
@@ -818,6 +845,16 @@ public class TextMergeViewer extends ContentMergeViewer {
}
}
+ boolean isCurrentDiff(Diff diff) {
+ if (diff == null)
+ return false;
+ if (diff == fCurrentDiff)
+ return true;
+ if (fCurrentDiff != null && fCurrentDiff.fParent == diff)
+ return true;
+ return false;
+ }
+
/**
* Called whenver one of the documents changes.
* Sets the dirty state of this viewer and updates the lines.
@@ -1489,7 +1526,24 @@ public class TextMergeViewer extends ContentMergeViewer {
if (fCopyDiffRightToLeftItem != null)
((Action)fCopyDiffRightToLeftItem.getAction()).setEnabled(rightToLeft);
-
+ boolean enableNavigation= false;
+ if (fCurrentDiff == null && fChangeDiffs != null && fChangeDiffs.size() > 0)
+ enableNavigation= true;
+ else if (fChangeDiffs != null && fChangeDiffs.size() > 1)
+ enableNavigation= true;
+ else if (fCurrentDiff != null && fCurrentDiff.fDiffs != null)
+ enableNavigation= true;
+ else if (fCurrentDiff != null && fCurrentDiff.fIsToken)
+ enableNavigation= true;
+
+ if (fNextItem != null) {
+ IAction a= fNextItem.getAction();
+ a.setEnabled(enableNavigation);
+ }
+ if (fPreviousItem != null) {
+ IAction a= fPreviousItem.getAction();
+ a.setEnabled(enableNavigation);
+ }
}
private void updateStatus(Diff diff) {
@@ -1610,6 +1664,7 @@ public class TextMergeViewer extends ContentMergeViewer {
doDiff();
+ updateControls();
invalidateLines();
updateVScrollBar();
@@ -1658,7 +1713,7 @@ public class TextMergeViewer extends ContentMergeViewer {
if (CompareNavigator.getDirection(fComposite))
firstDiff= findNext(fRight, fChangeDiffs, -1, -1, false);
else
- firstDiff= findPrev(fRight, fChangeDiffs, 9999999, 9999999, false);
+ firstDiff= findPrev(fRight, fChangeDiffs, 9999999, 9999999, false);
setCurrentDiff(firstDiff, true);
}
@@ -1784,6 +1839,9 @@ public class TextMergeViewer extends ContentMergeViewer {
if (diff.isDeleted())
continue;
+ if (fShowCurrentOnly2 && !isCurrentDiff(diff))
+ continue;
+
fLeft.getLineRange(diff.fLeftPos, region);
int ly= (region.x * lineHeight) + lshift;
int lh= region.y * lineHeight;
@@ -1842,6 +1900,9 @@ public class TextMergeViewer extends ContentMergeViewer {
if (diff.isDeleted())
continue;
+ if (fShowCurrentOnly2 && !isCurrentDiff(diff))
+ continue;
+
tp.getLineRange(diff.getPosition(tp), region);
int y= (region.x * lineHeight) + shift;
int h= region.y * lineHeight;
@@ -1895,6 +1956,9 @@ public class TextMergeViewer extends ContentMergeViewer {
if (diff.isDeleted())
continue;
+ if (fShowCurrentOnly && !isCurrentDiff(diff))
+ continue;
+
tp.getLineRange(diff.getPosition(tp), range);
int y= (range.x * lineHeight) + shift;
int h= range.y * lineHeight;
@@ -1903,7 +1967,7 @@ public class TextMergeViewer extends ContentMergeViewer {
continue;
if (y > maxh)
break;
-
+
g.setBackground(getColor(getStrokeColor(diff)));
g.fillRectangle(0, y-1, w, LW);
g.fillRectangle(0, y+h-1, w, LW);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
index 69a2095e0..3f22f168c 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
@@ -144,20 +144,21 @@ class ResourceCompareInput extends CompareEditorInput {
pm.beginTask(Utilities.getString("ResourceCompare.taskName"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- String leftLabel= fLeftResource.getName();
- cc.setLeftLabel(leftLabel);
+ cc.setLeftLabel(buildLabel(fLeftResource));
cc.setLeftImage(CompareUIPlugin.getImage(fLeftResource));
- String rightLabel= fRightResource.getName();
- cc.setRightLabel(rightLabel);
+ cc.setRightLabel(buildLabel(fRightResource));
cc.setRightImage(CompareUIPlugin.getImage(fRightResource));
+
+ String leftLabel= fLeftResource.getName();
+ String rightLabel= fRightResource.getName();
String title;
if (fThreeWay) {
- String ancestorLabel= fAncestorResource.getName();
- cc.setAncestorLabel(ancestorLabel);
+ cc.setAncestorLabel(buildLabel(fAncestorResource));
cc.setAncestorImage(CompareUIPlugin.getImage(fAncestorResource));
String format= Utilities.getString("ResourceCompare.threeWay.title"); //$NON-NLS-1$
+ String ancestorLabel= fAncestorResource.getName();
title= MessageFormat.format(format, new String[] {ancestorLabel, leftLabel, rightLabel} );
} else {
String format= Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$
@@ -180,7 +181,15 @@ class ResourceCompareInput extends CompareEditorInput {
pm.done();
}
}
-
+
+ private String buildLabel(IResource r) {
+ //return r.getName();
+ String n= r.getFullPath().toString();
+ if (n.charAt(0) == IPath.SEPARATOR)
+ return n.substring(1);
+ return n;
+ }
+
public void saveChanges(IProgressMonitor pm) throws CoreException {
super.saveChanges(pm);
if (fRoot instanceof DiffNode) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
index 6b0405b15..1d715916a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
@@ -144,6 +144,7 @@ public class DiffTreeViewer extends TreeViewer {
private Action fCopyRightToLeftAction;
private Action fNextAction;
private Action fPreviousAction;
+ private Action fEmptyMenuAction;
/**
* Creates a new viewer for the given SWT tree control with the specified configuration.
@@ -246,6 +247,14 @@ public class DiffTreeViewer extends TreeViewer {
new IMenuListener() {
public void menuAboutToShow(IMenuManager mm) {
fillContextMenu(mm);
+ if (mm.isEmpty()) {
+ if (fEmptyMenuAction == null) {
+ fEmptyMenuAction=
+ new Action(Utilities.getString(fBundle, "emptyMenuItem")) {}; //$NON-NLS-1$
+ fEmptyMenuAction.setEnabled(false);
+ }
+ mm.add(fEmptyMenuAction);
+ }
}
}
);
@@ -361,7 +370,7 @@ public class DiffTreeViewer extends TreeViewer {
// };
// Utilities.initAction(fCopyLeftToRightAction, fBundle, "action.TakeLeft.");
// toolbarManager.appendToGroup("merge", fCopyLeftToRightAction);
-//
+
// fCopyRightToLeftAction= new Action() {
// public void run() {
// copySelected(false);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
index 5c6c17952..9a91be426 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
@@ -11,12 +11,10 @@ title= Structure Compare
defaultLabel= <no name>
#####################################################
-# Status messages
+# Dummy menu item for empty context menu
#####################################################
-#####################################################
-# Dialogs
-#####################################################
+emptyMenuItem= <Empty Menu>
#####################################################
# Actions
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 e402bd077..6a0fe18f6 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
@@ -11,6 +11,34 @@
<h1>
Eclipse Platform Build Notes<br>
Compare</h1>
+Eclipse Build Input January ??th 2002
+
+<h2>
+What's new in this drop</h2>
+
+<h3>
+API changes</h3>
+
+<h3>
+API Additions</h3>
+
+<h3>
+Other highlights</h3>
+
+<h2>
+Known deficiencies</h2>
+
+<h2>
+Problem reports fixed</h2>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6271">#6271</a>: Can't tell which file is which in Compare browser<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2519">#2519</a>: next/prev arrows active when only one difference in compare (1GFIQX3)<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8363">#8363</a>: NPE comparing two resources in the navigator.<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=2501">#2501</a>: Empty menu in compare browser (1GFBQKE)<br>
+
+<h2>
+Problem reports closed</h2>
+
+<hr WIDTH="100%"></h1>
Eclipse Build Input January 23th 2002
<h2>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index 4d2d60bbd..8720f025f 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -455,7 +455,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
BusyIndicator.showWhile(fComposite.getDisplay(),
new Runnable() {
public void run() {
- if (selection.isEmpty()) {
+ if (selection == null || selection.isEmpty()) {
Object input= fStructureInputPane.getInput();
fContentInputPane.setInput(input);
fStructurePane2.setInput(null); // clear downstream pane
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 4c755f2cc..5b294c778 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
@@ -433,7 +433,7 @@ public class EditionSelectionDialog extends Dialog {
private Pair createPair(IStructureCreator sc, Object path, ITypedElement input) {
IStructureComparator scmp= sc.locate(path, input);
- if (scmp == null && sc.getStructure(input) == null) { // parse error
+ if (scmp == null && sc.getStructure(input) == null) { // parse error
Pair p= new Pair(sc, input);
p.fHasError= true;
return p;
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 b9e0c8bfd..a0f6077d6 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
@@ -122,7 +122,6 @@ public class TextMergeViewer extends ContentMergeViewer {
IWorkbenchActionConstants.PASTE,
IWorkbenchActionConstants.DELETE,
IWorkbenchActionConstants.SELECT_ALL,
- //IWorkbenchActionConstants.SAVE
};
private static final String[] TEXT_ACTIONS= {
MergeSourceViewer.UNDO_ID,
@@ -132,7 +131,6 @@ public class TextMergeViewer extends ContentMergeViewer {
MergeSourceViewer.PASTE_ID,
MergeSourceViewer.DELETE_ID,
MergeSourceViewer.SELECT_ALL_ID,
- //MergeSourceViewer.SAVE_ID
};
private static final String MY_UPDATER= "my_updater"; //$NON-NLS-1$
@@ -162,6 +160,8 @@ public class TextMergeViewer extends ContentMergeViewer {
// determines whether a change between left and right is considered incoming or outgoing
private boolean fLeftIsLocal;
+ private boolean fShowCurrentOnly= false;
+ private boolean fShowCurrentOnly2= false;
private int fMarginWidth= MARGIN_WIDTH;
private int fTopInset;
@@ -181,6 +181,21 @@ public class TextMergeViewer extends ContentMergeViewer {
private static final RGB SELECTED_OUTGOING= new RGB(0, 0, 0);
private static final RGB SELECTED_OUTGOING_FILL= new RGB(255, 255, 255);
+// private static final RGB INCOMING= new RGB(230, 230, 240);
+// private static final RGB INCOMING_FILL= new RGB(250, 250, 255);
+// private static final RGB SELECTED_INCOMING= new RGB(0, 0, 255);
+// private static final RGB SELECTED_INCOMING_FILL= new RGB(255, 255, 255);
+//
+// private static final RGB CONFLICT= new RGB(240, 230, 230);
+// private static final RGB CONFLICT_FILL= new RGB(255, 250, 250);
+// private static final RGB SELECTED_CONFLICT= new RGB(255, 0, 0);
+// private static final RGB SELECTED_CONFLICT_FILL= new RGB(255, 255, 255);
+//
+// private static final RGB OUTGOING= new RGB(230, 230, 230);
+// private static final RGB OUTGOING_FILL= new RGB(250, 250, 250);
+// private static final RGB SELECTED_OUTGOING= new RGB(0, 0, 0);
+// private static final RGB SELECTED_OUTGOING_FILL= new RGB(255, 255, 255);
+
private IDocumentListener fDocumentListener;
private IPropertyChangeListener fPreferenceChangeListener;
@@ -787,14 +802,26 @@ public class TextMergeViewer extends ContentMergeViewer {
invalidateLines();
updateVScrollBar();
- if (!emptyInput)
- selectFirstDiff();
+ if (!emptyInput && !fComposite.isDisposed()) {
+ // delay so that StyledText widget gets a chance to resize itself
+ // (otherwise selectFirstDiff would not know its visible area)
+ fComposite.getDisplay().asyncExec(
+ new Runnable() {
+ public void run() {
+ selectFirstDiff();
+ }
+ }
+ );
+ }
}
private void updateDiffBackground(Diff diff) {
if (diff == null || diff.fIsToken)
return;
+
+ if (fShowCurrentOnly && !isCurrentDiff(diff))
+ return;
Color c= getColor(getFillColor(diff));
if (c == null)
@@ -818,6 +845,16 @@ public class TextMergeViewer extends ContentMergeViewer {
}
}
+ boolean isCurrentDiff(Diff diff) {
+ if (diff == null)
+ return false;
+ if (diff == fCurrentDiff)
+ return true;
+ if (fCurrentDiff != null && fCurrentDiff.fParent == diff)
+ return true;
+ return false;
+ }
+
/**
* Called whenver one of the documents changes.
* Sets the dirty state of this viewer and updates the lines.
@@ -1489,7 +1526,24 @@ public class TextMergeViewer extends ContentMergeViewer {
if (fCopyDiffRightToLeftItem != null)
((Action)fCopyDiffRightToLeftItem.getAction()).setEnabled(rightToLeft);
-
+ boolean enableNavigation= false;
+ if (fCurrentDiff == null && fChangeDiffs != null && fChangeDiffs.size() > 0)
+ enableNavigation= true;
+ else if (fChangeDiffs != null && fChangeDiffs.size() > 1)
+ enableNavigation= true;
+ else if (fCurrentDiff != null && fCurrentDiff.fDiffs != null)
+ enableNavigation= true;
+ else if (fCurrentDiff != null && fCurrentDiff.fIsToken)
+ enableNavigation= true;
+
+ if (fNextItem != null) {
+ IAction a= fNextItem.getAction();
+ a.setEnabled(enableNavigation);
+ }
+ if (fPreviousItem != null) {
+ IAction a= fPreviousItem.getAction();
+ a.setEnabled(enableNavigation);
+ }
}
private void updateStatus(Diff diff) {
@@ -1610,6 +1664,7 @@ public class TextMergeViewer extends ContentMergeViewer {
doDiff();
+ updateControls();
invalidateLines();
updateVScrollBar();
@@ -1658,7 +1713,7 @@ public class TextMergeViewer extends ContentMergeViewer {
if (CompareNavigator.getDirection(fComposite))
firstDiff= findNext(fRight, fChangeDiffs, -1, -1, false);
else
- firstDiff= findPrev(fRight, fChangeDiffs, 9999999, 9999999, false);
+ firstDiff= findPrev(fRight, fChangeDiffs, 9999999, 9999999, false);
setCurrentDiff(firstDiff, true);
}
@@ -1784,6 +1839,9 @@ public class TextMergeViewer extends ContentMergeViewer {
if (diff.isDeleted())
continue;
+ if (fShowCurrentOnly2 && !isCurrentDiff(diff))
+ continue;
+
fLeft.getLineRange(diff.fLeftPos, region);
int ly= (region.x * lineHeight) + lshift;
int lh= region.y * lineHeight;
@@ -1842,6 +1900,9 @@ public class TextMergeViewer extends ContentMergeViewer {
if (diff.isDeleted())
continue;
+ if (fShowCurrentOnly2 && !isCurrentDiff(diff))
+ continue;
+
tp.getLineRange(diff.getPosition(tp), region);
int y= (region.x * lineHeight) + shift;
int h= region.y * lineHeight;
@@ -1895,6 +1956,9 @@ public class TextMergeViewer extends ContentMergeViewer {
if (diff.isDeleted())
continue;
+ if (fShowCurrentOnly && !isCurrentDiff(diff))
+ continue;
+
tp.getLineRange(diff.getPosition(tp), range);
int y= (range.x * lineHeight) + shift;
int h= range.y * lineHeight;
@@ -1903,7 +1967,7 @@ public class TextMergeViewer extends ContentMergeViewer {
continue;
if (y > maxh)
break;
-
+
g.setBackground(getColor(getStrokeColor(diff)));
g.fillRectangle(0, y-1, w, LW);
g.fillRectangle(0, y+h-1, w, LW);
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
index 69a2095e0..3f22f168c 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
@@ -144,20 +144,21 @@ class ResourceCompareInput extends CompareEditorInput {
pm.beginTask(Utilities.getString("ResourceCompare.taskName"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- String leftLabel= fLeftResource.getName();
- cc.setLeftLabel(leftLabel);
+ cc.setLeftLabel(buildLabel(fLeftResource));
cc.setLeftImage(CompareUIPlugin.getImage(fLeftResource));
- String rightLabel= fRightResource.getName();
- cc.setRightLabel(rightLabel);
+ cc.setRightLabel(buildLabel(fRightResource));
cc.setRightImage(CompareUIPlugin.getImage(fRightResource));
+
+ String leftLabel= fLeftResource.getName();
+ String rightLabel= fRightResource.getName();
String title;
if (fThreeWay) {
- String ancestorLabel= fAncestorResource.getName();
- cc.setAncestorLabel(ancestorLabel);
+ cc.setAncestorLabel(buildLabel(fAncestorResource));
cc.setAncestorImage(CompareUIPlugin.getImage(fAncestorResource));
String format= Utilities.getString("ResourceCompare.threeWay.title"); //$NON-NLS-1$
+ String ancestorLabel= fAncestorResource.getName();
title= MessageFormat.format(format, new String[] {ancestorLabel, leftLabel, rightLabel} );
} else {
String format= Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$
@@ -180,7 +181,15 @@ class ResourceCompareInput extends CompareEditorInput {
pm.done();
}
}
-
+
+ private String buildLabel(IResource r) {
+ //return r.getName();
+ String n= r.getFullPath().toString();
+ if (n.charAt(0) == IPath.SEPARATOR)
+ return n.substring(1);
+ return n;
+ }
+
public void saveChanges(IProgressMonitor pm) throws CoreException {
super.saveChanges(pm);
if (fRoot instanceof DiffNode) {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
index 6b0405b15..1d715916a 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
@@ -144,6 +144,7 @@ public class DiffTreeViewer extends TreeViewer {
private Action fCopyRightToLeftAction;
private Action fNextAction;
private Action fPreviousAction;
+ private Action fEmptyMenuAction;
/**
* Creates a new viewer for the given SWT tree control with the specified configuration.
@@ -246,6 +247,14 @@ public class DiffTreeViewer extends TreeViewer {
new IMenuListener() {
public void menuAboutToShow(IMenuManager mm) {
fillContextMenu(mm);
+ if (mm.isEmpty()) {
+ if (fEmptyMenuAction == null) {
+ fEmptyMenuAction=
+ new Action(Utilities.getString(fBundle, "emptyMenuItem")) {}; //$NON-NLS-1$
+ fEmptyMenuAction.setEnabled(false);
+ }
+ mm.add(fEmptyMenuAction);
+ }
}
}
);
@@ -361,7 +370,7 @@ public class DiffTreeViewer extends TreeViewer {
// };
// Utilities.initAction(fCopyLeftToRightAction, fBundle, "action.TakeLeft.");
// toolbarManager.appendToGroup("merge", fCopyLeftToRightAction);
-//
+
// fCopyRightToLeftAction= new Action() {
// public void run() {
// copySelected(false);
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
index 5c6c17952..9a91be426 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
@@ -11,12 +11,10 @@ title= Structure Compare
defaultLabel= <no name>
#####################################################
-# Status messages
+# Dummy menu item for empty context menu
#####################################################
-#####################################################
-# Dialogs
-#####################################################
+emptyMenuItem= <Empty Menu>
#####################################################
# Actions

Back to the top