mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 02:05:39 +02:00
Bug 375859 - Refresh scope becomes empty after closing/opening project
if left to default
This commit is contained in:
parent
247c492036
commit
38ecfea632
2 changed files with 31 additions and 27 deletions
|
@ -106,6 +106,10 @@ public class RefreshPolicyTab extends AbstractCBuildPropertyTab {
|
||||||
private HashMap<String, HashMap<IResource, List<RefreshExclusion>>> copyHashMap(HashMap<String, HashMap<IResource, List<RefreshExclusion>>> source) {
|
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>>>();
|
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();
|
Iterator<String> config_iterator = source.keySet().iterator();
|
||||||
// for each Configuration ...
|
// for each Configuration ...
|
||||||
while (config_iterator.hasNext()) {
|
while (config_iterator.hasNext()) {
|
||||||
|
@ -137,7 +141,8 @@ public class RefreshPolicyTab extends AbstractCBuildPropertyTab {
|
||||||
|
|
||||||
private void loadInfo() {
|
private void loadInfo() {
|
||||||
HashMap<String, HashMap<IResource, List<RefreshExclusion>>> configMap = fManager.getConfigurationToResourcesMap(fProject);
|
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) {
|
private List<RefreshExclusion> getExclusions(String configName, IResource resource) {
|
||||||
|
|
|
@ -300,8 +300,8 @@ public class RefreshScopeManager {
|
||||||
HashMap<String,HashMap<IResource, List<RefreshExclusion>>> configMap = fProjToConfToResToExcluMap.get(project);
|
HashMap<String,HashMap<IResource, List<RefreshExclusion>>> configMap = fProjToConfToResToExcluMap.get(project);
|
||||||
|
|
||||||
if (configMap == null) {
|
if (configMap == null) {
|
||||||
configMap = new HashMap<String,HashMap<IResource, List<RefreshExclusion>>>();
|
initializeConfigMap(project);
|
||||||
fProjToConfToResToExcluMap.put(project,configMap);
|
configMap = fProjToConfToResToExcluMap.get(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
return configMap;
|
return configMap;
|
||||||
|
@ -463,18 +463,15 @@ public class RefreshScopeManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICStorageElement storageElement = projectDescription.getStorage(
|
ICStorageElement storageElement = projectDescription.getStorage(REFRESH_SCOPE_STORAGE_NAME, true);
|
||||||
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;
|
|
||||||
|
|
||||||
// iterate through the child nodes
|
// iterate through the child nodes
|
||||||
ICStorageElement[] children = storageElement.getChildren();
|
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();
|
ICConfigurationDescription cfgDescs[] = projectDescription.getConfigurations();
|
||||||
for (ICConfigurationDescription cfgDesc : cfgDescs)
|
for (ICConfigurationDescription cfgDesc : cfgDescs)
|
||||||
loadResourceData(workspaceRoot, project, cfgDesc.getName(), children);
|
loadResourceData(workspaceRoot, project, cfgDesc.getName(), children);
|
||||||
|
@ -489,7 +486,7 @@ public class RefreshScopeManager {
|
||||||
// else there are no children, and this is a "new" project.
|
// else there are no children, and this is a "new" project.
|
||||||
// so initialize it.
|
// so initialize it.
|
||||||
if (children.length == 0) {
|
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) {
|
private void initializeConfigMap(IProject project) {
|
||||||
getProjectToConfigurationToResourcesMap();
|
|
||||||
HashMap<String,HashMap<IResource, List<RefreshExclusion>>> configMap = fProjToConfToResToExcluMap.get(project);
|
HashMap<String,HashMap<IResource, List<RefreshExclusion>>> configMap = new HashMap<String,HashMap<IResource, List<RefreshExclusion>>>();
|
||||||
if (configMap == null) {
|
|
||||||
configMap = new HashMap<String,HashMap<IResource, List<RefreshExclusion>>>();
|
// for each build configuration
|
||||||
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
|
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
|
||||||
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(project, false);
|
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(project, false);
|
||||||
ICConfigurationDescription cfgDescs[] = projectDescription.getConfigurations();
|
ICConfigurationDescription cfgDescs[] = projectDescription.getConfigurations();
|
||||||
for (ICConfigurationDescription cfgDesc : cfgDescs) {
|
for (ICConfigurationDescription cfgDesc : cfgDescs) {
|
||||||
String configName = cfgDesc.getName();
|
String configName = cfgDesc.getName();
|
||||||
HashMap<IResource, List<RefreshExclusion>> resourceMap = new HashMap<IResource, List<RefreshExclusion>>();
|
HashMap<IResource, List<RefreshExclusion>> resourceMap = new HashMap<IResource, List<RefreshExclusion>>();
|
||||||
|
if (!fIsLoading)
|
||||||
resourceMap.put(project, new LinkedList<RefreshExclusion>());
|
resourceMap.put(project, new LinkedList<RefreshExclusion>());
|
||||||
configMap.put(configName, resourceMap);
|
configMap.put(configName, resourceMap);
|
||||||
}
|
|
||||||
fProjToConfToResToExcluMap.put(project,configMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// and add this configMap to the project to config map.
|
||||||
|
fProjToConfToResToExcluMap.put(project,configMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue