diff options
author | Michael Valenta | 2003-07-11 18:44:13 +0000 |
---|---|---|
committer | Michael Valenta | 2003-07-11 18:44:13 +0000 |
commit | c72c00f902129632b35fb6c1eb5678e63b30d10c (patch) | |
tree | 38cd6c4e99c0ed8dd8d316721b55a6cd7135daa4 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal | |
parent | 82104e9a1d564c180a7ccf8d319b2a0528f2aea9 (diff) | |
download | eclipse.platform.team-c72c00f902129632b35fb6c1eb5678e63b30d10c.tar.gz eclipse.platform.team-c72c00f902129632b35fb6c1eb5678e63b30d10c.tar.xz eclipse.platform.team-c72c00f902129632b35fb6c1eb5678e63b30d10c.zip |
39870: Checkout with backgroud enabled fails
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal')
3 files changed, 37 insertions, 17 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java index f93999e6e..aaa43375c 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java @@ -31,7 +31,7 @@ public class CheckoutAction extends CVSAction { protected void execute(IAction action) throws InvocationTargetException, InterruptedException { try { new CheckoutMultipleProjectsOperation(getShell(), getSelectedRemoteFolders(), null) - .executeWithProgress(); + .run(); } catch (CVSException e) { throw new InvocationTargetException(e); } 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 cdb8d42e5..095b16926 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 @@ -65,7 +65,7 @@ public abstract class TagAction extends WorkspaceAction { } try { - result[0].executeWithProgress(); + result[0].run(); } catch (CVSException e1) { throw new InvocationTargetException(e1); } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java index 135210aba..9f509c963 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java @@ -59,7 +59,7 @@ public abstract class CVSOperation implements IRunnableWithProgress { public static void run(Shell shell, CVSOperation operation) throws CVSException, InterruptedException { operation.setShell(shell); operation.setRunnableContext(new ProgressMonitorDialog(shell)); - operation.execute(); + operation.run(); } /** @@ -76,8 +76,8 @@ public abstract class CVSOperation implements IRunnableWithProgress { * @throws InterruptedException * @throws CVSException */ - synchronized public void execute(IRunnableContext aRunnableContext) throws InterruptedException, CVSException { - if(CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.BACKGROUND_OPERATIONS)) { + synchronized public void runInContext(IRunnableContext aRunnableContext) throws InterruptedException, CVSException { + if(areJobsEnabled()) { runAsJob(); } else { if (aRunnableContext == null) { @@ -97,10 +97,10 @@ public abstract class CVSOperation implements IRunnableWithProgress { Job job = new Job(Policy.bind("CVSOperation.operationJobName", getTaskName())) { public IStatus run(IProgressMonitor monitor) { try { - CVSOperation.this.execute(monitor); + CVSOperation.this.run(monitor); return Status.OK_STATUS; - } catch (CVSException e) { - return e.getStatus(); + } catch (InvocationTargetException e) { + return CVSException.wrapException(e).getStatus(); } catch (InterruptedException e) { return Status.CANCEL_STATUS; } @@ -109,19 +109,35 @@ public abstract class CVSOperation implements IRunnableWithProgress { job.schedule(); } - public void executeWithProgress() throws CVSException, InterruptedException { - execute(new ProgressMonitorDialog(getShell())); + /** + * Run the operation. Progress feedback will be provided by one of the following mechanisms + * (in priotiry order): + * <ol> + * <li>the runnable context assigned to the operation + * <li>a background job (if supported by the operation and enabled through the preferences) + * <li>the workbench active page + * </ol> + * @throws CVSException + * @throws InterruptedException + */ + public void run() throws CVSException, InterruptedException { + if(canRunAsJob() && !hasRunnableContext() && areJobsEnabled()) { + runAsJob(); + } else { + runInContext(getRunnableContext()); + } } + protected boolean areJobsEnabled() { + return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.BACKGROUND_OPERATIONS); + } + /** - * Execute the operation in the runnable context that has been assigned to the operation. - * If a context has not been assigned, the workbench window is used. - * - * @throws InterruptedException - * @throws CVSException + * Returns true if the operation can be run as a background job + * @return whether operation can be run as a job */ - public void execute() throws InterruptedException, CVSException { - execute(getRunnableContext()); + public boolean canRunAsJob() { + return false; } /* (non-Javadoc) @@ -177,6 +193,10 @@ public abstract class CVSOperation implements IRunnableWithProgress { this.runnableContext = context; } + public boolean hasRunnableContext() { + return runnableContext != null; + } + /** * @return */ |