Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-06-04 15:55:57 -0400
committerJean Michel-Lemieux2004-06-04 15:55:57 -0400
commit65c10d6f3f460690999ef30d2f5cf7e1a1011859 (patch)
treeac88a49517957a436f396fc3c250453c1e9c4a9f
parent81855d91ee4ce37c407c5c5dcdc0725503c4b3b8 (diff)
downloadeclipse.platform.team-branch_20040603_comparewithpredecessor.tar.gz
eclipse.platform.team-branch_20040603_comparewithpredecessor.tar.xz
eclipse.platform.team-branch_20040603_comparewithpredecessor.zip
initial implementation of compare with predecessorbranch_20040603_comparewithpredecessor
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
index 32770bfa2..0af1285fd 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java
@@ -12,6 +12,7 @@ package org.eclipse.team.internal.ccvs.ui.subscriber;
import java.util.*;
+import org.eclipse.compare.CompareUI;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IResource;
@@ -131,6 +132,38 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
}
/* *****************************************************************************
+ * Action that allows comparing two remote resources (e.g. compare with predecessor)
+ */
+ private class CompareWithPredecessorAction extends Action {
+
+ protected CompareWithPredecessorAction() {
+ super("Compare with Predecessor");
+ }
+
+ public void run() {
+ StructuredViewer viewer = getViewer();
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ IDiffElement[] objects = Utils.getDiffNodes(((IStructuredSelection)viewer.getSelection()).toArray());
+ if(objects.length == 1 && objects[0] instanceof SyncInfoModelElement) {
+ SyncInfo info = ((SyncInfoModelElement)objects[0]).getSyncInfo();
+ ResourceEditionNode left = new ResourceEditionNode((ICVSRemoteResource) info.getBase());
+ ResourceEditionNode right = new ResourceEditionNode((ICVSRemoteResource) info.getRemote());
+ CompareUI.openCompareEditor(new CVSCompareEditorInput(left, right));
+ }
+ }
+ }
+
+ public boolean isEnabled() {
+ StructuredViewer viewer = getViewer();
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ IDiffElement[] objects = Utils.getDiffNodes(((IStructuredSelection)viewer.getSelection()).toArray());
+ return objects.length == 1 && objects[0] instanceof SyncInfoModelElement;
+ }
+ return false;
+ }
+ }
+
+ /* *****************************************************************************
* Action group for this layout. It is added and removed for this layout only.
*/
public class ChangeLogActionGroup extends SynchronizePageActionGroup {
@@ -149,6 +182,10 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
ISynchronizePageConfiguration.P_CONTEXT_MENU,
SORT_ORDER_GROUP,
sortByResource);
+ appendToGroup(
+ ISynchronizePageConfiguration.P_CONTEXT_MENU,
+ SORT_ORDER_GROUP,
+ new CompareWithPredecessorAction());
ChangeLogModelSorter sorter = (ChangeLogModelSorter)getViewerSorter();

Back to the top