mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Warnings & generics
This commit is contained in:
parent
a03ba7b610
commit
28d8d197e3
1 changed files with 22 additions and 13 deletions
|
@ -59,6 +59,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main hook ManagedBuild uses to connect to cdt.core's project model.
|
||||||
|
* Provides & Persists Build configuration data in the project model storage.
|
||||||
|
*/
|
||||||
public class ConfigurationDataProvider extends CConfigurationDataProvider implements ISettingsChangeListener {
|
public class ConfigurationDataProvider extends CConfigurationDataProvider implements ISettingsChangeListener {
|
||||||
private static final String BUILD_SYSTEM_DATA_MODULE_NAME = "cdtBuildSystem"; //$NON-NLS-1$
|
private static final String BUILD_SYSTEM_DATA_MODULE_NAME = "cdtBuildSystem"; //$NON-NLS-1$
|
||||||
private static final String VERSION_ATTRIBUTE = "version"; //$NON-NLS-1$
|
private static final String VERSION_ATTRIBUTE = "version"; //$NON-NLS-1$
|
||||||
|
@ -136,6 +140,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
return appliedCfg;
|
return appliedCfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CConfigurationData applyConfiguration(
|
public CConfigurationData applyConfiguration(
|
||||||
ICConfigurationDescription des,
|
ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
|
@ -217,6 +222,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public CConfigurationData createConfiguration(
|
public CConfigurationData createConfiguration(
|
||||||
ICConfigurationDescription des,
|
ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
|
@ -395,21 +401,21 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
private static Configuration adjustPreferenceConfig(Configuration cfg){
|
private static Configuration adjustPreferenceConfig(Configuration cfg){
|
||||||
LanguageManager mngr = LanguageManager.getInstance();
|
LanguageManager mngr = LanguageManager.getInstance();
|
||||||
ILanguageDescriptor dess[] = mngr.getLanguageDescriptors();
|
ILanguageDescriptor dess[] = mngr.getLanguageDescriptors();
|
||||||
Map map = mngr.getContentTypeIdToLanguageDescriptionsMap();
|
Map<String, ILanguageDescriptor[]> map = mngr.getContentTypeIdToLanguageDescriptionsMap();
|
||||||
|
|
||||||
IResourceInfo[] rcInfos = cfg.getResourceInfos();
|
IResourceInfo[] rcInfos = cfg.getResourceInfos();
|
||||||
for(int i = 0; i < rcInfos.length; i++){
|
for(int i = 0; i < rcInfos.length; i++){
|
||||||
if(rcInfos[i] instanceof IFolderInfo){
|
if(rcInfos[i] instanceof IFolderInfo){
|
||||||
adjustFolderInfo((IFolderInfo)rcInfos[i], dess, new HashMap(map));
|
adjustFolderInfo((IFolderInfo)rcInfos[i], dess, new HashMap<Object, ILanguageDescriptor[]>(map));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void adjustFolderInfo(IFolderInfo info, ILanguageDescriptor dess[], HashMap map){
|
private static void adjustFolderInfo(IFolderInfo info, ILanguageDescriptor dess[], HashMap<Object, ILanguageDescriptor[]> map){
|
||||||
IToolChain tch = info.getToolChain();
|
IToolChain tch = info.getToolChain();
|
||||||
Map langMap = new HashMap();
|
Map<String, ILanguageDescriptor> langMap = new HashMap<String, ILanguageDescriptor>();
|
||||||
for(int i = 0; i < dess.length; i++){
|
for(int i = 0; i < dess.length; i++){
|
||||||
langMap.put(dess[i].getId(), dess[i]);
|
langMap.put(dess[i].getId(), dess[i]);
|
||||||
}
|
}
|
||||||
|
@ -422,7 +428,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
InputType type = (InputType)types[k];
|
InputType type = (InputType)types[k];
|
||||||
String langId = type.getLanguageId(tool);
|
String langId = type.getLanguageId(tool);
|
||||||
if(langId != null){
|
if(langId != null){
|
||||||
ILanguageDescriptor des = (ILanguageDescriptor)langMap.remove(langId);
|
ILanguageDescriptor des = langMap.remove(langId);
|
||||||
if(des != null)
|
if(des != null)
|
||||||
adjustInputType(tool, type, des);
|
adjustInputType(tool, type, des);
|
||||||
continue;
|
continue;
|
||||||
|
@ -430,7 +436,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
IContentType[] cTypes = type.getSourceContentTypes();
|
IContentType[] cTypes = type.getSourceContentTypes();
|
||||||
for(int c = 0; c < cTypes.length; c++){
|
for(int c = 0; c < cTypes.length; c++){
|
||||||
IContentType cType = cTypes[c];
|
IContentType cType = cTypes[c];
|
||||||
ILanguageDescriptor[] langs = (ILanguageDescriptor[])map.remove(cType.getId());
|
ILanguageDescriptor[] langs = map.remove(cType.getId());
|
||||||
if(langs != null && langs.length != 0){
|
if(langs != null && langs.length != 0){
|
||||||
for(int q = 0; q < langs.length; q++){
|
for(int q = 0; q < langs.length; q++){
|
||||||
langMap.remove(langs[q].getId());
|
langMap.remove(langs[q].getId());
|
||||||
|
@ -454,15 +460,15 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
String srcIds[] = type.getSourceContentTypeIds();
|
String srcIds[] = type.getSourceContentTypeIds();
|
||||||
String hIds[] = type.getHeaderContentTypeIds();
|
String hIds[] = type.getHeaderContentTypeIds();
|
||||||
|
|
||||||
Set landTypes = new HashSet(Arrays.asList(cTypeIds));
|
Set<String> landTypes = new HashSet<String>(Arrays.asList(cTypeIds));
|
||||||
landTypes.removeAll(Arrays.asList(srcIds));
|
landTypes.removeAll(Arrays.asList(srcIds));
|
||||||
landTypes.removeAll(Arrays.asList(hIds));
|
landTypes.removeAll(Arrays.asList(hIds));
|
||||||
|
|
||||||
if(landTypes.size() != 0){
|
if(landTypes.size() != 0){
|
||||||
List srcList = new ArrayList();
|
List<String> srcList = new ArrayList<String>();
|
||||||
srcList.addAll(landTypes);
|
srcList.addAll(landTypes);
|
||||||
type = (InputType)tool.getEditableInputType(type);
|
type = (InputType)tool.getEditableInputType(type);
|
||||||
type.setSourceContentTypeIds((String[])srcList.toArray(new String[srcList.size()]));
|
type.setSourceContentTypeIds(srcList.toArray(new String[srcList.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!des.getId().equals(type.getLanguageId(tool))){
|
if(!des.getId().equals(type.getLanguageId(tool))){
|
||||||
|
@ -473,16 +479,16 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addTools(IToolChain tc, Map langMap, Map cTypeToLangMap){
|
private static void addTools(IToolChain tc, Map<String, ILanguageDescriptor> langMap, Map<Object, ILanguageDescriptor[]> cTypeToLangMap){
|
||||||
ITool extTool = ManagedBuildManager.getExtensionTool(PREF_TOOL_ID);
|
ITool extTool = ManagedBuildManager.getExtensionTool(PREF_TOOL_ID);
|
||||||
List list = new ArrayList(langMap.values());
|
List<ILanguageDescriptor> list = new ArrayList<ILanguageDescriptor>(langMap.values());
|
||||||
ILanguageDescriptor des;
|
ILanguageDescriptor des;
|
||||||
while(list.size() != 0){
|
while(list.size() != 0){
|
||||||
des = (ILanguageDescriptor)list.remove(list.size() - 1);
|
des = list.remove(list.size() - 1);
|
||||||
String[] ctypeIds = des.getContentTypeIds();
|
String[] ctypeIds = des.getContentTypeIds();
|
||||||
boolean addLang = false;
|
boolean addLang = false;
|
||||||
for(int i = 0; i < ctypeIds.length; i++){
|
for(int i = 0; i < ctypeIds.length; i++){
|
||||||
ILanguageDescriptor[] langs = (ILanguageDescriptor[])cTypeToLangMap.remove(ctypeIds[i]);
|
ILanguageDescriptor[] langs = cTypeToLangMap.remove(ctypeIds[i]);
|
||||||
if(langs != null && langs.length != 0){
|
if(langs != null && langs.length != 0){
|
||||||
addLang = true;
|
addLang = true;
|
||||||
for(int q = 0; q < langs.length; q++){
|
for(int q = 0; q < langs.length; q++){
|
||||||
|
@ -522,6 +528,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
return emptyPrefCfg;
|
return emptyPrefCfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CConfigurationData loadConfiguration(ICConfigurationDescription des,
|
public CConfigurationData loadConfiguration(ICConfigurationDescription des,
|
||||||
IProgressMonitor monitor)
|
IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
|
@ -559,6 +566,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeConfiguration(ICConfigurationDescription des,
|
public void removeConfiguration(ICConfigurationDescription des,
|
||||||
CConfigurationData data,
|
CConfigurationData data,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
|
@ -569,6 +577,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
mProj.removeConfiguration(cfg.getId());
|
mProj.removeConfiguration(cfg.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dataCached(ICConfigurationDescription cfgDes,
|
public void dataCached(ICConfigurationDescription cfgDes,
|
||||||
CConfigurationData data,
|
CConfigurationData data,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue