Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2018-06-15 05:45:30 -0400
committerMatthias Sohn2018-06-16 19:11:32 -0400
commit935ac8cde63e319d6fd0d26f99de07d4151b7242 (patch)
treea8e8ab7e59375e819ce819743532c793ca4f24db /org.eclipse.egit.ui/src/org/eclipse/egit/ui
parent5be233e1a7f05fd64dda12efa3128e6c13d236d3 (diff)
downloadegit-935ac8cde63e319d6fd0d26f99de07d4151b7242.tar.gz
egit-935ac8cde63e319d6fd0d26f99de07d4151b7242.tar.xz
egit-935ac8cde63e319d6fd0d26f99de07d4151b7242.zip
Batch resource refreshes
Wrap multiple resource refreshes in an IWorkspaceRunnable with IWorkspace.AVOID_UPDATE to avoid a flood of resource change events. Most operation that do refresh parts of the workspace already did that, but a few didn't. Wrap those as appropriate. Bug: 535950 Change-Id: I1d1028544f70d5211e91c962900cf51d81cad725 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clean/CleanRepositoryPage.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java30
2 files changed, 17 insertions, 20 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clean/CleanRepositoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clean/CleanRepositoryPage.java
index 76c90f2c4..86991d147 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clean/CleanRepositoryPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clean/CleanRepositoryPage.java
@@ -17,6 +17,8 @@ import java.util.Set;
import java.util.TreeSet;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
@@ -277,7 +279,10 @@ public class CleanRepositoryPage extends WizardPage {
try {
IProject[] projects = ProjectUtil.getProjectsContaining(repository, itemsToClean);
- ProjectUtil.refreshResources(projects,
+ ResourcesPlugin.getWorkspace().run(
+ pm -> ProjectUtil.refreshResources(projects,
+ pm),
+ null, IWorkspace.AVOID_UPDATE,
subMonitor.newChild(1));
} catch (CoreException e) {
// could not refresh... not a "real" problem
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java
index cb5df96d1..e7d39ccfc 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java
@@ -26,7 +26,7 @@ import org.eclipse.compare.CompareEditorInput;
import org.eclipse.compare.CompareUI;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -34,7 +34,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.egit.core.internal.FileChecker;
import org.eclipse.egit.core.internal.FileChecker.CheckResult;
import org.eclipse.egit.core.internal.FileChecker.CheckResultEntry;
-import org.eclipse.egit.core.project.RepositoryMapping;
+import org.eclipse.egit.core.internal.util.ProjectUtil;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.internal.UIText;
@@ -549,24 +549,16 @@ public class RebaseResultDialog extends MessageDialog {
}
if (startMergeButton.getSelection()) {
super.buttonPressed(buttonId);
- // open the merge tool
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
- .getProjects();
- for (IProject project : projects) {
- RepositoryMapping mapping = RepositoryMapping
- .getMapping(project);
- if (mapping != null && mapping.getRepository().equals(repo)) {
- try {
- // make sure to refresh before opening the merge
- // tool
- project
- .refreshLocal(IResource.DEPTH_INFINITE,
- null);
- } catch (CoreException e) {
- Activator.handleError(e.getMessage(), e, false);
- }
- }
+ // make sure to refresh before opening the merge tool
+ IProject[] projects = ProjectUtil.getProjects(repo);
+ try {
+ ResourcesPlugin.getWorkspace().run(
+ pm -> ProjectUtil.refreshResources(projects, pm),
+ null, IWorkspace.AVOID_UPDATE, null);
+ } catch (CoreException e) {
+ Activator.logError(e.getMessage(), e);
}
+ // open the merge tool
List<IPath> locationList = new ArrayList<>();
IPath repoWorkdirPath = new Path(repo.getWorkTree().getPath());
for (String repoPath : conflictPaths) {

Back to the top