diff options
author | james | 2002-01-22 16:09:55 +0000 |
---|---|---|
committer | james | 2002-01-22 16:09:55 +0000 |
commit | f3c721a28b5fd22b70fbd2e22fd120aa6841e77c (patch) | |
tree | 2d0eab295e8325af6d0a71e22749fde087c51e26 | |
parent | 814af01e27f4e21e466111b45df27fbbde9afca5 (diff) | |
download | eclipse.platform.team-f3c721a28b5fd22b70fbd2e22fd120aa6841e77c.tar.gz eclipse.platform.team-f3c721a28b5fd22b70fbd2e22fd120aa6841e77c.tar.xz eclipse.platform.team-f3c721a28b5fd22b70fbd2e22fd120aa6841e77c.zip |
7911: Long pause before progress dialog when syncing
3 files changed, 32 insertions, 25 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java index 86f5d7241..f8365e1ed 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java @@ -76,28 +76,19 @@ public class SyncAction implements IObjectActionDelegate { */ public void run(IAction action) { String title = Policy.bind("SyncAction.sync"); - try { - IResource[] resources = getResources(selection); - SyncView view = (SyncView)CVSUIPlugin.getActivePage().findView(SyncView.VIEW_ID); - if (view == null) { - view = SyncView.findInActivePerspective(); - } - if (view != null) { - try { - CVSUIPlugin.getActivePage().showView(SyncView.VIEW_ID); - } catch (PartInitException e) { - CVSUIPlugin.log(e.getStatus()); - } - // What happens when resources from the same project are selected? - IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length]; - for (int i = 0; i < trees.length; i++) { - CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resources[i].getProject()); - trees[i] = provider.getRemoteSyncTree(resources[i], null, new NullProgressMonitor()); - } - view.showSync(new CVSSyncCompareInput(trees)); + IResource[] resources = getResources(selection); + SyncView view = (SyncView)CVSUIPlugin.getActivePage().findView(SyncView.VIEW_ID); + if (view == null) { + view = SyncView.findInActivePerspective(); + } + if (view != null) { + try { + CVSUIPlugin.getActivePage().showView(SyncView.VIEW_ID); + } catch (PartInitException e) { + CVSUIPlugin.log(e.getStatus()); } - } catch (TeamException e) { - ErrorDialog.openError(getShell(), title, e.getMessage(), e.getStatus()); + // What happens when resources from the same project are selected? + view.showSync(new CVSSyncCompareInput(resources)); } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java index a7b1f3c6e..04bbb4d0c 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
@@ -33,11 +34,13 @@ import org.eclipse.team.ui.sync.UnchangedTeamContainer; import org.eclipse.ui.actions.WorkspaceModifyOperation;
public class CVSSyncCompareInput extends SyncCompareInput {
+ IResource[] resources;
/**
* Creates a new catchup or release operation.
*/
- public CVSSyncCompareInput(IRemoteSyncElement[] trees) {
- super(trees);
+ public CVSSyncCompareInput(IResource[] resources) {
+ super();
+ this.resources = resources;
}
/**
* Overridden to create a custom DiffTreeViewer in the top left pane of the CompareProvider.
@@ -51,6 +54,15 @@ public class CVSSyncCompareInput extends SyncCompareInput { return catchupReleaseViewer;
}
+ protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
+ IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
+ for (int i = 0; i < trees.length; i++) {
+ CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resources[i].getProject());
+ trees[i] = provider.getRemoteSyncTree(resources[i], null, monitor);
+ }
+ return trees;
+ }
+
protected void updateView() {
// Update the view
if (getDiffRoot().hasChildren()) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java index 0b9fcf82a..ccd062b9b 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java @@ -70,11 +70,12 @@ public abstract class SyncCompareInput extends CompareEditorInput { /** * Creates a new catchup or release operation. */ - public SyncCompareInput(IRemoteSyncElement[] trees) { + public SyncCompareInput() { super(new CompareConfiguration()); - this.trees = trees; } + protected abstract IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException; + /* * @see CompareEditorInput#createContents */ @@ -193,6 +194,7 @@ public abstract class SyncCompareInput extends CompareEditorInput { } try { + this.trees = createSyncElements(pm); setMessage(null); if (trees.length == 0) { return null; @@ -225,6 +227,8 @@ public abstract class SyncCompareInput extends CompareEditorInput { return diffRoot; } catch (CoreException e) { throw new InvocationTargetException(e); + } catch (TeamException e) { + throw new InvocationTargetException(e); } } |