Refactored participant refresh infrastructure to support model sync
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RefreshResourceMappingParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RefreshResourceMappingParticipantJob.java
index fd54eaf..f504f4e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RefreshResourceMappingParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/RefreshResourceMappingParticipantJob.java
@@ -11,8 +11,12 @@
package org.eclipse.team.internal.ui.mapping;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.mapping.ResourceTraversal;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.diff.*;
+import org.eclipse.team.core.mapping.ISynchronizationContext;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.*;
import org.eclipse.team.ui.operations.ResourceMappingSynchronizeParticipant;
@@ -22,13 +26,36 @@
super(participant, jobName, taskName, resources, listener);
}
- protected RefreshChangeListener doRefresh(IProgressMonitor monitor) throws TeamException {
+ protected RefreshChangeListener doRefresh(IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+ ISynchronizationContext context = ((ResourceMappingSynchronizeParticipant)getParticipant()).getContext();
+ IDiffChangeListener listener = null;
+ try {
+ context.getDiffTree().addDiffChangeListener(listener);
+ context.refresh(getTraversals(), IResource.NONE, monitor);
+ } finally {
+ context.getDiffTree().removeDiffChangeListener(listener);
+ }
+ return null;
+ }
+
+ private ResourceTraversal[] getTraversals() {
// TODO Auto-generated method stub
return null;
}
protected int getChangeCount() {
- // TODO Auto-generated method stub
+ ISynchronizationContext context = ((ResourceMappingSynchronizeParticipant)getParticipant()).getContext();
+ try {
+ context.getDiffTree().accept(new IDiffVisitor() {
+ public boolean visit(IDiffNode delta) throws CoreException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ }, getTraversals());
+ } catch (CoreException e) {
+ TeamUIPlugin.log(e);
+ }
return 0;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
index fb5ed31..f8a66d9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshParticipantJob.java
@@ -22,7 +22,6 @@
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.*;
@@ -333,7 +332,7 @@
status = Status.CANCEL_STATUS;
}
}
- } catch(TeamException e) {
+ } catch(CoreException e) {
// Determine the status to be returned and the GOTO action
status = e.getStatus();
if (!isUser()) {
@@ -369,7 +368,7 @@
}
}
- protected abstract RefreshChangeListener doRefresh(IProgressMonitor monitor) throws TeamException;
+ protected abstract RefreshChangeListener doRefresh(IProgressMonitor monitor) throws CoreException;
/**
* Return the total number of changes covered by the resources