diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java | 54 |
1 files changed, 26 insertions, 28 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 9efdc31d7..540cfc05b 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 @@ -16,7 +16,6 @@ package org.eclipse.team.internal.ccvs.ui.actions; import java.lang.reflect.InvocationTargetException; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.action.IAction; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.window.Window; @@ -33,20 +32,18 @@ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction { /* * Method declared on IActionDelegate. */ + @Override public void execute(IAction action) throws InterruptedException, InvocationTargetException { final ReplaceOperation replaceOperation= createReplaceOperation(); if (hasOutgoingChanges(replaceOperation)) { final boolean[] keepGoing = new boolean[] { true }; - Display.getDefault().syncExec(new Runnable() { - public void run() { - OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), replaceOperation.getScopeManager(), - CVSUIMessages.ReplaceWithTagAction_2, - CVSUIMessages.ReplaceWithTagAction_0, - CVSUIMessages.ReplaceWithTagAction_1); - dialog.setHelpContextId(IHelpContextIds.REPLACE_OUTGOING_CHANGES_DIALOG); - int result = dialog.open(); - keepGoing[0] = result == Window.OK; - } + Display.getDefault().syncExec(() -> { + OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), replaceOperation.getScopeManager(), + CVSUIMessages.ReplaceWithTagAction_2, CVSUIMessages.ReplaceWithTagAction_0, + CVSUIMessages.ReplaceWithTagAction_1); + dialog.setHelpContextId(IHelpContextIds.REPLACE_OUTGOING_CHANGES_DIALOG); + int result = dialog.open(); + keepGoing[0] = result == Window.OK; }); if (!keepGoing[0]) return; @@ -56,25 +53,24 @@ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction { final CVSTag[] tag= new CVSTag[] { null }; // Show a busy cursor while display the tag selection dialog - run(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { - monitor= Policy.monitorFor(monitor); - tag[0] = getTag(replaceOperation); - - // finish, when tag can't be obtained - if (tag[0] == null) + run((IRunnableWithProgress) monitor -> { + monitor = Policy.monitorFor(monitor); + tag[0] = getTag(replaceOperation); + + // finish, when tag can't be obtained + if (tag[0] == null) + return; + + // For non-projects determine if the tag being loaded is the same as the + // resource's parent + // If it's not, warn the user that they will have strange sync behavior + try { + if (!CVSAction.checkForMixingTags(getShell(), replaceOperation.getScope().getRoots(), tag[0])) { + tag[0] = null; return; - - // For non-projects determine if the tag being loaded is the same as the resource's parent - // If it's not, warn the user that they will have strange sync behavior - try { - if(!CVSAction.checkForMixingTags(getShell(), replaceOperation.getScope().getRoots(), tag[0])) { - tag[0] = null; - return; - } - } catch (CoreException e) { - throw new InvocationTargetException(e); } + } catch (CoreException e) { + throw new InvocationTargetException(e); } }, false /* cancelable */, PROGRESS_BUSYCURSOR); @@ -97,6 +93,7 @@ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction { /** * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle() */ + @Override protected String getErrorTitle() { return CVSUIMessages.ReplaceWithTagAction_replace; } @@ -104,6 +101,7 @@ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction { /* (non-Javadoc) * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources() */ + @Override protected boolean isEnabledForNonExistantResources() { return true; } |