aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSnjezana Peco2012-11-29 19:50:07 (EST)
committerMatthias Sohn2013-01-14 20:00:40 (EST)
commitcda156e9a1460c0aac4040338b5615d5c406e723 (patch)
treeacfcc6184052ff272cb70e18a87dfc233bcfa23c
parent20f26fd014a3cadca5775cbdb8a14701c8b71a7d (diff)
downloadegit-cda156e9a1460c0aac4040338b5615d5c406e723.zip
egit-cda156e9a1460c0aac4040338b5615d5c406e723.tar.gz
egit-cda156e9a1460c0aac4040338b5615d5c406e723.tar.bz2
Can not delete git projectrefs/changes/64/9564/9
Steps to reproduce: - ensure the Git decorator is enabled - import a project to Eclipse using the Import Project from Git wizard - try to delete the project including its contents Deleting will fail - delete the project without its contents - try to delete the project's directory using an OS command Deleting will fail The issue can always be reproduced on Windows. As to Linux, it can be reproduced when cloning the project to a mounted NFS device. For more details, see https://issues.jboss.org/browse/JBIDE-10398 . Bug: 395488 Change-Id: Iae1be7fa4c3419f2a7fddcacb04679e85c83d490 Signed-off-by: Snjezana Peco <snjeza.peco@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
index 64d0680..d6d8ca5 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
@@ -39,6 +39,7 @@ import org.eclipse.egit.core.project.RepositoryFinder;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.core.securestorage.EGitSecureStore;
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
+import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.util.FS;
import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener;
@@ -57,6 +58,7 @@ public class Activator extends Plugin implements DebugOptionsListener {
private RepositoryUtil repositoryUtil;
private EGitSecureStore secureStore;
private AutoShareProjects shareGitProjectsJob;
+ private IResourceChangeListener preDeleteProjectListener;
/**
* @return the singleton {@link Activator}
@@ -135,6 +137,27 @@ public class Activator extends Plugin implements DebugOptionsListener {
secureStore = new EGitSecureStore(SecurePreferencesFactory.getDefault());
registerAutoShareProjects();
+ registerPreDeleteResourceChangeListener();
+ }
+
+ private void registerPreDeleteResourceChangeListener() {
+ if (preDeleteProjectListener == null) {
+ preDeleteProjectListener = new IResourceChangeListener() {
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResource resource = event.getResource();
+ if (resource instanceof IProject) {
+ IProject project = (IProject) resource;
+ if (RepositoryProvider.getProvider(project) instanceof GitProvider) {
+ IResource dotGit = project.findMember(Constants.DOT_GIT);
+ if (dotGit != null && dotGit.getType() == IResource.FOLDER)
+ GitProjectData.reconfigureWindowCache();
+ }
+ }
+ }
+ };
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(preDeleteProjectListener, IResourceChangeEvent.PRE_DELETE);
+ }
}
public void optionsChanged(DebugOptions options) {
@@ -179,6 +202,10 @@ public class Activator extends Plugin implements DebugOptionsListener {
secureStore = null;
super.stop(context);
plugin = null;
+ if (preDeleteProjectListener != null) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(preDeleteProjectListener);
+ preDeleteProjectListener = null;
+ }
}
private void registerAutoShareProjects() {