diff options
| author | Jens Baumgart | 2010-09-09 16:05:07 +0000 |
|---|---|---|
| committer | Matthias Sohn | 2010-09-18 22:06:42 +0000 |
| commit | 71076822f9f2841b2ed0ebb8c75c148ea2692299 (patch) | |
| tree | 20a9c3ca8ba447d88974f88f5989541a74019bc5 | |
| parent | 4c487c493ab3c6c0e8178a51b484b47229844a14 (diff) | |
| download | egit-71076822f9f2841b2ed0ebb8c75c148ea2692299.tar.gz egit-71076822f9f2841b2ed0ebb8c75c148ea2692299.tar.xz egit-71076822f9f2841b2ed0ebb8c75c148ea2692299.zip | |
Avoid loading GitProjectData in case of project deletion
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.java | 33 |
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 2c4071f6e8..db35458745 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 { |
