diff options
author | Michael Valenta | 2004-04-23 17:56:22 +0000 |
---|---|---|
committer | Michael Valenta | 2004-04-23 17:56:22 +0000 |
commit | da9d9c8a24abea267f0cbf45f598b0fb341f83f8 (patch) | |
tree | eccac98b82ce52e3d35f1cd5f2add3bd79ed34b4 | |
parent | 5340967106347d99f8f9076a90f26f1b70563081 (diff) | |
download | eclipse.platform.team-da9d9c8a24abea267f0cbf45f598b0fb341f83f8.tar.gz eclipse.platform.team-da9d9c8a24abea267f0cbf45f598b0fb341f83f8.tar.xz eclipse.platform.team-da9d9c8a24abea267f0cbf45f598b0fb341f83f8.zip |
59710: Override and Update prompt is hidden by progress dialog
3 files changed, 38 insertions, 30 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java index 44ce5f5ce..2bb005828 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java @@ -29,13 +29,11 @@ public class OverrideAndUpdateSubscriberOperation extends CVSSubscriberOperation super(part, elements); } /* (non-Javadoc) - * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.core.runtime.IProgressMonitor) + * @see org.eclipse.team.ui.TeamOperation#shouldRun() */ - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + public boolean shouldRun() { SyncInfoSet syncSet = getSyncInfoSet(); - if(promptForOverwrite(syncSet)) { - super.run(monitor); - } + return(promptForOverwrite(syncSet)); } /* (non-Javadoc) * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor) diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java index 1e7951c15..13f8905ae 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java @@ -11,18 +11,26 @@ package org.eclipse.team.internal.ccvs.ui.subscriber; import java.lang.reflect.InvocationTargetException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.eclipse.compare.structuremergeviewer.IDiffElement; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.synchronize.*; -import org.eclipse.team.core.synchronize.FastSyncInfoFilter.*; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter; +import org.eclipse.team.core.synchronize.SyncInfo; +import org.eclipse.team.core.synchronize.SyncInfoSet; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter.AndSyncInfoFilter; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter.OrSyncInfoFilter; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter; import org.eclipse.team.core.variants.IResourceVariant; -import org.eclipse.team.internal.ccvs.core.*; +import org.eclipse.team.internal.ccvs.core.CVSException; +import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; +import org.eclipse.team.internal.ccvs.core.ICVSFile; import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; @@ -51,10 +59,16 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation { } /* (non-Javadoc) + * @see org.eclipse.team.ui.TeamOperation#shouldRun() + */ + public boolean shouldRun() { + return promptIfNeeded(); + } + + /* (non-Javadoc) * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.core.runtime.IProgressMonitor) */ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - if(! promptIfNeeded()) return; skipped.clear(); super.run(monitor); try { @@ -317,28 +331,11 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation { }); } - /* - * Return the complete set of selected resources that failed to update safely - */ - private SyncInfoSet createFailedSet(SyncInfoSet syncSet, SyncInfo[] willFail, IFile[] files) { - List result = new ArrayList(); - for (int i = 0; i < files.length; i++) { - IFile file = files[i]; - SyncInfo resource = syncSet.getSyncInfo(file); - if (resource != null) result.add(resource); - } - for (int i = 0; i < willFail.length; i++) { - result.add(willFail[i]); - } - return new SyncInfoSet((SyncInfo[]) result.toArray(new SyncInfo[result.size()])); - } - /** * Warn user that some files could not be updated. * Note: This method is designed to be overridden by test cases. */ protected void warnAboutFailedResources(final SyncInfoSet syncSet) { - final int[] result = new int[] {Dialog.CANCEL}; TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() { public void run() { MessageDialog.openInformation(getShell(), diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java index 32b7b283d..f55e6573e 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamOperation.java @@ -68,9 +68,22 @@ public abstract class TeamOperation extends JobChangeAdapter implements IRunnabl * Otherwise it will run in the foreground and block the caller. */ public final void run() throws InvocationTargetException, InterruptedException { - getRunnableContext().run(this); + if (shouldRun()) { + getRunnableContext().run(this); + } } - + + /** + * This method is invoked from the <code>run()</code> method before + * the operation is run in the operation's context. Subclasses may + * override in order to perform prechecks to determine if the operation + * should run. This may include prompting the user for information, etc. + * @return whether the operation should be run. + */ + public boolean shouldRun() { + return true; + } + /** * Returns the scheduling rule that is to be obtained before this * operation is executed by it's context or <code>null</code> if |