diff options
3 files changed, 64 insertions, 27 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java index abb8d7ecb..a0ce4f258 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java @@ -147,7 +147,7 @@ public class HistoryView extends ViewPart { } }); - getContentsAction = getContextMenuAction(Policy.bind("HistoryView.getContentsAction"), new IWorkspaceRunnable() { //$NON-NLS-1$ + getContentsAction = getContextMenuAction(Policy.bind("HistoryView.getContentsAction"), true /* needs progress */, new IWorkspaceRunnable() { //$NON-NLS-1$ public void run(IProgressMonitor monitor) throws CoreException { ICVSRemoteFile remoteFile = currentSelection.getRemoteFile(); monitor.beginTask(null, 100); @@ -165,7 +165,7 @@ public class HistoryView extends ViewPart { }); WorkbenchHelp.setHelp(getContentsAction, IHelpContextIds.GET_FILE_CONTENTS_ACTION); - getRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), new IWorkspaceRunnable() { //$NON-NLS-1$ + getRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), true /* needs progress */, new IWorkspaceRunnable() { //$NON-NLS-1$ public void run(IProgressMonitor monitor) throws CoreException { ICVSRemoteFile remoteFile = currentSelection.getRemoteFile(); try { @@ -219,11 +219,13 @@ public class HistoryView extends ViewPart { return resources; } }; - tagWithExistingAction = getContextMenuAction(Policy.bind("HistoryView.tagWithExistingAction"), new IWorkspaceRunnable() { //$NON-NLS-1$ + tagWithExistingAction = getContextMenuAction(Policy.bind("HistoryView.tagWithExistingAction"), false /* no progress */, new IWorkspaceRunnable() { //$NON-NLS-1$ public void run(IProgressMonitor monitor) throws CoreException { tagActionDelegate.selectionChanged(tagWithExistingAction, tableViewer.getSelection()); tagActionDelegate.run(tagWithExistingAction); - refresh(); + if( ! ((MoveRemoteTagAction)tagActionDelegate).wasCancelled()) { + refresh(); + } } }); WorkbenchHelp.setHelp(getRevisionAction, IHelpContextIds.TAG_WITH_EXISTING_ACTION); @@ -577,7 +579,7 @@ public class HistoryView extends ViewPart { } } - private Action getContextMenuAction(String title, final IWorkspaceRunnable action) { + private Action getContextMenuAction(String title, final boolean needsProgressDialog, final IWorkspaceRunnable action) { return new Action(title) { public void run() { try { @@ -587,15 +589,23 @@ public class HistoryView extends ViewPart { IStructuredSelection ss = (IStructuredSelection)selection; Object o = ss.getFirstElement(); currentSelection = (ILogEntry)o; - new ProgressMonitorDialog(getViewSite().getShell()).run(false, true, new WorkspaceModifyOperation() { - protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - action.run(monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); + if(needsProgressDialog) { + new ProgressMonitorDialog(getViewSite().getShell()).run(false, true, new WorkspaceModifyOperation() { + protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + try { + action.run(monitor); + } catch (CoreException e) { + throw new InvocationTargetException(e); + } } + }); + } else { + try { + action.run(null); + } catch (CoreException e) { + throw new InvocationTargetException(e); } - }); + } } catch (InvocationTargetException e) { CVSUIPlugin.openError(getViewSite().getShell(), null, null, e, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS); } catch (InterruptedException e) { @@ -645,6 +655,18 @@ public class HistoryView extends ViewPart { entries = null; BusyIndicator.showWhile(tableViewer.getTable().getDisplay(), new Runnable() { public void run() { + // if a local file was fed to the history view then we will have to refetch the handle + // to properly display the current revision marker. + if(file != null) { + ICVSRemoteFile remoteFile; + try { + remoteFile = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(file); + historyTableProvider.setFile(remoteFile); + } catch (CVSException e) { + // use previously fetched remote file, but log error + CVSUIPlugin.log(e); + } + } tableViewer.refresh(); } }); diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java index e0a147f1d..1e532ca19 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java @@ -41,6 +41,10 @@ import org.eclipse.team.internal.ui.PromptingDialog; * TagAction tags the selected resources with a version tag specified by the user. */ public class TagAction extends WorkspaceAction { + + // remember if the execute action was cancelled + private boolean wasCancelled = false; + // The previously remembered tag protected static String previousTag = ""; //$NON-NLS-1$ @@ -71,7 +75,10 @@ public class TagAction extends WorkspaceAction { result[0] = promptForTag(folder); } }); - if (result[0] == null) return; + if (result[0] == null) { + setWasCancelled(true); + return; + } final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager(); @@ -171,5 +178,12 @@ public class TagAction extends WorkspaceAction { return false; } + public boolean wasCancelled() { + return wasCancelled; + } + + public void setWasCancelled(boolean b) { + wasCancelled = b; + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java index 9c17dea4d..d9adf138b 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java @@ -60,21 +60,22 @@ public class TagInRepositoryAction extends TagAction { // Prompt for the tag final ICVSResource[] resources = getSelectedCVSResources(); final CVSTag[] tag = new CVSTag[] { null }; - getShell().getDisplay().syncExec(new Runnable() { - public void run() { - // Collect the parent folders from which to determine the tags to show - ICVSFolder[] folders = new ICVSFolder[resources.length]; - for (int i = 0; i < resources.length; i++) { - if (resources[i].isFolder()) { - folders[i] = (ICVSFolder)resources[i]; - } else { - folders[i] = resources[i].getParent(); - } - } - tag[0] = promptForTag(folders); + + // Collect the parent folders from which to determine the tags to show + ICVSFolder[] folders = new ICVSFolder[resources.length]; + for (int i = 0; i < resources.length; i++) { + if (resources[i].isFolder()) { + folders[i] = (ICVSFolder)resources[i]; + } else { + folders[i] = resources[i].getParent(); } - }); - if (tag[0] == null) return; + } + tag[0] = promptForTag(folders); + + if (tag[0] == null) { + setWasCancelled(true); + return; + } run(new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException { |