aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceManager.java9
-rw-r--r--ide_common/src/com/android/ide/common/resources/ResourceRepository.java12
2 files changed, 19 insertions, 2 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceManager.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceManager.java
index edae923..bfa942d 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceManager.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ResourceManager.java
@@ -155,7 +155,14 @@ public final class ResourceManager {
*/
public ProjectResources getProjectResources(IProject project) {
synchronized (mMap) {
- return mMap.get(project);
+ ProjectResources resources = mMap.get(project);
+
+ if (resources == null) {
+ resources = new ProjectResources(project);
+ mMap.put(project, resources);
+ }
+
+ return resources;
}
}
diff --git a/ide_common/src/com/android/ide/common/resources/ResourceRepository.java b/ide_common/src/com/android/ide/common/resources/ResourceRepository.java
index 87d729d..3040dc0 100644
--- a/ide_common/src/com/android/ide/common/resources/ResourceRepository.java
+++ b/ide_common/src/com/android/ide/common/resources/ResourceRepository.java
@@ -355,7 +355,17 @@ public abstract class ResourceRepository {
* @return the {@link ResourceFolder} or null if it was not found.
*/
public ResourceFolder getResourceFolder(IAbstractFolder folder) {
- for (List<ResourceFolder> list : mFolderMap.values()) {
+ Collection<List<ResourceFolder>> values = mFolderMap.values();
+
+ if (values.isEmpty()) { // This shouldn't be necessary, but has been observed
+ try {
+ loadResources(folder.getParentFolder());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ for (List<ResourceFolder> list : values) {
for (ResourceFolder resFolder : list) {
IAbstractFolder wrapper = resFolder.getFolder();
if (wrapper.equals(folder)) {