Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewCompareConfiguration.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogContentProvider.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java56
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberPageDiffTreeViewerConfiguration.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java2
6 files changed, 141 insertions, 23 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewCompareConfiguration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewCompareConfiguration.java
index cf97ca897..617cd8aa0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewCompareConfiguration.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewCompareConfiguration.java
@@ -11,6 +11,7 @@
package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator;
@@ -20,6 +21,8 @@ import org.eclipse.team.ui.synchronize.views.SyncInfoLabelDecorator;
public class CVSSynchronizeViewCompareConfiguration extends TeamSubscriberPageDiffTreeViewerConfiguration {
+ private boolean isGroupIncomingByComment;
+
private static class CVSLabelDecorator extends LabelProvider implements ILabelDecorator {
public String decorateText(String input, Object element) {
String text = input;
@@ -50,6 +53,7 @@ public class CVSSynchronizeViewCompareConfiguration extends TeamSubscriberPageDi
public CVSSynchronizeViewCompareConfiguration(ISynchronizeView view, TeamSubscriberParticipant participant) {
super(view, participant);
+ participant.addPropertyChangeListener(this);
}
/* (non-Javadoc)
@@ -58,4 +62,42 @@ public class CVSSynchronizeViewCompareConfiguration extends TeamSubscriberPageDi
protected ILabelProvider getLabelProvider() {
return new DecoratingColorLabelProvider(new SyncInfoLabelDecorator(), new CVSLabelDecorator());
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.DiffTreeViewerConfiguration#getContentProvider()
+ */
+ protected IStructuredContentProvider getContentProvider() {
+ if(isGroupIncomingByComment() && getParticipant().getMode() == TeamSubscriberParticipant.INCOMING_MODE) {
+ return new ChangeLogContentProvider();
+ } else {
+ return super.getContentProvider();
+ }
+ }
+
+ public boolean isGroupIncomingByComment() {
+ return isGroupIncomingByComment;
+ }
+
+ public void setGroupIncomingByComment(boolean enabled) {
+ this.isGroupIncomingByComment = enabled;
+ if(getParticipant().getMode() == TeamSubscriberParticipant.INCOMING_MODE) {
+ getViewer().setContentProvider(getContentProvider());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.DiffTreeViewerConfiguration#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ if(property.equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_MODE)) {
+ int oldMode = ((Integer)event.getOldValue()).intValue();
+ int newMode = ((Integer)event.getNewValue()).intValue();
+ if(newMode == TeamSubscriberParticipant.INCOMING_MODE ||
+ oldMode == TeamSubscriberParticipant.INCOMING_MODE) {
+ getViewer().setContentProvider(getContentProvider());
+ }
+ }
+ super.propertyChange(event);
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java
index 4ae3f1896..2140f368f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java
@@ -14,17 +14,21 @@ import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.core.subscribers.*;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IActionDelegate;
public class CVSSynchronizeViewPage extends TeamSubscriberParticipantPage implements ISyncSetChangedListener {
private List delegates = new ArrayList(2);
+ private CVSSynchronizeViewCompareConfiguration config;
+ private Action groupByComment;
protected class CVSActionDelegate extends Action {
private IActionDelegate delegate;
@@ -50,6 +54,12 @@ public class CVSSynchronizeViewPage extends TeamSubscriberParticipantPage implem
public CVSSynchronizeViewPage(TeamSubscriberParticipant participant, ISynchronizeView view) {
super(participant, view);
+ groupByComment = new Action("Group By Comment", Action.AS_CHECK_BOX) {
+ public void run() {
+ config.setGroupIncomingByComment(!config.isGroupIncomingByComment());
+ setChecked(config.isGroupIncomingByComment());
+ }
+ };
}
/*
@@ -62,7 +72,16 @@ public class CVSSynchronizeViewPage extends TeamSubscriberParticipantPage implem
getSyncInfoSet().removeSyncSetChangedListener(this);
CVSUIPlugin.removePropertyChangeListener(this);
}
-
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.TeamSubscriberParticipantPage#setActionBars(org.eclipse.ui.IActionBars)
+ */
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ IMenuManager mgr = actionBars.getMenuManager();
+ mgr.appendToGroup("others", groupByComment);
+ }
+
/*
* (non-Javadoc)
*
@@ -116,6 +135,9 @@ public class CVSSynchronizeViewPage extends TeamSubscriberParticipantPage implem
* @see org.eclipse.team.ui.synchronize.TeamSubscriberParticipantPage#createSyncInfoSetCompareConfiguration()
*/
protected TeamSubscriberPageDiffTreeViewerConfiguration createSyncInfoSetCompareConfiguration() {
- return new CVSSynchronizeViewCompareConfiguration(getSynchronizeView(), getParticipant());
+ if(config == null) {
+ config = new CVSSynchronizeViewCompareConfiguration(getSynchronizeView(), getParticipant());
+ }
+ return config;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogContentProvider.java
index abf389605..2e7e087a6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogContentProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogContentProvider.java
@@ -17,10 +17,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
import org.eclipse.team.ui.synchronize.views.SyncInfoSetTreeContentProvider;
/**
@@ -29,26 +28,21 @@ import org.eclipse.team.ui.synchronize.views.SyncInfoSetTreeContentProvider;
public class ChangeLogContentProvider extends SyncInfoSetTreeContentProvider {
private Map commentRoots = new HashMap();
+// private SyncInfoSetContentProvider oldProvider;
+
+ public ChangeLogContentProvider() {
+// this.oldProvider = provider;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
public Object[] getChildren(Object element) {
IResource resource = getResource(element);
- if(element instanceof SyncInfoSet){
- // initialize case
- return calculateRoots();
- } else if(element instanceof ChangeLogDiffNode) {
- return ((ChangeLogDiffNode)element).getChildren();
+ if(element instanceof SyncInfoDiffNode && resource != null && resource.getType() == IResource.ROOT){
+ return calculateRoots(((SyncInfoDiffNode)element).getSyncInfoSet());
}
- return new Object[0];
+ return super.getChildren(element);
}
- /**
- * @return
- */
- private Object[] calculateRoots() {
- SyncInfoSet set = getSyncInfoSet();
+ private Object[] calculateRoots(SyncInfoSet set) {
SyncInfo[] infos = set.members();
commentRoots.clear();
for (int i = 0; i < infos.length; i++) {
@@ -58,15 +52,15 @@ public class ChangeLogContentProvider extends SyncInfoSetTreeContentProvider {
changeRoot = new ChangeLogDiffNode(comment);
commentRoots.put(comment, changeRoot);
}
- changeRoot.add(new SyncInfoDiffNode(infos[i]));
- }
+ changeRoot.addChild(infos[i]);
+ }
return (ChangeLogDiffNode[]) commentRoots.values().toArray(new ChangeLogDiffNode[commentRoots.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider#handleResourceAdditions(org.eclipse.team.ui.synchronize.ISyncInfoSetChangeEvent)
*/
- protected void handleResourceAdditions(ISyncInfoSetChangeEvent event) {
+ public void handleResourceAdditions(ISyncInfoSetChangeEvent event) {
AbstractTreeViewer tree = getTreeViewer();
if (tree != null) {
SyncInfo[] added = event.getAddedResources();
@@ -88,7 +82,7 @@ public class ChangeLogContentProvider extends SyncInfoSetTreeContentProvider {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.synchronize.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.ui.synchronize.ISyncInfoSetChangeEvent)
*/
- protected void handleResourceRemovals(ISyncInfoSetChangeEvent event) {
+ public void handleResourceRemovals(ISyncInfoSetChangeEvent event) {
AbstractTreeViewer tree = getTreeViewer();
if (tree != null) {
IResource[] roots = event.getRemovedResources();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java
index 7cfbc4976..9d0a928df 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java
@@ -11,15 +11,27 @@
package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.compare.structuremergeviewer.DiffNode;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.team.core.subscribers.MutableSyncInfoSet;
import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
+import org.eclipse.ui.model.IWorkbenchAdapter;
-public class ChangeLogDiffNode extends DiffNode {
+public class ChangeLogDiffNode extends DiffNode implements IAdaptable, IWorkbenchAdapter {
private String comment;
+ private MutableSyncInfoSet set;
+ private SyncInfoDiffNode node;
public ChangeLogDiffNode(String comment) {
super(SyncInfo.IN_SYNC);
this.comment = comment;
+ set = new MutableSyncInfoSet();
+ node = new SyncInfoDiffNode(set, ResourcesPlugin.getWorkspace().getRoot());
}
/**
@@ -34,4 +46,46 @@ public class ChangeLogDiffNode extends DiffNode {
if(! (other instanceof ChangeLogDiffNode)) return false;
return ((ChangeLogDiffNode)other).getComment().equals(getComment());
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
+ */
+ public Object[] getChildren(Object o) {
+ return node.getChildren(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
+ */
+ public ImageDescriptor getImageDescriptor(Object object) {
+ return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
+ */
+ public String getLabel(Object o) {
+ return comment;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
+ */
+ public Object getParent(Object o) {
+ return getParent();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if(adapter == IWorkbenchAdapter.class) {
+ return this;
+ }
+ return null;
+ }
+
+ public void addChild(SyncInfo info) {
+ set.add(info);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberPageDiffTreeViewerConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberPageDiffTreeViewerConfiguration.java
index 7f256a1a8..0f8a09b6d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberPageDiffTreeViewerConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberPageDiffTreeViewerConfiguration.java
@@ -37,6 +37,10 @@ public class TeamSubscriberPageDiffTreeViewerConfiguration extends DiffTreeViewe
this.participant = participant;
}
+ protected TeamSubscriberParticipant getParticipant() {
+ return participant;
+ }
+
protected void initializeActions(StructuredViewer treeViewer) {
super.initializeActions(treeViewer);
openWithActions = new OpenWithActionGroup(view, participant);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
index e203917b1..6d8c98fbd 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java
@@ -209,6 +209,8 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper
workingSetGroup.fillActionBars(actionBars);
menu.add(new Separator());
menu.add(new Separator());
+ menu.add(new Separator("others"));
+ menu.add(new Separator());
menu.add(configureSchedule);
menu.add(new Separator());
menu.add(showPreferences);

Back to the top