Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-05-04 23:01:20 -0400
committerJean Michel-Lemieux2004-05-04 23:01:20 -0400
commit1fb103ef0d3336ea4d5eac144056badc3766761c (patch)
tree8e7affda028b234a5cabb391cf42c64566de17aa
parentfc674c6773f17e86ed890e74d14d0f0b6ad679c3 (diff)
downloadeclipse.platform.team-1fb103ef0d3336ea4d5eac144056badc3766761c.tar.gz
eclipse.platform.team-1fb103ef0d3336ea4d5eac144056badc3766761c.tar.xz
eclipse.platform.team-1fb103ef0d3336ea4d5eac144056badc3766761c.zip
Released model provider that supports grouping changes by comment. This
is currently disabled.
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java91
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java108
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java2
5 files changed, 165 insertions, 43 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java
index 75c5b6d53..999cf234e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java
@@ -29,7 +29,7 @@ public class RemoteLogOperation extends RepositoryLocationOperation {
private RLog rlog = new RLog();
private Map entries = new HashMap();
- protected RemoteLogOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResources) {
+ public RemoteLogOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResources) {
super(part, remoteResources);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java
index 09ed474c6..0da7eaaec 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java
@@ -11,7 +11,6 @@
package org.eclipse.team.internal.ccvs.ui.operations;
import java.util.*;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -29,7 +28,7 @@ public abstract class RepositoryLocationOperation extends RemoteOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
+ public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
Map table = getLocationMapping(getRemoteResources());
Set keySet = table.keySet();
monitor.beginTask(null, keySet.size() * 100);
@@ -37,7 +36,7 @@ public abstract class RepositoryLocationOperation extends RemoteOperation {
while (iterator.hasNext()) {
ICVSRepositoryLocation location = (ICVSRepositoryLocation)iterator.next();
List list = (List)table.get(location);
- ICVSRemoteResource[] remoteResources = (ICVSRemoteResource[])list.toArray(new IResource[list.size()]);
+ ICVSRemoteResource[] remoteResources = (ICVSRemoteResource[])list.toArray(new ICVSRemoteResource[list.size()]);
execute(location, remoteResources, Policy.subMonitorFor(monitor, 100));
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java
new file mode 100644
index 000000000..0fa4fd363
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelManager.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.team.core.synchronize.SyncInfoTree;
+import org.eclipse.team.internal.ui.IPreferenceIds;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+
+
+/**
+ * Manager for hierarchical models
+ */
+public class ChangeLogModelManager extends SynchronizeModelManager implements IPropertyChangeListener {
+
+ /**
+ * @param configuration
+ */
+ public ChangeLogModelManager(ISynchronizePageConfiguration configuration) {
+ super(configuration);
+ configuration.addPropertyChangeListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelManager#dispose()
+ */
+ public void dispose() {
+ getConfiguration().removePropertyChangeListener(this);
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelManager#getSupportedModelProviders()
+ */
+ protected ISynchronizeModelProviderDescriptor[] getSupportedModelProviders() {
+ return new ISynchronizeModelProviderDescriptor[] {
+ new HierarchicalModelProvider.HierarchicalModelProviderDescriptor(),
+ new CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor(),
+ new ChangeLogModelProvider.ChangeLogModelProviderDescriptor()};
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ui.synchronize.SynchronizeModelManager#createModelProvider(java.lang.String)
+ */
+ protected ISynchronizeModelProvider createModelProvider(String id) {
+ if(id == null) {
+ if (getShowCompressedFolders()) {
+ id = CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID;
+ } else {
+ id = HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
+ }
+ }
+ if(id.endsWith(CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID)) {
+ return new CompressedFoldersModelProvider(getSyncInfoSet());
+ } else if(id.endsWith(HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID)) {
+ return new HierarchicalModelProvider(getSyncInfoSet());
+ } else {
+ return new ChangeLogModelProvider(getSyncInfoSet());
+ }
+ }
+
+ private SyncInfoTree getSyncInfoSet() {
+ return (SyncInfoTree)getConfiguration().getProperty(ISynchronizePageConfiguration.P_SYNC_INFO_SET);
+ }
+
+ /**
+ * Return the state of the compressed folder setting.
+ *
+ * @return the state of the compressed folder setting.
+ */
+ private boolean getShowCompressedFolders() {
+ return TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ }
+} \ No newline at end of file
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 3a14c395a..722a62528 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
@@ -25,10 +25,12 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.*;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.TeamImages;
+import org.eclipse.team.ui.synchronize.ISynchronizeManager;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.ui.progress.UIJob;
@@ -101,10 +103,14 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
private SyncInfoSet set;
public FetchLogEntriesJob() {
super("Fetching CVS logs"); //$NON-NLS-1$;
+ setUser(true);
}
public void setSyncInfoSet(SyncInfoSet set) {
this.set = set;
}
+ public boolean belongsTo(Object family) {
+ return family == ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION;
+ }
public IStatus run(IProgressMonitor monitor) {
if (set != null && !shutdown) {
final ISynchronizeModelElement[] nodes = calculateRoots(getSyncInfoSet(), monitor);
@@ -123,15 +129,15 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
};
public static class ChangeLogModelProviderDescriptor implements ISynchronizeModelProviderDescriptor {
- public static final String ID = TeamUIPlugin.ID + ".modelprovider_hierarchical";
+ public static final String ID = TeamUIPlugin.ID + ".modelprovider_cvs_changelog";
public String getId() {
return ID;
}
public String getName() {
- return "Change Log";
+ return "Grouped By Comment (useful for browing incoming changes)";
}
public ImageDescriptor getImageDescriptor() {
- return TeamImages.getImageDescriptor(ISharedImages.IMG_IGNORE_WHITESPACE);
+ return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATE);
}
};
private static final ChangeLogModelProviderDescriptor descriptor = new ChangeLogModelProviderDescriptor();
@@ -170,58 +176,82 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
}
private ISynchronizeModelElement[] calculateRoots(SyncInfoSet set, IProgressMonitor monitor) {
- commentRoots.clear();
- SyncInfo[] infos = set.getSyncInfos();
- monitor.beginTask("fetching from server", set.size() * 100);
- for (int i = 0; i < infos.length; i++) {
- if(monitor.isCanceled()) {
- break;
- }
- ILogEntry logEntry = getSyncInfoComment((CVSSyncInfo) infos[i], monitor);
- if(logEntry != null) {
- DateComment dateComment = new DateComment(logEntry.getDate(), logEntry.getComment(), logEntry.getAuthor());
- ChangeLogDiffNode changeRoot = (ChangeLogDiffNode) commentRoots.get(dateComment);
- if (changeRoot == null) {
- changeRoot = new ChangeLogDiffNode(getModelRoot(), logEntry);
- commentRoots.put(dateComment, changeRoot);
+ try {
+ commentRoots.clear();
+ SyncInfo[] infos = set.getSyncInfos();
+ RemoteLogOperation logs = getSyncInfoComment(infos, monitor);
+ monitor.beginTask("fetching from server", set.size() * 100);
+ for (int i = 0; i < infos.length; i++) {
+ if(monitor.isCanceled()) {
+ break;
+ }
+ // TODO: handle outgoing additions that don't have log entries!!
+ ILogEntry logEntry = logs.getLogEntry(getRemoteResource((CVSSyncInfo)infos[i]));
+ if(logEntry != null) {
+ DateComment dateComment = new DateComment(logEntry.getDate(), logEntry.getComment(), logEntry.getAuthor());
+ ChangeLogDiffNode changeRoot = (ChangeLogDiffNode) commentRoots.get(dateComment);
+ if (changeRoot == null) {
+ changeRoot = new ChangeLogDiffNode(getModelRoot(), logEntry);
+ commentRoots.put(dateComment, changeRoot);
+ }
+ ISynchronizeModelElement element = new FullPathSyncInfoElement(changeRoot, infos[i]);
+ associateDiffNode(element);
}
- ISynchronizeModelElement element = new FullPathSyncInfoElement(changeRoot, infos[i]);
- associateDiffNode(element);
+ monitor.worked(100);
}
- monitor.worked(100);
+ return (ChangeLogDiffNode[]) commentRoots.values().toArray(new ChangeLogDiffNode[commentRoots.size()]);
+ } catch (CVSException e) {
+ Utils.handle(e);
+ return new ISynchronizeModelElement[0];
+ } catch (InterruptedException e) {
+ return new ISynchronizeModelElement[0];
}
- return (ChangeLogDiffNode[]) commentRoots.values().toArray(new ChangeLogDiffNode[commentRoots.size()]);
}
/**
* How do we tell which revision has the interesting log message? Use the later
* revision, since it probably has the most up-to-date comment.
*/
- private ILogEntry getSyncInfoComment(CVSSyncInfo info, IProgressMonitor monitor) {
- try {
- if(info.getLocal().getType() != IResource.FILE) {
- return null;
+ private RemoteLogOperation getSyncInfoComment(SyncInfo[] infos, IProgressMonitor monitor) throws CVSException, InterruptedException {
+ List remotes = new ArrayList();
+ for (int i = 0; i < infos.length; i++) {
+ CVSSyncInfo info = (CVSSyncInfo)infos[i];
+ if (info.getLocal().getType() != IResource.FILE) {
+ continue;
+ }
+ ICVSRemoteResource remote = getRemoteResource(info);
+ if(remote != null) {
+ remotes.add(remote);
}
-
- ICVSRemoteResource remote = (ICVSRemoteResource)info.getRemote();
- ICVSRemoteResource base = (ICVSRemoteResource)info.getBase();
- ICVSRemoteResource local = (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(info.getLocal());
-
+ }
+ if(! remotes.isEmpty()) {
+ RemoteLogOperation op = new RemoteLogOperation(null, (ICVSRemoteResource[]) remotes.toArray(new ICVSRemoteResource[remotes.size()]));
+ op.execute(monitor);
+ return op;
+ }
+ return null;
+ }
+
+ private ICVSRemoteResource getRemoteResource(CVSSyncInfo info) {
+ try {
+ ICVSRemoteResource remote = (ICVSRemoteResource) info.getRemote();
+ ICVSRemoteResource base = (ICVSRemoteResource) info.getBase();
+ ICVSRemoteResource local = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(info.getLocal());
+
String baseRevision = getRevisionString(base);
String remoteRevision = getRevisionString(remote);
String localRevision = getRevisionString(local);
-
- // TODO: handle new files where there is no local or remote
+
boolean useRemote = true;
- if(local != null && remote != null) {
+ if (local != null && remote != null) {
useRemote = ResourceSyncInfo.isLaterRevision(remoteRevision, localRevision);
- } else if(remote == null) {
+ } else if (remote == null) {
useRemote = false;
}
if (useRemote) {
- return ((RemoteFile) remote).getLogEntry(monitor);
- } else if (local != null){
- return ((RemoteFile) local).getLogEntry(monitor);
+ return remote;
+ } else if (local != null) {
+ return local;
}
return null;
} catch (CVSException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
index 3e4421541..59823b580 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
@@ -22,6 +22,7 @@ import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.ActionDelegateWrapper;
+import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
@@ -197,5 +198,6 @@ public class MergeSynchronizeParticipant extends CVSParticipant {
configuration.setSupportedModes(ISynchronizePageConfiguration.INCOMING_MODE | ISynchronizePageConfiguration.CONFLICTING_MODE);
configuration.setMode(ISynchronizePageConfiguration.INCOMING_MODE);
configuration.addActionContribution(new MergeParticipantActionContribution());
+ configuration.setProperty(SynchronizePageConfiguration.P_MODEL_MANAGER, new ChangeLogModelManager(configuration));
}
} \ No newline at end of file

Back to the top