Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-05-12 15:30:37 +0000
committerJean Michel-Lemieux2004-05-12 15:30:37 +0000
commit4f6ec1207d65b884dce3ed8003b630ba8c5d3cd4 (patch)
tree4df7f3ee3266059f54e895d376e722311b1cebbd
parent2c05335e74f68c9f6104317f9bed8a56ff6c6c85 (diff)
downloadeclipse.platform.team-4f6ec1207d65b884dce3ed8003b630ba8c5d3cd4.tar.gz
eclipse.platform.team-4f6ec1207d65b884dce3ed8003b630ba8c5d3cd4.tar.xz
eclipse.platform.team-4f6ec1207d65b884dce3ed8003b630ba8c5d3cd4.zip
Enabling changelog support
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogDiffNode.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ChangeLogModelProvider.java154
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java14
6 files changed, 110 insertions, 81 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 2439ef90d..6044524b2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -386,6 +386,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
createImageDescriptor(ICVSUIConstants.IMG_NO_REMOTEDIR, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_CVS_CONSOLE, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_DATE, baseURL);
+ createImageDescriptor(ICVSUIConstants.IMG_CHANGELOG, baseURL);
// special
createImageDescriptor("glyphs/glyph1.gif", baseURL); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index 3ec884c4f..803a1c8bc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -38,6 +38,7 @@ public interface ICVSUIConstants {
public final String IMG_MODULE = "obj16/module_rep.gif"; //$NON-NLS-1$
public final String IMG_PROJECT_VERSION = "obj16/prjversions_rep.gif"; //$NON-NLS-1$
public final String IMG_DATE = "obj16/date.gif"; //$NON-NLS-1$
+ public final String IMG_CHANGELOG = "obj16/changelog_obj.gif"; //$NON-NLS-1$
// toolbar
public final String IMG_REFRESH = "elcl16/refresh.gif"; //$NON-NLS-1$
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 27c4e5498..3e2de95e3 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
@@ -43,7 +43,7 @@ public class ChangeLogDiffNode extends SynchronizeModelElement {
* @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
*/
public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATE);
+ return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_CHANGELOG);
}
/* (non-Javadoc)
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 02fb3659c..8364a8568 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
@@ -31,8 +31,6 @@ 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.synchronize.*;
-import org.eclipse.team.ui.synchronize.ISynchronizeManager;
-import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.ui.progress.UIJob;
/**
@@ -102,20 +100,28 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
}
private class FetchLogEntriesJob extends Job {
- private SyncInfoSet set;
+ private Set syncSets = new HashSet();
public FetchLogEntriesJob() {
super("Retrieving revision histories"); //$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);
+ if (syncSets != null && !shutdown) {
+ // Determine the sync sets for which to fetch comment nodes
+ SyncInfoSet[] updates;
+ synchronized(syncSets) {
+ updates = (SyncInfoSet[])syncSets.toArray(new SyncInfoSet[syncSets.size()]);
+ syncSets.clear();
+ }
+
+ for (int i = 0; i < updates.length; i++) {
+ SyncInfoSet set = updates[i];
+ calculateRoots(updates[i], monitor);
+ }
+
UIJob updateUI = new UIJob("") { //$NON-NLS-1$
public IStatus runInUIThread(IProgressMonitor monitor) {
StructuredViewer tree = getViewer();
@@ -128,6 +134,15 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
}
return Status.OK_STATUS;
}
+ public void add(SyncInfoSet set) {
+ synchronized(syncSets) {
+ syncSets.add(set);
+ }
+ schedule();
+ }
+ public boolean shouldRun() {
+ return !syncSets.isEmpty();
+ }
};
public static class ChangeLogModelProviderDescriptor implements ISynchronizeModelProviderDescriptor {
@@ -136,7 +151,7 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
return ID;
}
public String getName() {
- return "Grouped By Comment (useful for browing incoming changes)";
+ return "Grouped By Comment (useful for browsing incoming changes)";
}
public ImageDescriptor getImageDescriptor() {
return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATE);
@@ -161,57 +176,26 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
*/
protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node) {
if(node == getModelRoot()) {
- if(fetchLogEntriesJob == null) {
- fetchLogEntriesJob = new FetchLogEntriesJob();
- }
- if(fetchLogEntriesJob.getState() != Job.NONE) {
- fetchLogEntriesJob.cancel();
- try {
- fetchLogEntriesJob.join();
- } catch (InterruptedException e) {
- }
- }
- fetchLogEntriesJob.setSyncInfoSet(getSyncInfoSet());
- fetchLogEntriesJob.schedule();
+ commentRoots.clear();
+ startUpdateJob(getSyncInfoSet());
}
return new IDiffElement[0];
}
+ private void startUpdateJob(SyncInfoSet set) {
+ if(fetchLogEntriesJob == null) {
+ fetchLogEntriesJob = new FetchLogEntriesJob();
+ }
+ fetchLogEntriesJob.add(set);
+ }
+
private ISynchronizeModelElement[] calculateRoots(SyncInfoSet set, IProgressMonitor monitor) {
try {
- commentRoots.clear();
SyncInfo[] infos = set.getSyncInfos();
RemoteLogOperation logs = getSyncInfoComment(infos, monitor);
- for (int i = 0; i < infos.length; i++) {
- ICVSRemoteResource remoteResource = getRemoteResource((CVSSyncInfo)infos[i]);
- ILogEntry logEntry = logs.getLogEntry(remoteResource);
- ISynchronizeModelElement element;
-
- // If the element has a comment then group with common comment
- if(remoteResource != 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 {
- setAllowRefreshViewer(false);
- addToViewer(changeRoot);
- } finally {
- setAllowRefreshViewer(true);
- }
- }
- element = new FullPathSyncInfoElement(changeRoot, infos[i]);
- } else {
- // For nodes without comments, simply parent with the root. These will be outgoing
- // additions.
- element = new FullPathSyncInfoElement(getModelRoot(), infos[i]);
- }
- try {
- setAllowRefreshViewer(false);
- addToViewer(element);
- } finally {
- setAllowRefreshViewer(true);
+ if (logs != null) {
+ for (int i = 0; i < infos.length; i++) {
+ addSyncInfoToCommentNode(infos[i], logs);
}
}
return (ChangeLogDiffNode[]) commentRoots.values().toArray(new ChangeLogDiffNode[commentRoots.size()]);
@@ -224,6 +208,45 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
}
/**
+ * Create a node for the given sync info object. The logs should contain the log for this info.
+ *
+ * @param info the info for which to create a node in the model
+ * @param log the cvs log for this node
+ */
+ private void addSyncInfoToCommentNode(SyncInfo info, RemoteLogOperation logs) {
+ ICVSRemoteResource remoteResource = getRemoteResource((CVSSyncInfo)info);
+ ILogEntry logEntry = logs.getLogEntry(remoteResource);
+ ISynchronizeModelElement element;
+
+ // If the element has a comment then group with common comment
+ if(remoteResource != 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 {
+ setAllowRefreshViewer(false);
+ addToViewer(changeRoot);
+ } finally {
+ setAllowRefreshViewer(true);
+ }
+ }
+ element = new FullPathSyncInfoElement(changeRoot, info);
+ } else {
+ // For nodes without comments, simply parent with the root. These will be outgoing
+ // additions.
+ element = new FullPathSyncInfoElement(getModelRoot(), info);
+ }
+ try {
+ setAllowRefreshViewer(false);
+ addToViewer(element);
+ } finally {
+ setAllowRefreshViewer(true);
+ }
+ }
+
+ /**
* 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.
*/
@@ -318,20 +341,41 @@ public class ChangeLogModelProvider extends SynchronizeModelProvider {
* @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceAdditions(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
*/
protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event) {
- reset();
+ startUpdateJob(new SyncInfoSet(event.getAddedResources()));
}
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceChanges(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
*/
protected void handleResourceChanges(ISyncInfoTreeChangeEvent event) {
- reset();
+ // Refresh the viewer for each changed resource
+ SyncInfo[] infos = event.getChangedResources();
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ IResource local = info.getLocal();
+ ISynchronizeModelElement diffNode = getModelObject(local);
+ if (diffNode != null) {
+ if(diffNode instanceof SyncInfoModelElement) {
+ ((SyncInfoModelElement)diffNode).update(info);
+ calculateProperties(diffNode, false);
+ }
+ }
+ }
}
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider#handleResourceRemovals(org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent)
*/
protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event) {
- reset();
+ IResource[] removedRoots = event.getRemovedSubtreeRoots();
+ for (int i = 0; i < removedRoots.length; i++) {
+ removeFromViewer(removedRoots[i]);
+ }
+ // We have to look for folders that may no longer be in the set
+ // (i.e. are in-sync) but still have descendants in the set
+ IResource[] removedResources = event.getRemovedResources();
+ for (int i = 0; i < removedResources.length; i++) {
+ removeFromViewer(removedResources[i]);
+ }
}
}
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 9d4d0fc33..9b3174af8 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
@@ -11,32 +11,21 @@
package org.eclipse.team.internal.ccvs.ui.subscriber;
import java.util.*;
-import java.util.ArrayList;
-import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PartInitException;
@@ -274,6 +263,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));
+ configuration.setProperty(SynchronizePageConfiguration.P_MODEL_MANAGER, new ChangeLogModelManager(configuration));
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
index 65804775b..a2945a7e4 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
@@ -12,17 +12,11 @@ package org.eclipse.team.internal.ccvs.ui.subscriber;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.actions.BranchAction;
-import org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction;
-import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
+import org.eclipse.team.internal.ccvs.ui.actions.*;
import org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant;
+import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
-import org.eclipse.team.ui.synchronize.ISynchronizeScope;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PartInitException;
@@ -150,7 +144,7 @@ public class WorkspaceSynchronizeParticipant extends ScopableSubscriberParticipa
configuration.addActionContribution(new WorkspaceActionContribution());
configuration.setSupportedModes(ISynchronizePageConfiguration.ALL_MODES);
configuration.setMode(ISynchronizePageConfiguration.BOTH_MODE);
- //configuration.setProperty(SynchronizePageConfiguration.P_MODEL_MANAGER, new ChangeLogModelManager(configuration));
+ configuration.setProperty(SynchronizePageConfiguration.P_MODEL_MANAGER, new ChangeLogModelManager(configuration));
// Add context menu groups here to give the client displaying the
// page a chance to remove the context menu

Back to the top