summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Salinas2012-04-27 15:19:40 (EDT)
committerVivian Kong2012-04-27 15:19:40 (EDT)
commit38ecfea632f85ed186af20738442f44433a2e866 (patch)
treeeb3add3b741029ef715f47503a5158433e795524
parent247c492036de5306c747d630774388aa2e073316 (diff)
downloadorg.eclipse.cdt-38ecfea632f85ed186af20738442f44433a2e866.zip
org.eclipse.cdt-38ecfea632f85ed186af20738442f44433a2e866.tar.gz
org.eclipse.cdt-38ecfea632f85ed186af20738442f44433a2e866.tar.bz2
Bug 375859 - Refresh scope becomes empty after closing/opening project
if left to default
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java7
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/RefreshScopeManager.java51
2 files changed, 31 insertions, 27 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java
index 569bb5e..2bb3664 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/RefreshPolicyTab.java
@@ -106,6 +106,10 @@ public class RefreshPolicyTab extends AbstractCBuildPropertyTab {
private HashMap<String, HashMap<IResource, List<RefreshExclusion>>> copyHashMap(HashMap<String, HashMap<IResource, List<RefreshExclusion>>> source) {
HashMap<String, HashMap<IResource, List<RefreshExclusion>>> target = new HashMap<String, HashMap<IResource, List<RefreshExclusion>>>();
+
+ if (source.size() == 0)
+ return null;
+
Iterator<String> config_iterator = source.keySet().iterator();
// for each Configuration ...
while (config_iterator.hasNext()) {
@@ -137,7 +141,8 @@ public class RefreshPolicyTab extends AbstractCBuildPropertyTab {
private void loadInfo() {
HashMap<String, HashMap<IResource, List<RefreshExclusion>>> configMap = fManager.getConfigurationToResourcesMap(fProject);
- fConfigurationToResourcesToExclusionsMap = copyHashMap(configMap);
+ if ( (configMap != null) && !(configMap.isEmpty()))
+ fConfigurationToResourcesToExclusionsMap = copyHashMap(configMap);
}
private List<RefreshExclusion> getExclusions(String configName, IResource resource) {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/RefreshScopeManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/RefreshScopeManager.java
index d8941f9..33af877 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/RefreshScopeManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/RefreshScopeManager.java
@@ -300,8 +300,8 @@ public class RefreshScopeManager {
HashMap<String,HashMap<IResource, List<RefreshExclusion>>> configMap = fProjToConfToResToExcluMap.get(project);
if (configMap == null) {
- configMap = new HashMap<String,HashMap<IResource, List<RefreshExclusion>>>();
- fProjToConfToResToExcluMap.put(project,configMap);
+ initializeConfigMap(project);
+ configMap = fProjToConfToResToExcluMap.get(project);
}
return configMap;
@@ -463,18 +463,15 @@ public class RefreshScopeManager {
return;
}
- ICStorageElement storageElement = projectDescription.getStorage(
- REFRESH_SCOPE_STORAGE_NAME, true);
-
- // walk the tree and load the settings
-
- String str = storageElement.getAttribute(VERSION_NUMBER_ATTRIBUTE_NAME);
- int version = (str != null) ? Integer.valueOf(str) : 2;
+ ICStorageElement storageElement = projectDescription.getStorage(REFRESH_SCOPE_STORAGE_NAME, true);
// iterate through the child nodes
ICStorageElement[] children = storageElement.getChildren();
-
- if (version == 1) {
+
+ // walk the tree and load the settings
+ String str = storageElement.getAttribute(VERSION_NUMBER_ATTRIBUTE_NAME);
+
+ if ((str == null) || (str.equals("1"))) { //$NON-NLS-1$
ICConfigurationDescription cfgDescs[] = projectDescription.getConfigurations();
for (ICConfigurationDescription cfgDesc : cfgDescs)
loadResourceData(workspaceRoot, project, cfgDesc.getName(), children);
@@ -489,7 +486,7 @@ public class RefreshScopeManager {
// else there are no children, and this is a "new" project.
// so initialize it.
if (children.length == 0) {
- initializeConfigMap(project);
+ getConfigurationToResourcesMap(project); // this will initialize the config map.
}
}
}
@@ -497,21 +494,23 @@ public class RefreshScopeManager {
}
private void initializeConfigMap(IProject project) {
- getProjectToConfigurationToResourcesMap();
- HashMap<String,HashMap<IResource, List<RefreshExclusion>>> configMap = fProjToConfToResToExcluMap.get(project);
- if (configMap == null) {
- configMap = new HashMap<String,HashMap<IResource, List<RefreshExclusion>>>();
- CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
- ICProjectDescription projectDescription = descriptionManager.getProjectDescription(project, false);
- ICConfigurationDescription cfgDescs[] = projectDescription.getConfigurations();
- for (ICConfigurationDescription cfgDesc : cfgDescs) {
- String configName = cfgDesc.getName();
- HashMap<IResource, List<RefreshExclusion>> resourceMap = new HashMap<IResource, List<RefreshExclusion>>();
- resourceMap.put(project, new LinkedList<RefreshExclusion>());
- configMap.put(configName, resourceMap);
- }
- fProjToConfToResToExcluMap.put(project,configMap);
+
+ HashMap<String,HashMap<IResource, List<RefreshExclusion>>> configMap = new HashMap<String,HashMap<IResource, List<RefreshExclusion>>>();
+
+ // for each build configuration
+ CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
+ ICProjectDescription projectDescription = descriptionManager.getProjectDescription(project, false);
+ ICConfigurationDescription cfgDescs[] = projectDescription.getConfigurations();
+ for (ICConfigurationDescription cfgDesc : cfgDescs) {
+ String configName = cfgDesc.getName();
+ HashMap<IResource, List<RefreshExclusion>> resourceMap = new HashMap<IResource, List<RefreshExclusion>>();
+ if (!fIsLoading)
+ resourceMap.put(project, new LinkedList<RefreshExclusion>());
+ configMap.put(configName, resourceMap);
}
+
+ // and add this configMap to the project to config map.
+ fProjToConfToResToExcluMap.put(project,configMap);
}
/**