Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-07-11 18:46:35 +0000
committerMichael Valenta2003-07-11 18:46:35 +0000
commit57a6cb2ccfc28baab88c755a9d305ed514975ddf (patch)
treeee1fdf1971fa9b7640c17aeb2539ee2382f82325 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team
parentc72c00f902129632b35fb6c1eb5678e63b30d10c (diff)
downloadeclipse.platform.team-57a6cb2ccfc28baab88c755a9d305ed514975ddf.tar.gz
eclipse.platform.team-57a6cb2ccfc28baab88c755a9d305ed514975ddf.tar.xz
eclipse.platform.team-57a6cb2ccfc28baab88c755a9d305ed514975ddf.zip
39870: Checkout with backgroud enabled fails
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSWorkspaceModifyOperation.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java8
7 files changed, 29 insertions, 61 deletions
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 9f509c963..27cd58399 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
@@ -76,20 +76,16 @@ public abstract class CVSOperation implements IRunnableWithProgress {
* @throws InterruptedException
* @throws CVSException
*/
- synchronized public void runInContext(IRunnableContext aRunnableContext) throws InterruptedException, CVSException {
- if(areJobsEnabled()) {
- runAsJob();
- } else {
- if (aRunnableContext == null) {
- aRunnableContext = getRunnableContext();
- }
- try {
- aRunnableContext.run(isInterruptable(), isInterruptable(), this);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (OperationCanceledException e) {
- throw new InterruptedException();
- }
+ public void runInContext(IRunnableContext aRunnableContext) throws InterruptedException, CVSException {
+ if (aRunnableContext == null) {
+ aRunnableContext = getRunnableContext();
+ }
+ try {
+ aRunnableContext.run(isInterruptable(), isInterruptable(), this);
+ } catch (InvocationTargetException e) {
+ throw CVSException.wrapException(e);
+ } catch (OperationCanceledException e) {
+ throw new InterruptedException();
}
}
@@ -120,7 +116,7 @@ public abstract class CVSOperation implements IRunnableWithProgress {
* @throws CVSException
* @throws InterruptedException
*/
- public void run() throws CVSException, InterruptedException {
+ public synchronized void run() throws CVSException, InterruptedException {
if(canRunAsJob() && !hasRunnableContext() && areJobsEnabled()) {
runAsJob();
} else {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSWorkspaceModifyOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSWorkspaceModifyOperation.java
index 21b6b7cde..df4b79483 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSWorkspaceModifyOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSWorkspaceModifyOperation.java
@@ -14,13 +14,7 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
/**
@@ -40,33 +34,10 @@ public class CVSWorkspaceModifyOperation extends WorkspaceModifyOperation {
* @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
synchronized protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
- if(CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.BACKGROUND_OPERATIONS)) {
- runAsJob();
- } else {
- try {
- operation.execute(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
+ try {
+ operation.execute(monitor);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
}
}
-
- protected void runAsJob() {
- Job job = new Job(Policy.bind("CVSOperation.workspaceOperationJobName", operation.getTaskName())) {
- public IStatus run(IProgressMonitor monitor) {
- try {
- operation.run(monitor);
- return Status.OK_STATUS;
- } catch (InvocationTargetException e) {
- if(e.getTargetException() instanceof CVSException) {
- return ((CVSException)e.getTargetException()).getStatus();
- }
- return Status.CANCEL_STATUS;
- } catch (InterruptedException e) {
- return Status.CANCEL_STATUS;
- }
- }
- };
- job.schedule();
- }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
index 2449a87a0..2398b626a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
@@ -20,9 +20,6 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
*/
public abstract class CheckoutOperation extends RemoteOperation {
- /**
- * @param shell
- */
public CheckoutOperation(Shell shell, ICVSRemoteFolder[] remoteFolders) {
super(shell, remoteFolders);
}
@@ -37,9 +34,6 @@ public abstract class CheckoutOperation extends RemoteOperation {
checkout(getRemoteFolders(), Policy.subMonitorFor(monitor, 100));
}
- /**
- * @return
- */
protected ICVSRemoteFolder[] getRemoteFolders() {
return (ICVSRemoteFolder[])getRemoteResources();
}
@@ -50,4 +44,11 @@ public abstract class CheckoutOperation extends RemoteOperation {
* @param monitor
*/
protected abstract void checkout(ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob()
+ */
+ public boolean canRunAsJob() {
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
index b50c5d5f7..eb1116078 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
@@ -67,7 +67,7 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
+ public void runInContext(IProgressMonitor monitor) throws CVSException, InterruptedException {
String taskName = getTaskName();
monitor.beginTask(taskName, 100);
monitor.setTaskName(taskName);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java
index f4099a2aa..962696441 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java
@@ -33,7 +33,7 @@ public class HasProjectMetaFileOperation extends CVSOperation {
if (runnableContext != null) {
op.setRunnableContext(runnableContext);
}
- op.execute();
+ op.run();
return op.metaFileExists();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java
index 30031a093..2e1bd46df 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java
@@ -17,7 +17,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSResource;
public interface ITagOperation {
public abstract CVSTag getTag();
public abstract void setTag(CVSTag tag);
- public abstract void executeWithProgress() throws CVSException, InterruptedException;
+ public abstract void run() throws CVSException, InterruptedException;
public abstract ICVSResource[] getCVSResources();
public abstract void moveTag();
public abstract void recurse();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java
index 949d6bcb3..d09eea3ab 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java
@@ -175,7 +175,7 @@ public class CheckoutAsWizard extends Wizard {
IProject newProject = getNewProject();
if (newProject == null) return false;
new CheckoutSingleProjectOperation(getShell(), remoteFolders[0], newProject, null, true)
- .execute(getContainer());
+ .runInContext(getContainer());
return true;
}
@@ -186,7 +186,7 @@ public class CheckoutAsWizard extends Wizard {
IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(mainPage.getProjectName());
String targetLocation = locationSelectionPage.getTargetLocation();
new CheckoutSingleProjectOperation(getShell(), remoteFolders[0], newProject, targetLocation, false)
- .execute(getContainer());
+ .runInContext(getContainer());
return true;
}
@@ -197,7 +197,7 @@ public class CheckoutAsWizard extends Wizard {
private boolean performMultipleCheckoutAs() throws CVSException, InterruptedException {
String targetLocation = locationSelectionPage.getTargetLocation();
new CheckoutMultipleProjectsOperation(getShell(), remoteFolders, targetLocation)
- .execute(getContainer());
+ .runInContext(getContainer());
return true;
}
@@ -212,7 +212,7 @@ public class CheckoutAsWizard extends Wizard {
} else {
operation = new CheckoutIntoOperation(getShell(), remoteFolders, projectSelectionPage.getParentFolder(), recursive);
}
- operation.execute(getContainer());
+ operation.runInContext(getContainer());
return true;
}

Back to the top