mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 475342: Fix CoreException of file language mappings reset to inherit
There is an assumption in FileLanguageMappingPropertyPage#computeInheritedMapping that there is only one overridden file mapping. If both project and workspace file mappings have been overridden, a CoreException is thrown when they both are reset to inherit together. Change-Id: I5c845831ac446eaf65c782b4428b3b72a274fb23 Signed-off-by: Ivan Furnadjiev <ivan@eclipsesource.com>
This commit is contained in:
parent
4cc61d0449
commit
5cc4336072
1 changed files with 5 additions and 4 deletions
|
@ -387,15 +387,16 @@ public class FileLanguageMappingPropertyPage extends PropertyPage {
|
|||
|
||||
private LanguageMapping computeInheritedMapping(IProject project, IFile file, ICConfigurationDescription configuration) throws CoreException {
|
||||
LanguageMapping mappings[] = LanguageMappingResolver.computeLanguage(project, file.getProjectRelativePath().toPortableString(), configuration, fContentType.getId(), true);
|
||||
LanguageMapping inheritedMapping = mappings[0];
|
||||
|
||||
// Skip over the file mapping because we want to know what mapping the file
|
||||
// mapping overrides.
|
||||
if (inheritedMapping.inheritedFrom == LanguageMappingResolver.FILE_MAPPING ) {
|
||||
inheritedMapping = mappings[1];
|
||||
for (int i = 0; i < mappings.length; i++) {
|
||||
if (mappings[i].inheritedFrom != LanguageMappingResolver.FILE_MAPPING) {
|
||||
return mappings[i];
|
||||
}
|
||||
}
|
||||
|
||||
return inheritedMapping;
|
||||
return null;
|
||||
}
|
||||
|
||||
private String[][] getLanguages(IProject project, IFile file, ICConfigurationDescription configuration) throws CoreException {
|
||||
|
|
Loading…
Add table
Reference in a new issue