aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Elsemore2013-06-17 20:19:38 (EDT)
committerMatthias Sohn2013-06-18 11:44:39 (EDT)
commit862e6ff22ad56c10df6de3385ffa4c7d02363d1d (patch)
tree85f41ca217dcd8092325731716bd0107b85fe253
parenta108c6e0a0349783ebd7e8c3eb0d72d39adf609f (diff)
downloadegit-862e6ff22ad56c10df6de3385ffa4c7d02363d1d.zip
egit-862e6ff22ad56c10df6de3385ffa4c7d02363d1d.tar.gz
egit-862e6ff22ad56c10df6de3385ffa4c7d02363d1d.tar.bz2
Auto share multiple projects in single jobrefs/changes/62/13862/2
When multiple projects are imported together, perform all the necessary auto shares in a single job rather than spawning a separate job for each project. Bug: 410937 Change-Id: I0a2410328da69a73b657afd66fe9efc952809c07 Signed-off-by: Stephen Elsemore <selsemore@collab.net> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
index e472eb1..342d162 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
@@ -17,8 +17,10 @@ import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Dictionary;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -257,6 +259,9 @@ public class Activator extends Plugin implements DebugOptionsListener {
public void resourceChanged(IResourceChangeEvent event) {
try {
+
+ final Map<IProject, File> projects = new HashMap<IProject, File>();
+
event.getDelta().accept(new IResourceDeltaVisitor() {
public boolean visit(IResourceDelta delta)
@@ -290,11 +295,9 @@ public class Activator extends Plugin implements DebugOptionsListener {
.next();
final File repositoryDir = m
.getGitDirAbsolutePath().toFile();
- final ConnectProviderOperation op = new ConnectProviderOperation(
- project, repositoryDir);
- JobUtil.scheduleUserJob(op,
- CoreText.Activator_AutoShareJobName,
- JobFamilies.AUTO_SHARE);
+
+ projects.put(project, repositoryDir);
+
Activator.getDefault().getRepositoryUtil()
.addConfiguredRepository(repositoryDir);
}
@@ -304,6 +307,15 @@ public class Activator extends Plugin implements DebugOptionsListener {
return false;
}
});
+
+ if (projects.size() > 0) {
+ ConnectProviderOperation op = new ConnectProviderOperation(
+ projects);
+ JobUtil.scheduleUserJob(op,
+ CoreText.Activator_AutoShareJobName,
+ JobFamilies.AUTO_SHARE);
+ }
+
} catch (CoreException e) {
Activator.logError(e.getMessage(), e);
return;