Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2005-03-24 15:29:41 +0000
committerMichael Valenta2005-03-24 15:29:41 +0000
commitb47e89e0ec9d8d451d8667ecce8cd942f8a8c451 (patch)
treef0eeb257dc59df1379f9aa0f6a5743f7b140cefc
parent599a3aaf5706798a95794d1c18e1d26da286445d (diff)
downloadeclipse.platform.team-b47e89e0ec9d8d451d8667ecce8cd942f8a8c451.tar.gz
eclipse.platform.team-b47e89e0ec9d8d451d8667ecce8cd942f8a8c451.tar.xz
eclipse.platform.team-b47e89e0ec9d8d451d8667ecce8cd942f8a8c451.zip
Bug 88891 UI freezes during replace with another branch or version
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UncommittedChangesDialog.java13
3 files changed, 67 insertions, 34 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
index e23e44693..873c26e6c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
@@ -21,38 +21,52 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
import org.eclipse.team.internal.ui.dialogs.ResourceMappingResourceDisplayArea;
+import org.eclipse.ui.PlatformUI;
/**
* Action for replace with tag.
*/
public class ReplaceWithTagAction extends WorkspaceTraversalAction {
- /* package*/ static UncommittedChangesDialog getPromptingDialog(Shell shell, ResourceMapping[] mappings) {
- return new UncommittedChangesDialog(shell, Policy.bind("ReplaceWithTagAction.4"), mappings) { //$NON-NLS-1$
- protected String getSingleMappingMessage(ResourceMapping mapping) {
- String label = ResourceMappingResourceDisplayArea.getLabel(mapping);
- if (getAllMappings().length == 1) {
- return Policy.bind("ReplaceWithTagAction.2", label); //$NON-NLS-1$
+ /* package*/ static UncommittedChangesDialog getPromptingDialog(final Shell shell, final ResourceMapping[] mappings) {
+ final UncommittedChangesDialog[] dialog = new UncommittedChangesDialog[] { null };
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ dialog[0] = new UncommittedChangesDialog(shell, Policy.bind("ReplaceWithTagAction.4"), mappings, monitor) { //$NON-NLS-1$
+ protected String getSingleMappingMessage(ResourceMapping mapping) {
+ String label = ResourceMappingResourceDisplayArea.getLabel(mapping);
+ if (getAllMappings().length == 1) {
+ return Policy.bind("ReplaceWithTagAction.2", label); //$NON-NLS-1$
+ }
+ return Policy.bind("ReplaceWithTagAction.0", label); //$NON-NLS-1$
+ }
+
+ protected String getMultipleMappingsMessage() {
+ return Policy.bind("ReplaceWithTagAction.1"); //$NON-NLS-1$
+ }
+ };
}
- return Policy.bind("ReplaceWithTagAction.0", label); //$NON-NLS-1$
- }
-
- protected String getMultipleMappingsMessage() {
- return Policy.bind("ReplaceWithTagAction.1"); //$NON-NLS-1$
- }
- };
+ });
+ } catch (InvocationTargetException e) {
+ CVSUIPlugin.openError(shell, null, null, e);
+ return null;
+ } catch (InterruptedException e) {
+ return null;
+ }
+ return dialog[0];
}
protected static ResourceMapping[] checkOverwriteOfDirtyResources(Shell shell, ResourceMapping[] mappings, IProgressMonitor monitor) {
// Prompt for any uncommitted changes
UncommittedChangesDialog dialog = getPromptingDialog(shell, mappings);
+ if (dialog == null) return null;
mappings = dialog.promptToSelectMappings();
if(mappings.length == 0) {
// nothing to do
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
index d87eb80a2..fc78a8af9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
@@ -10,12 +10,17 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;
+import java.lang.reflect.InvocationTargetException;
+
import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
import org.eclipse.team.internal.ccvs.ui.operations.TagOperation;
import org.eclipse.team.internal.ui.dialogs.ResourceMappingResourceDisplayArea;
+import org.eclipse.ui.PlatformUI;
public class TagLocalAction extends TagAction {
@@ -25,20 +30,33 @@ public class TagLocalAction extends TagAction {
protected boolean performPrompting() {
// Prompt for any uncommitted changes
mappings = getCVSResourceMappings();
- UncommittedChangesDialog dialog = new UncommittedChangesDialog(getShell(), Policy.bind("TagLocalAction.4"), mappings) { //$NON-NLS-1$
- protected String getSingleMappingMessage(ResourceMapping mapping) {
- String label = ResourceMappingResourceDisplayArea.getLabel(mapping);
- if (getAllMappings().length == 1) {
- return Policy.bind("TagLocalAction.2", label); //$NON-NLS-1$
+ final UncommittedChangesDialog[] dialog = new UncommittedChangesDialog[] { null };
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ dialog[0] = new UncommittedChangesDialog(getShell(), Policy.bind("TagLocalAction.4"), mappings, monitor) { //$NON-NLS-1$
+ protected String getSingleMappingMessage(ResourceMapping mapping) {
+ String label = ResourceMappingResourceDisplayArea.getLabel(mapping);
+ if (getAllMappings().length == 1) {
+ return Policy.bind("TagLocalAction.2", label); //$NON-NLS-1$
+ }
+ return Policy.bind("TagLocalAction.0", label); //$NON-NLS-1$
+ }
+
+ protected String getMultipleMappingsMessage() {
+ return Policy.bind("TagLocalAction.1"); //$NON-NLS-1$
+ }
+ };
}
- return Policy.bind("TagLocalAction.0", label); //$NON-NLS-1$
- }
-
- protected String getMultipleMappingsMessage() {
- return Policy.bind("TagLocalAction.1"); //$NON-NLS-1$
- }
- };
- mappings = dialog.promptToSelectMappings();
+ });
+ } catch (InvocationTargetException e) {
+ handle(e);
+ return false;
+ } catch (InterruptedException e) {
+ return false;
+ }
+ if (dialog[0] == null) return false;
+ mappings = dialog[0].promptToSelectMappings();
if(mappings.length == 0) {
// nothing to do
return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UncommittedChangesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UncommittedChangesDialog.java
index 2ee8d29f2..1021ab130 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UncommittedChangesDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UncommittedChangesDialog.java
@@ -16,6 +16,7 @@ import org.eclipse.core.resources.*;
import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
+import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.widgets.Shell;
@@ -47,8 +48,8 @@ public abstract class UncommittedChangesDialog extends MappingSelectionDialog {
private final ResourceMapping[] allMappings;
- public UncommittedChangesDialog(Shell parentShell, String dialogTitle, ResourceMapping[] mappings) {
- super(parentShell, dialogTitle, getMatchingMappings(mappings, CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), getResourceFilter()), new UncommittedFilter());
+ public UncommittedChangesDialog(Shell parentShell, String dialogTitle, ResourceMapping[] mappings, IProgressMonitor monitor) {
+ super(parentShell, dialogTitle, getMatchingMappings(mappings, CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), getResourceFilter(), monitor), new UncommittedFilter());
allMappings = mappings;
}
@@ -88,18 +89,18 @@ public abstract class UncommittedChangesDialog extends MappingSelectionDialog {
}
}
- private static ResourceMapping[] getMatchingMappings(ResourceMapping[] mappings, final Subscriber subscriber, final FastSyncInfoFilter resourceFilter) {
+ private static ResourceMapping[] getMatchingMappings(ResourceMapping[] mappings, final Subscriber subscriber, final FastSyncInfoFilter resourceFilter, IProgressMonitor monitor) {
Set result = new HashSet();
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
- if (matchesFilter(mapping, subscriber, resourceFilter)) {
+ if (matchesFilter(mapping, subscriber, resourceFilter, monitor)) {
result.add(mapping);
}
}
return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
}
- private static boolean matchesFilter(ResourceMapping mapping, final Subscriber subscriber, final FastSyncInfoFilter resourceFilter) {
+ private static boolean matchesFilter(ResourceMapping mapping, final Subscriber subscriber, final FastSyncInfoFilter resourceFilter, IProgressMonitor monitor) {
try {
mapping.accept(ResourceMappingContext.LOCAL_CONTEXT, new IResourceVisitor() {
public boolean visit(IResource resource) throws CoreException {
@@ -109,7 +110,7 @@ public abstract class UncommittedChangesDialog extends MappingSelectionDialog {
}
return true;
}
- }, null);
+ }, monitor);
} catch (CoreException e) {
if (e.getStatus().isOK()) {
return true;

Back to the top