Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-09-17 04:46:22 -0400
committerMichael Keppler2019-09-17 12:56:04 -0400
commit290a3e0f3de3b9906ca1943feef8272781aa3f11 (patch)
treecfd8604ee16980d056d3a2b407a489c34108f996 /org.eclipse.egit.ui
parentb849c6553fe96a9a232f6895ecf8710ebf07f423 (diff)
downloadegit-290a3e0f3de3b9906ca1943feef8272781aa3f11.tar.gz
egit-290a3e0f3de3b9906ca1943feef8272781aa3f11.tar.xz
egit-290a3e0f3de3b9906ca1943feef8272781aa3f11.zip
Improve performance of command parameter completion
* check for accessible first before trying to get the team provider * use parallel streams Bug:551149 Change-Id: Id0def461db3d4f96732f5d0ff129db111935ec8f Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/ProjectNameParameterValues.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/ProjectNameParameterValues.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/ProjectNameParameterValues.java
index c3abf50fc..ee49cb9fb 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/ProjectNameParameterValues.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commands/ProjectNameParameterValues.java
@@ -10,8 +10,9 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.commands;
-import java.util.HashMap;
import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.eclipse.core.commands.IParameterValues;
import org.eclipse.core.resources.IProject;
@@ -31,14 +32,13 @@ public class ProjectNameParameterValues implements IParameterValues {
public Map getParameterValues() {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject[] projects = root.getProjects();
- Map<String, String> paramValues = new HashMap<>();
- for (IProject project : projects) {
- final boolean notAlreadyShared = RepositoryProvider
- .getProvider(project) == null;
- if (project.isAccessible() && notAlreadyShared)
- paramValues.put(project.getName(), project.getName());
- }
- return paramValues;
+ return Stream.of(projects)
+ .parallel()
+ .filter(IProject::isAccessible)
+ .filter(project -> RepositoryProvider
+ .getProvider(project) == null)
+ .collect(
+ Collectors.toMap(IProject::getName, IProject::getName));
}
}

Back to the top