summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJens Baumgart2010-05-04 11:28:55 (EDT)
committer Jens Baumgart2010-05-04 11:28:55 (EDT)
commitecbcfec5e7062d87dcc25eea33972c1805aca87f (patch)
tree0ffd43c2cedf69cbfe7a45a9339440c297ba564b
parent30235a88e38ab0483798b2e21d62dc76620af152 (diff)
downloadegit-ecbcfec5e7062d87dcc25eea33972c1805aca87f.zip
egit-ecbcfec5e7062d87dcc25eea33972c1805aca87f.tar.gz
egit-ecbcfec5e7062d87dcc25eea33972c1805aca87f.tar.bz2
EGit operation / action refactoringrefs/changes/24/624/3
Replace IWorkspaceRunnable in EGit operations (e.g. BranchOperation) by a new interface IEGitOperation. IWorkspaceRunnable is no good interface for an operation. The user thinks he has to execute the operation using Workspace.run. But that is not right for all EGit operations. Currently many operations are used by just calling op.run. Thus a new interface with an execute method was introduced. Those operations that need a workspace runnable and a scheduling rule do the workspace runnable in their execute method (e.g. branch). It's an internal of an operation how it needs to execute. BranchOperation now uses a workspace runnable to lock the workspace while the working tree is modified. BranchAction executes BranchOperation in a Job. The other actions will be adopted to this execution pattern in further commits. Change-Id: Ia3c1bf157d17632a17b7c678ee45717fb7944f0c Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java2
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_HistoryTest.java2
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java6
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/AddToIndexOperation.java13
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/AssumeUnchangedOperation.java8
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java47
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java8
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/DisconnectProviderOperation.java8
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/IEGitOperation.java25
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/ResetOperation.java8
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/TrackOperation.java12
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/UntrackOperation.java8
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/UpdateOperation.java8
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java12
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java10
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractRevObjectOperation.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AddToIndexAction.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AssumeUnchanged.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchAction.java55
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Disconnect.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/HardResetToRevisionAction.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MixedResetToRevisionAction.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/QuickdiffBaselineOperation.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetAction.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineAction.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineHeadParentAction.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SetQuickdiffBaselineAction.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SoftResetToRevisionAction.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Track.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Untrack.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Update.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCreateProjectViaWizardWizard.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java17
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/SharingWizard.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties2
37 files changed, 181 insertions, 139 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java
index 954ca8e..557df3c 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java
@@ -52,7 +52,7 @@ public class T0003_AdaptableFileTreeIteratorTest extends GitTestCase {
final ConnectProviderOperation operation = new ConnectProviderOperation(
project.getProject(), gitDir);
- operation.run(null);
+ operation.execute(null);
}
@Test
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_HistoryTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_HistoryTest.java
index a20ae58..7e90e24 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_HistoryTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_HistoryTest.java
@@ -111,7 +111,7 @@ public class T0002_HistoryTest extends GitTestCase {
ConnectProviderOperation operation = new ConnectProviderOperation(
project.getProject(), gitDir);
- operation.run(null);
+ operation.execute(null);
}
private void addFile(Tree t,File f) throws IOException {
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java
index 38c84b5..1330014 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java
@@ -46,7 +46,7 @@ public class T0001_ConnectProviderOperationTest extends GitTestCase {
ConnectProviderOperation operation = new ConnectProviderOperation(
project.getProject(), new File("../..", Constants.DOT_GIT));
- operation.run(null);
+ operation.execute(null);
assertFalse(RepositoryProvider.isShared(project.getProject()));
assertTrue(!gitDir.exists());
@@ -62,7 +62,7 @@ public class T0001_ConnectProviderOperationTest extends GitTestCase {
repository.close();
ConnectProviderOperation operation = new ConnectProviderOperation(
project.getProject(), gitDir);
- operation.run(null);
+ operation.execute(null);
assertTrue(RepositoryProvider.isShared(project.getProject()));
@@ -105,7 +105,7 @@ public class T0001_ConnectProviderOperationTest extends GitTestCase {
ConnectProviderOperation operation = new ConnectProviderOperation(
project.getProject(), gitDir);
- operation.run(null);
+ operation.execute(null);
final boolean f[] = new boolean[1];
new Job("wait") {
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/AddToIndexOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/AddToIndexOperation.java
index 904e4a9..474682d 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/AddToIndexOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/AddToIndexOperation.java
@@ -17,7 +17,6 @@ import java.util.IdentityHashMap;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -31,7 +30,7 @@ import org.eclipse.jgit.lib.GitIndex.Entry;
/**
*/
-public class AddToIndexOperation implements IWorkspaceRunnable {
+public class AddToIndexOperation implements IEGitOperation {
private final Collection rsrcList;
private final Collection<IFile> notAddedFiles;
@@ -50,14 +49,10 @@ public class AddToIndexOperation implements IWorkspaceRunnable {
notAddedFiles = new ArrayList<IFile>();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.resources.IWorkspaceRunnable#run(org.eclipse.core.runtime
- * .IProgressMonitor)
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
- public void run(IProgressMonitor m) throws CoreException {
+ public void execute(IProgressMonitor m) throws CoreException {
IProgressMonitor monitor;
if (m == null)
monitor = new NullProgressMonitor();
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/AssumeUnchangedOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/AssumeUnchangedOperation.java
index 01a9c04..1686c6c 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/AssumeUnchangedOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/AssumeUnchangedOperation.java
@@ -18,7 +18,6 @@ import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -35,7 +34,7 @@ import org.eclipse.osgi.util.NLS;
/**
* Tell JGit to ignore changes in selected files
*/
-public class AssumeUnchangedOperation implements IWorkspaceRunnable {
+public class AssumeUnchangedOperation implements IEGitOperation {
private final Collection rsrcList;
private final IdentityHashMap<Repository, DirCache> caches;
@@ -55,7 +54,10 @@ public class AssumeUnchangedOperation implements IWorkspaceRunnable {
mappings = new IdentityHashMap<RepositoryMapping, Object>();
}
- public void run(IProgressMonitor m) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor m) throws CoreException {
if (m == null)
m = new NullProgressMonitor();
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java
index ec9f8fa..06fbbab 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/BranchOperation.java
@@ -13,6 +13,7 @@ package org.eclipse.egit.core.op;
import java.io.IOException;
import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
@@ -33,7 +34,7 @@ import org.eclipse.team.core.TeamException;
* This class implements checkouts of a specific revision. A check
* is made that this can be done without data loss.
*/
-public class BranchOperation implements IWorkspaceRunnable {
+public class BranchOperation implements IEGitOperation {
private final Repository repository;
@@ -61,34 +62,44 @@ public class BranchOperation implements IWorkspaceRunnable {
- public void run(IProgressMonitor monitor) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor monitor) throws CoreException {
if (!refName.startsWith(Constants.R_REFS))
throw new TeamException(NLS.bind(
CoreText.BranchOperation_CheckoutOnlyBranchOrTag, refName));
- monitor.beginTask(NLS.bind(CoreText.BranchOperation_performingBranch,
- refName), 6);
- lookupRefs();
- monitor.worked(1);
+ IWorkspaceRunnable action = new IWorkspaceRunnable() {
+
+ public void run(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask(NLS.bind(
+ CoreText.BranchOperation_performingBranch, refName), 6);
+ lookupRefs();
+ monitor.worked(1);
- mapObjects();
- monitor.worked(1);
+ mapObjects();
+ monitor.worked(1);
- checkoutTree();
- monitor.worked(1);
+ checkoutTree();
+ monitor.worked(1);
- writeIndex();
- monitor.worked(1);
+ writeIndex();
+ monitor.worked(1);
- updateHeadRef();
- monitor.worked(1);
+ updateHeadRef();
+ monitor.worked(1);
- ProjectUtil.refreshProjects(repository, new SubProgressMonitor(monitor,
- 1));
- monitor.worked(1);
+ ProjectUtil.refreshProjects(repository, new SubProgressMonitor(
+ monitor, 1));
+ monitor.worked(1);
- monitor.done();
+ monitor.done();
+ }
+ };
+ // lock workspace to protect working tree changes
+ ResourcesPlugin.getWorkspace().run(action, monitor);
}
private void updateHeadRef() throws TeamException {
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java
index b1777ef..b0a7739 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConnectProviderOperation.java
@@ -19,7 +19,6 @@ import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -38,7 +37,7 @@ import org.eclipse.team.core.RepositoryProvider;
/**
* Connects Eclipse to an existing Git repository
*/
-public class ConnectProviderOperation implements IWorkspaceRunnable {
+public class ConnectProviderOperation implements IEGitOperation {
private final Map<IProject, File> projects = new HashMap<IProject, File>();
/**
@@ -76,7 +75,10 @@ public class ConnectProviderOperation implements IWorkspaceRunnable {
this.projects.putAll(projects);
}
- public void run(IProgressMonitor m) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor m) throws CoreException {
if (m == null) {
m = new NullProgressMonitor();
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/DisconnectProviderOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/DisconnectProviderOperation.java
index 0fd4b71..596cc55 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/DisconnectProviderOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/DisconnectProviderOperation.java
@@ -13,7 +13,6 @@ import java.util.Collection;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -29,7 +28,7 @@ import org.eclipse.team.core.RepositoryProvider;
* Once disconnected, Git operations will no longer be available on the project.
* </p>
*/
-public class DisconnectProviderOperation implements IWorkspaceRunnable {
+public class DisconnectProviderOperation implements IEGitOperation {
private final Collection projectList;
/**
@@ -44,7 +43,10 @@ public class DisconnectProviderOperation implements IWorkspaceRunnable {
projectList = projs;
}
- public void run(IProgressMonitor m) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor m) throws CoreException {
if (m == null) {
m = new NullProgressMonitor();
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/IEGitOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/IEGitOperation.java
new file mode 100644
index 0000000..99fa664
--- /dev/null
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/IEGitOperation.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (C) 2010, Jens Baumgart <jens.baumgart@sap.com>
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.egit.core.op;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * interface for EGit operations
+ *
+ */
+public interface IEGitOperation {
+ /**
+ * Executes the operation
+ * @param monitor
+ * @throws CoreException
+ */
+ void execute(IProgressMonitor monitor) throws CoreException;
+}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ResetOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ResetOperation.java
index 870af40..3fb703f 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ResetOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/ResetOperation.java
@@ -13,7 +13,6 @@ package org.eclipse.egit.core.op;
import java.io.File;
import java.io.IOException;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
@@ -34,7 +33,7 @@ import org.eclipse.team.core.TeamException;
/**
* A class for changing a ref and possibly index and workdir too.
*/
-public class ResetOperation implements IWorkspaceRunnable {
+public class ResetOperation implements IEGitOperation {
/**
* Kind of reset
*/
@@ -76,7 +75,10 @@ public class ResetOperation implements IWorkspaceRunnable {
this.type = type;
}
- public void run(IProgressMonitor monitor) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor monitor) throws CoreException {
monitor.beginTask(NLS.bind(CoreText.ResetOperation_performingReset,
type.toString().toLowerCase(), refName), 7);
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/TrackOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/TrackOperation.java
index d9d104c..2c36428 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/TrackOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/TrackOperation.java
@@ -20,7 +20,6 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -29,10 +28,10 @@ import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.CoreText;
import org.eclipse.egit.core.internal.trace.GitTraceLocation;
import org.eclipse.egit.core.project.RepositoryMapping;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.Team;
import org.eclipse.jgit.lib.GitIndex;
import org.eclipse.jgit.lib.GitIndex.Entry;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.team.core.Team;
/**
* Add one or more new files/folders to the Git repository.
@@ -47,7 +46,7 @@ import org.eclipse.jgit.lib.GitIndex.Entry;
* Resources are only scheduled for addition in the index.
* </p>
*/
-public class TrackOperation implements IWorkspaceRunnable {
+public class TrackOperation implements IEGitOperation {
private final Collection rsrcList;
/**
@@ -61,7 +60,10 @@ public class TrackOperation implements IWorkspaceRunnable {
rsrcList = rsrcs;
}
- public void run(IProgressMonitor m) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor m) throws CoreException {
if (m == null) {
m = new NullProgressMonitor();
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/UntrackOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/UntrackOperation.java
index c763cfc..c6264cf 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/UntrackOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/UntrackOperation.java
@@ -18,7 +18,6 @@ import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -44,7 +43,7 @@ import org.eclipse.osgi.util.NLS;
* Resources are only scheduled for removal in the index-
* </p>
*/
-public class UntrackOperation implements IWorkspaceRunnable {
+public class UntrackOperation implements IEGitOperation {
private final Collection rsrcList;
private final IdentityHashMap<Repository, DirCacheEditor> edits;
@@ -64,7 +63,10 @@ public class UntrackOperation implements IWorkspaceRunnable {
mappings = new IdentityHashMap<RepositoryMapping, Object>();
}
- public void run(IProgressMonitor m) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor m) throws CoreException {
if (m == null)
m = new NullProgressMonitor();
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/UpdateOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/UpdateOperation.java
index fc80349..378cc11 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/UpdateOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/UpdateOperation.java
@@ -12,7 +12,6 @@ package org.eclipse.egit.core.op;
import java.util.Collection;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.egit.core.internal.UpdateJob;
@@ -26,7 +25,7 @@ import org.eclipse.egit.core.internal.UpdateJob;
* collection can be associated with multiple repositories.
* </p>
*/
-public class UpdateOperation implements IWorkspaceRunnable {
+public class UpdateOperation implements IEGitOperation {
private final Collection rsrcList;
/**
@@ -40,7 +39,10 @@ public class UpdateOperation implements IWorkspaceRunnable {
rsrcList = rsrcs;
}
- public void run(IProgressMonitor m) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor m) throws CoreException {
new UpdateJob(rsrcList).schedule();
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
index 613edc0..19d4dcf 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
@@ -421,4 +421,16 @@ public class Activator extends AbstractUIPlugin {
handleError(message, e, false);
}
+ /**
+ * Creates an error status
+ *
+ * @param message
+ * a localized message
+ * @param throwable
+ * @return a new Status object
+ */
+ public static IStatus createErrorStatus(String message, Throwable throwable) {
+ return new Status(IStatus.ERROR, getPluginId(), message, throwable);
+ }
+
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index be35f96..c2f8fa4 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -1270,9 +1270,15 @@ public class UIText extends NLS {
public static String WindowCachePreferencePage_packedGitMMAP;
/** */
+ public static String BranchAction_branchFailed;
+
+ /** */
public static String BranchAction_cannotCheckout;
/** */
+ public static String BranchAction_checkingOut;
+
+ /** */
public static String BranchAction_errorSwitchingBranches;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java
index 00b2dec..38f3312 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractOperationAction.java
@@ -13,11 +13,11 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
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.egit.core.op.IEGitOperation;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIText;
import org.eclipse.jface.action.IAction;
@@ -38,7 +38,7 @@ public abstract class AbstractOperationAction implements IObjectActionDelegate {
*/
protected IWorkbenchPart wp;
- private IWorkspaceRunnable op;
+ private IEGitOperation op;
private List selection;
@@ -58,9 +58,9 @@ public abstract class AbstractOperationAction implements IObjectActionDelegate {
* Instantiate an operation on an action on provided objects.
* @param selection
*
- * @return a {@link IWorkspaceRunnable} for invoking this operation later on
+ * @return a {@link IEGitOperation} for invoking this operation later on
*/
- protected abstract IWorkspaceRunnable createOperation(final List selection);
+ protected abstract IEGitOperation createOperation(final List selection);
/**
* A method to invoke when the operation is finished.
@@ -79,7 +79,7 @@ public abstract class AbstractOperationAction implements IObjectActionDelegate {
public void run(final IProgressMonitor monitor)
throws InvocationTargetException {
try {
- op.run(monitor);
+ op.execute(monitor);
} catch (CoreException ce) {
throw new InvocationTargetException(ce);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractRevObjectOperation.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractRevObjectOperation.java
index d493ed2..b69c8f3 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractRevObjectOperation.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AbstractRevObjectOperation.java
@@ -8,10 +8,10 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.actions;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.jgit.lib.Repository;
-abstract class AbstractRevObjectOperation implements IWorkspaceRunnable {
+abstract class AbstractRevObjectOperation implements IEGitOperation {
Repository repository;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AddToIndexAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AddToIndexAction.java
index 179bf9d..880d9e3 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AddToIndexAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AddToIndexAction.java
@@ -12,8 +12,8 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.egit.core.op.AddToIndexOperation;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.egit.ui.UIText;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -25,7 +25,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
public class AddToIndexAction extends AbstractOperationAction {
private AddToIndexOperation operation = null;
- protected IWorkspaceRunnable createOperation(final List sel) {
+ protected IEGitOperation createOperation(final List sel) {
if (sel.isEmpty()) {
return null;
} else {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AssumeUnchanged.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AssumeUnchanged.java
index e8bec36..38fb364 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AssumeUnchanged.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/AssumeUnchanged.java
@@ -11,8 +11,8 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.egit.core.op.AssumeUnchangedOperation;
+import org.eclipse.egit.core.op.IEGitOperation;
/**
* This operation sets the assume-valid bit in the index for the
@@ -21,7 +21,7 @@ import org.eclipse.egit.core.op.AssumeUnchangedOperation;
* @see AssumeUnchangedOperation
*/
public class AssumeUnchanged extends AbstractOperationAction {
- protected IWorkspaceRunnable createOperation(final List sel) {
+ protected IEGitOperation createOperation(final List sel) {
return sel.isEmpty() ? null : new AssumeUnchangedOperation(sel);
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchAction.java
index f7d6199..6e603d1 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchAction.java
@@ -14,19 +14,19 @@ 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.egit.core.op.BranchOperation;
+import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIText;
import org.eclipse.egit.ui.internal.decorators.GitLightweightDecorator;
import org.eclipse.egit.ui.internal.dialogs.BranchSelectionDialog;
-import org.eclipse.egit.ui.internal.trace.GitTraceLocation;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.window.Window;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.TeamException;
/**
* Action for selecting a branch and checking it out.
@@ -54,37 +54,24 @@ public class BranchAction extends RepositoryAction {
}
final String refName = dialog.getRefName();
- try {
- getTargetPart().getSite().getWorkbenchWindow().run(true, false,
- new IRunnableWithProgress() {
- public void run(final IProgressMonitor monitor)
- throws InvocationTargetException {
- try {
- new BranchOperation(repository, refName).run(monitor);
- GitLightweightDecorator.refresh();
- } catch (final CoreException e) {
- if (GitTraceLocation.UI.isActive())
- GitTraceLocation.getTrace().trace(GitTraceLocation.UI.getLocation(), e.getMessage(), e);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- handle(
- new TeamException(e.getStatus()),
- UIText.BranchAction_errorSwitchingBranches,
- UIText.BranchAction_unableToSwitchBranches);
- }
- });
- }
+
+ String jobname = NLS.bind(UIText.BranchAction_checkingOut, refName);
+ Job job = new Job(jobname) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ new BranchOperation(repository, refName).execute(monitor);
+ } catch (CoreException e) {
+ return Activator.createErrorStatus(
+ UIText.BranchAction_branchFailed, e);
+ } finally {
+ GitLightweightDecorator.refresh();
}
- });
- } catch (InvocationTargetException e) {
- if (GitTraceLocation.UI.isActive())
- GitTraceLocation.getTrace().trace(GitTraceLocation.UI.getLocation(), e.getMessage(), e);
- throw e;
- } catch (InterruptedException e) {
- if (GitTraceLocation.UI.isActive())
- GitTraceLocation.getTrace().trace(GitTraceLocation.UI.getLocation(), e.getMessage(), e);
- throw new InvocationTargetException(e);
- }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setUser(true);
+ job.schedule();
}
@Override
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Disconnect.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Disconnect.java
index 0beecf5..72ce717 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Disconnect.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Disconnect.java
@@ -11,8 +11,8 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.egit.core.op.DisconnectProviderOperation;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.egit.ui.internal.decorators.GitLightweightDecorator;
/**
@@ -21,7 +21,7 @@ import org.eclipse.egit.ui.internal.decorators.GitLightweightDecorator;
* @see DisconnectProviderOperation
*/
public class Disconnect extends AbstractOperationAction {
- protected IWorkspaceRunnable createOperation(final List sel) {
+ protected IEGitOperation createOperation(final List sel) {
return sel.isEmpty() ? null : new DisconnectProviderOperation(sel);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/HardResetToRevisionAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/HardResetToRevisionAction.java
index 255f66a..1c126ce 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/HardResetToRevisionAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/HardResetToRevisionAction.java
@@ -10,7 +10,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.egit.core.op.ResetOperation;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -20,7 +20,7 @@ import org.eclipse.jgit.lib.AnyObjectId;
public class HardResetToRevisionAction extends AbstractRevObjectAction {
@Override
- protected IWorkspaceRunnable createOperation(List selection) {
+ protected IEGitOperation createOperation(List selection) {
return new ResetOperation(getActiveRepository(),
((AnyObjectId) selection.get(0)).name(),
ResetOperation.ResetType.HARD);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MixedResetToRevisionAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MixedResetToRevisionAction.java
index e2a3aaf..f6459f4 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MixedResetToRevisionAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MixedResetToRevisionAction.java
@@ -10,7 +10,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.egit.core.op.ResetOperation;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -20,7 +20,7 @@ import org.eclipse.jgit.lib.AnyObjectId;
public class MixedResetToRevisionAction extends AbstractRevObjectAction {
@Override
- protected IWorkspaceRunnable createOperation(List selection) {
+ protected IEGitOperation createOperation(List selection) {
return new ResetOperation(getActiveRepository(),
((AnyObjectId) selection.get(0)).name(),
ResetOperation.ResetType.MIXED);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/QuickdiffBaselineOperation.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/QuickdiffBaselineOperation.java
index 29601f2..ef90d7f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/QuickdiffBaselineOperation.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/QuickdiffBaselineOperation.java
@@ -35,7 +35,10 @@ public class QuickdiffBaselineOperation extends AbstractRevObjectOperation {
this.baseline = baseline;
}
- public void run(IProgressMonitor monitor) throws CoreException {
+ /* (non-Javadoc)
+ * @see org.eclipse.egit.core.op.IEGitOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor monitor) throws CoreException {
try {
GitQuickDiffProvider.setBaselineReference(repository, baseline);
} catch (IOException e) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetAction.java
index a6cc1f8..abcee6d 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetAction.java
@@ -58,7 +58,7 @@ public class ResetAction extends RepositoryAction {
public void run(final IProgressMonitor monitor)
throws InvocationTargetException {
try {
- new ResetOperation(repository, refName, type).run(monitor);
+ new ResetOperation(repository, refName, type).execute(monitor);
GitLightweightDecorator.refresh();
} catch (CoreException e) {
if (GitTraceLocation.UI.isActive())
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineAction.java
index abdfe53..392f605 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineAction.java
@@ -10,7 +10,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.jgit.lib.Constants;
/**
@@ -19,7 +19,7 @@ import org.eclipse.jgit.lib.Constants;
public class ResetQuickdiffBaselineAction extends AbstractRevObjectAction {
@Override
- protected IWorkspaceRunnable createOperation(List selection) {
+ protected IEGitOperation createOperation(List selection) {
return new QuickdiffBaselineOperation(getActiveRepository(), Constants.HEAD);
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineHeadParentAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineHeadParentAction.java
index 90aa6cb..71e9dec 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineHeadParentAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ResetQuickdiffBaselineHeadParentAction.java
@@ -10,7 +10,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
/**
* Changes the reference for the quickdiff to the (first) parent of HEAD
@@ -18,7 +18,7 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
public class ResetQuickdiffBaselineHeadParentAction extends AbstractRevObjectAction {
@Override
- protected IWorkspaceRunnable createOperation(List selection) {
+ protected IEGitOperation createOperation(List selection) {
return new QuickdiffBaselineOperation(getActiveRepository(), "HEAD^1"); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SetQuickdiffBaselineAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SetQuickdiffBaselineAction.java
index 03cdade..062b525 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SetQuickdiffBaselineAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SetQuickdiffBaselineAction.java
@@ -10,7 +10,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.jgit.revwalk.RevObject;
/**
@@ -19,7 +19,7 @@ import org.eclipse.jgit.revwalk.RevObject;
public class SetQuickdiffBaselineAction extends AbstractRevObjectAction {
@Override
- protected IWorkspaceRunnable createOperation(List selection) {
+ protected IEGitOperation createOperation(List selection) {
return new QuickdiffBaselineOperation(getActiveRepository(), ((RevObject)selection.get(0)).getId().name());
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SoftResetToRevisionAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SoftResetToRevisionAction.java
index bddc332..1e6d724 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SoftResetToRevisionAction.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SoftResetToRevisionAction.java
@@ -10,7 +10,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.egit.core.op.ResetOperation;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -20,7 +20,7 @@ import org.eclipse.jgit.lib.AnyObjectId;
public class SoftResetToRevisionAction extends AbstractRevObjectAction {
@Override
- protected IWorkspaceRunnable createOperation(List selection) {
+ protected IEGitOperation createOperation(List selection) {
return new ResetOperation(getActiveRepository(),
((AnyObjectId) selection.get(0)).name(),
ResetOperation.ResetType.SOFT);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Track.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Track.java
index 68a48e4..a68e354 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Track.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Track.java
@@ -39,7 +39,7 @@ public class Track extends RepositoryAction {
throws InvocationTargetException,
InterruptedException {
try {
- op.run(arg0);
+ op.execute(arg0);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Untrack.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Untrack.java
index 35e04b0..f084f6b 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Untrack.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Untrack.java
@@ -11,7 +11,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.egit.core.op.UntrackOperation;
/**
@@ -21,7 +21,7 @@ import org.eclipse.egit.core.op.UntrackOperation;
* @see UntrackOperation
*/
public class Untrack extends AbstractOperationAction {
- protected IWorkspaceRunnable createOperation(final List sel) {
+ protected IEGitOperation createOperation(final List sel) {
return sel.isEmpty() ? null : new UntrackOperation(sel);
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Update.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Update.java
index ae63ca4..dfd7a28 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Update.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/Update.java
@@ -11,7 +11,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.util.List;
-import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.egit.core.op.IEGitOperation;
import org.eclipse.egit.core.op.UpdateOperation;
/**
@@ -20,7 +20,7 @@ import org.eclipse.egit.core.op.UpdateOperation;
* @see UpdateOperation
*/
public class Update extends AbstractOperationAction {
- protected IWorkspaceRunnable createOperation(final List sel) {
+ protected IEGitOperation createOperation(final List sel) {
return sel.isEmpty() ? null : new UpdateOperation(sel);
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCreateProjectViaWizardWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCreateProjectViaWizardWizard.java
index ece7e60..0068c41 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCreateProjectViaWizardWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCreateProjectViaWizardWizard.java
@@ -195,7 +195,7 @@ public class GitCreateProjectViaWizardWizard extends Wizard {
ConnectProviderOperation connectProviderOperation = new ConnectProviderOperation(
prj, myRepository.getDirectory());
try {
- connectProviderOperation.run(monitor);
+ connectProviderOperation.execute(monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java
index 38732a4..69095bf 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitProjectsImportPage.java
@@ -723,7 +723,7 @@ public class GitProjectsImportPage extends WizardPage {
ConnectProviderOperation connectProviderOperation = new ConnectProviderOperation(
project, gitRepositoryDir);
connectProviderOperation
- .run(new SubProgressMonitor(monitor, 20));
+ .execute(new SubProgressMonitor(monitor, 20));
}
} catch (CoreException e) {
throw new InvocationTargetException(e);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
index 4edffc1..f414431 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
@@ -460,7 +460,7 @@ public class RepositoriesView extends ViewPart implements ISelectionProvider,
ConnectProviderOperation connectProviderOperation = new ConnectProviderOperation(
project, gitDir);
connectProviderOperation
- .run(new SubProgressMonitor(monitor, 20));
+ .execute(new SubProgressMonitor(monitor, 20));
}
@@ -518,26 +518,13 @@ public class RepositoriesView extends ViewPart implements ISelectionProvider,
final BranchOperation op = new BranchOperation(
repo, refName);
- IWorkspaceRunnable wsr = new IWorkspaceRunnable() {
-
- public void run(IProgressMonitor myMonitor)
- throws CoreException {
- op.run(myMonitor);
- }
- };
-
try {
- ResourcesPlugin.getWorkspace().run(
- wsr,
- ResourcesPlugin.getWorkspace()
- .getRoot(),
- IWorkspace.AVOID_UPDATE, monitor);
+ op.execute(monitor);
scheduleRefresh();
} catch (CoreException e1) {
return new Status(IStatus.ERROR, Activator
.getPluginId(), e1.getMessage(), e1);
}
-
return Status.OK_STATUS;
}
};
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/SharingWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/SharingWizard.java
index a44c3b7..7f43151 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/SharingWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/SharingWizard.java
@@ -65,7 +65,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard,
public void run(final IProgressMonitor monitor)
throws InvocationTargetException {
try {
- op.run(monitor);
+ op.execute(monitor);
} catch (CoreException ce) {
throw new InvocationTargetException(ce);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index c72ecab..3a4d3f3 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -459,7 +459,9 @@ WindowCachePreferencePage_packedGitLimit=Window cache limit:
WindowCachePreferencePage_deltaBaseCacheLimit=Delta base cache limit:
WindowCachePreferencePage_packedGitMMAP=Use virtual memory mapping
+BranchAction_branchFailed=Branch failed
BranchAction_cannotCheckout=Cannot checkout now
+BranchAction_checkingOut=Checking out {0}
BranchAction_errorSwitchingBranches=Error while switching branches
BranchAction_repositoryState=Repository state: {0}
BranchAction_unableToSwitchBranches=Unable to switch branches