summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJens Baumgart2010-09-09 12:05:07 (EDT)
committer Matthias Sohn2010-09-18 18:06:42 (EDT)
commit71076822f9f2841b2ed0ebb8c75c148ea2692299 (patch)
tree20a9c3ca8ba447d88974f88f5989541a74019bc5
parent4c487c493ab3c6c0e8178a51b484b47229844a14 (diff)
downloadegit-71076822f9f2841b2ed0ebb8c75c148ea2692299.zip
egit-71076822f9f2841b2ed0ebb8c75c148ea2692299.tar.gz
egit-71076822f9f2841b2ed0ebb8c75c148ea2692299.tar.bz2
Avoid loading GitProjectData in case of project deletionrefs/changes/74/1574/2
Loading GitProjectData in case of deletion of closed projects caused a ResourceException. Deletion is now performed without loading GitProjectData. Bug: 309942 Change-Id: Ib3a496d590b7810ad3f85c89be0d8ce4640f129f Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java33
1 files changed, 18 insertions, 15 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
index 2c4071f..db35458 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
@@ -178,14 +178,10 @@ public class GitProjectData {
public static void delete(final IProject p) {
trace("delete(" + p.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
GitProjectData d = lookup(p);
- if (d == null) {
- try {
- d = new GitProjectData(p).load();
- } catch (IOException ioe) {
- d = new GitProjectData(p);
- }
- }
- d.delete();
+ if (d == null)
+ deletePropertyFiles(p);
+ else
+ d.deletePropertyFilesAndUncache();
}
static void trace(final String m) {
@@ -320,8 +316,13 @@ public class GitProjectData {
return null;
}
- private void delete() {
- final File dir = propertyFile().getParentFile();
+ private void deletePropertyFilesAndUncache() {
+ deletePropertyFiles(getProject());
+ uncache(getProject());
+ }
+
+ private static void deletePropertyFiles(IProject project) {
+ final File dir = propertyFile(project).getParentFile();
final File[] todel = dir.listFiles();
if (todel != null) {
for (int k = 0; k < todel.length; k++) {
@@ -332,9 +333,8 @@ public class GitProjectData {
}
dir.delete();
trace("deleteDataFor(" //$NON-NLS-1$
- + getProject().getName()
+ + project.getName()
+ ")"); //$NON-NLS-1$
- uncache(getProject());
}
/**
@@ -381,9 +381,12 @@ public class GitProjectData {
}
private File propertyFile() {
- return new File(getProject()
- .getWorkingLocation(Activator.getPluginId()).toFile(),
- "GitProjectData.properties"); //$NON-NLS-1$
+ return propertyFile(getProject());
+ }
+
+ private static File propertyFile(IProject project) {
+ return new File(project.getWorkingLocation(Activator.getPluginId())
+ .toFile(), "GitProjectData.properties"); //$NON-NLS-1$
}
private GitProjectData load() throws IOException {