mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-08 02:53:12 +02:00
cleanup: spaces
This commit is contained in:
parent
3957659789
commit
0fa6bf2bdc
1 changed files with 26 additions and 26 deletions
|
@ -50,20 +50,20 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
private IScannerInfo fCurrentFileScannerInfo;
|
private IScannerInfo fCurrentFileScannerInfo;
|
||||||
private static final ScannerInfo INEXISTENT_SCANNER_INFO = new ScannerInfo();
|
private static final ScannerInfo INEXISTENT_SCANNER_INFO = new ScannerInfo();
|
||||||
private boolean fInited;
|
private boolean fInited;
|
||||||
|
|
||||||
DescriptionScannerInfoProvider(IProject project){
|
DescriptionScannerInfoProvider(IProject project){
|
||||||
fProject = project;
|
fProject = project;
|
||||||
|
|
||||||
CProjectDescriptionManager.getInstance().addCProjectDescriptionListener(this, CProjectDescriptionEvent.APPLIED | CProjectDescriptionEvent.LOADED);
|
CProjectDescriptionManager.getInstance().addCProjectDescriptionListener(this, CProjectDescriptionEvent.APPLIED | CProjectDescriptionEvent.LOADED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProjCfgInfo(ICProjectDescription des){
|
private void updateProjCfgInfo(ICProjectDescription des){
|
||||||
fInited = true;
|
fInited = true;
|
||||||
fProjDes = des;
|
fProjDes = des;
|
||||||
if(fProjDes != null){
|
if(fProjDes != null){
|
||||||
fCfgDes = des.getDefaultSettingConfiguration();
|
fCfgDes = des.getDefaultSettingConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
fIdToLanguageSettingsMap.clear();
|
fIdToLanguageSettingsMap.clear();
|
||||||
fCurrentFileDescriptionId = null;
|
fCurrentFileDescriptionId = null;
|
||||||
fCurrentFileScannerInfo = null;
|
fCurrentFileScannerInfo = null;
|
||||||
|
@ -76,7 +76,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
public IScannerInfo getScannerInformation(IResource resource) {
|
public IScannerInfo getScannerInformation(IResource resource) {
|
||||||
if(!fInited)
|
if(!fInited)
|
||||||
updateProjCfgInfo(CProjectDescriptionManager.getInstance().getProjectDescription(fProject, false));
|
updateProjCfgInfo(CProjectDescriptionManager.getInstance().getProjectDescription(fProject, false));
|
||||||
|
|
||||||
if(fCfgDes == null)
|
if(fCfgDes == null)
|
||||||
return INEXISTENT_SCANNER_INFO;
|
return INEXISTENT_SCANNER_INFO;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
if(resource.getType() != IResource.PROJECT){
|
if(resource.getType() != IResource.PROJECT){
|
||||||
IPath rcPath = resource.getProjectRelativePath();
|
IPath rcPath = resource.getProjectRelativePath();
|
||||||
rcDes = fCfgDes.getResourceDescription(rcPath, false);
|
rcDes = fCfgDes.getResourceDescription(rcPath, false);
|
||||||
|
|
||||||
if(rcDes.getType() == ICSettingBase.SETTING_FILE){
|
if(rcDes.getType() == ICSettingBase.SETTING_FILE){
|
||||||
setting = ((ICFileDescription)rcDes).getLanguageSetting();
|
setting = ((ICFileDescription)rcDes).getLanguageSetting();
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,13 +101,13 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
}
|
}
|
||||||
return getScannerInfo(rcDes, setting);
|
return getScannerInfo(rcDes, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IScannerInfo getScannerInfo(ICResourceDescription rcDes, ICLanguageSetting ls){
|
private IScannerInfo getScannerInfo(ICResourceDescription rcDes, ICLanguageSetting ls){
|
||||||
Object mapKey = ls != null ? ls.getId() : null;
|
Object mapKey = ls != null ? ls.getId() : null;
|
||||||
// if(ls == null)
|
// if(ls == null)
|
||||||
// return INEXISTENT_SCANNER_INFO;
|
// return INEXISTENT_SCANNER_INFO;
|
||||||
boolean useMap = rcDes == null || rcDes.getType() == ICSettingBase.SETTING_FOLDER;
|
boolean useMap = rcDes == null || rcDes.getType() == ICSettingBase.SETTING_FOLDER;
|
||||||
|
|
||||||
IScannerInfo info;
|
IScannerInfo info;
|
||||||
if(useMap)
|
if(useMap)
|
||||||
info = fIdToLanguageSettingsMap.get(mapKey);
|
info = fIdToLanguageSettingsMap.get(mapKey);
|
||||||
|
@ -135,12 +135,12 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICLanguageSettingPathEntry[] getPathEntries(ICLanguageSetting ls, int kind){
|
private static ICLanguageSettingPathEntry[] getPathEntries(ICLanguageSetting ls, int kind){
|
||||||
ICLanguageSettingEntry entries[] = ls.getResolvedSettingEntries(kind);
|
ICLanguageSettingEntry entries[] = ls.getResolvedSettingEntries(kind);
|
||||||
ICLanguageSettingPathEntry pathEntries[] = new ICLanguageSettingPathEntry[entries.length];
|
ICLanguageSettingPathEntry pathEntries[] = new ICLanguageSettingPathEntry[entries.length];
|
||||||
System.arraycopy(entries, 0, pathEntries, 0, entries.length);
|
System.arraycopy(entries, 0, pathEntries, 0, entries.length);
|
||||||
|
|
||||||
return pathEntries;
|
return pathEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
ICLanguageSettingEntry entries[] = ls.getResolvedSettingEntries(ICSettingEntry.MACRO);
|
ICLanguageSettingEntry entries[] = ls.getResolvedSettingEntries(ICSettingEntry.MACRO);
|
||||||
ICMacroEntry macroEntries[] = new ICMacroEntry[entries.length];
|
ICMacroEntry macroEntries[] = new ICMacroEntry[entries.length];
|
||||||
System.arraycopy(entries, 0, macroEntries, 0, entries.length);
|
System.arraycopy(entries, 0, macroEntries, 0, entries.length);
|
||||||
|
|
||||||
return macroEntries;
|
return macroEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,20 +157,20 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
ICLanguageSetting[] lSettings = foDes.getLanguageSettings();
|
ICLanguageSetting[] lSettings = foDes.getLanguageSettings();
|
||||||
ICLanguageSettingPathEntry pathEntries[] = getPathEntries(lSettings, ICSettingEntry.INCLUDE_PATH);
|
ICLanguageSettingPathEntry pathEntries[] = getPathEntries(lSettings, ICSettingEntry.INCLUDE_PATH);
|
||||||
String incs[] = getValues(pathEntries);
|
String incs[] = getValues(pathEntries);
|
||||||
|
|
||||||
pathEntries = getPathEntries(lSettings, ICSettingEntry.INCLUDE_FILE);
|
pathEntries = getPathEntries(lSettings, ICSettingEntry.INCLUDE_FILE);
|
||||||
String incFiles[] = getValues(pathEntries);
|
String incFiles[] = getValues(pathEntries);
|
||||||
|
|
||||||
pathEntries = getPathEntries(lSettings, ICSettingEntry.MACRO_FILE);
|
pathEntries = getPathEntries(lSettings, ICSettingEntry.MACRO_FILE);
|
||||||
String macroFiles[] = getValues(pathEntries);
|
String macroFiles[] = getValues(pathEntries);
|
||||||
|
|
||||||
ICMacroEntry macroEntries[] = getMacroEntries(lSettings);
|
ICMacroEntry macroEntries[] = getMacroEntries(lSettings);
|
||||||
Map<String, String> macrosMap = getValues(macroEntries);
|
Map<String, String> macrosMap = getValues(macroEntries);
|
||||||
|
|
||||||
return new ExtendedScannerInfo(macrosMap, incs, macroFiles, incFiles);
|
return new ExtendedScannerInfo(macrosMap, incs, macroFiles, incFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ICMacroEntry[] getMacroEntries(ICLanguageSetting[] settings){
|
private ICMacroEntry[] getMacroEntries(ICLanguageSetting[] settings){
|
||||||
LinkedHashSet<ICLanguageSettingEntry> set = getEntriesSet(ICSettingEntry.MACRO, settings);
|
LinkedHashSet<ICLanguageSettingEntry> set = getEntriesSet(ICSettingEntry.MACRO, settings);
|
||||||
return set.toArray(new ICMacroEntry[set.size()]);
|
return set.toArray(new ICMacroEntry[set.size()]);
|
||||||
|
@ -180,7 +180,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
LinkedHashSet<ICLanguageSettingEntry> set = getEntriesSet(kind, settings);
|
LinkedHashSet<ICLanguageSettingEntry> set = getEntriesSet(kind, settings);
|
||||||
return set.toArray(new ICLanguageSettingPathEntry[set.size()]);
|
return set.toArray(new ICLanguageSettingPathEntry[set.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinkedHashSet<ICLanguageSettingEntry> getEntriesSet(int kind, ICLanguageSetting[] settings){
|
private LinkedHashSet<ICLanguageSettingEntry> getEntriesSet(int kind, ICLanguageSetting[] settings){
|
||||||
LinkedHashSet<ICLanguageSettingEntry> set = new LinkedHashSet<ICLanguageSettingEntry>();
|
LinkedHashSet<ICLanguageSettingEntry> set = new LinkedHashSet<ICLanguageSettingEntry>();
|
||||||
ICLanguageSettingEntry[] langEntries;
|
ICLanguageSettingEntry[] langEntries;
|
||||||
|
@ -196,19 +196,19 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
private IScannerInfo createScannerInfo(ICLanguageSetting ls){
|
private IScannerInfo createScannerInfo(ICLanguageSetting ls){
|
||||||
if(ls == null)
|
if(ls == null)
|
||||||
return createProjectScannerInfo();
|
return createProjectScannerInfo();
|
||||||
|
|
||||||
ICLanguageSettingPathEntry pathEntries[] = getPathEntries(ls, ICSettingEntry.INCLUDE_PATH);
|
ICLanguageSettingPathEntry pathEntries[] = getPathEntries(ls, ICSettingEntry.INCLUDE_PATH);
|
||||||
String incs[] = getValues(pathEntries);
|
String incs[] = getValues(pathEntries);
|
||||||
|
|
||||||
pathEntries = getPathEntries(ls, ICSettingEntry.INCLUDE_FILE);
|
pathEntries = getPathEntries(ls, ICSettingEntry.INCLUDE_FILE);
|
||||||
String incFiles[] = getValues(pathEntries);
|
String incFiles[] = getValues(pathEntries);
|
||||||
|
|
||||||
pathEntries = getPathEntries(ls, ICSettingEntry.MACRO_FILE);
|
pathEntries = getPathEntries(ls, ICSettingEntry.MACRO_FILE);
|
||||||
String macroFiles[] = getValues(pathEntries);
|
String macroFiles[] = getValues(pathEntries);
|
||||||
|
|
||||||
ICMacroEntry macroEntries[] = getMacroEntries(ls);
|
ICMacroEntry macroEntries[] = getMacroEntries(ls);
|
||||||
Map<String, String> macrosMap = getValues(macroEntries);
|
Map<String, String> macrosMap = getValues(macroEntries);
|
||||||
|
|
||||||
return new ExtendedScannerInfo(macrosMap, incs, macroFiles, incFiles);
|
return new ExtendedScannerInfo(macrosMap, incs, macroFiles, incFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
Map<String, String> macrosMap = new HashMap<String, String>(macroEntries.length);
|
Map<String, String> macrosMap = new HashMap<String, String>(macroEntries.length);
|
||||||
String name;
|
String name;
|
||||||
String value;
|
String value;
|
||||||
|
|
||||||
for (ICMacroEntry macroEntry : macroEntries) {
|
for (ICMacroEntry macroEntry : macroEntries) {
|
||||||
name = macroEntry.getName();
|
name = macroEntry.getName();
|
||||||
value = macroEntry.getValue();
|
value = macroEntry.getValue();
|
||||||
|
@ -239,7 +239,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IResource rc = root.findMember(path);
|
IResource rc = root.findMember(path);
|
||||||
if(rc != null){
|
if(rc != null){
|
||||||
path = rc.getLocation();
|
path = rc.getLocation();
|
||||||
}
|
}
|
||||||
} else if (!path.isAbsolute()) {
|
} else if (!path.isAbsolute()) {
|
||||||
IPath projLocation = fProject != null ? fProject.getLocation() : null;
|
IPath projLocation = fProject != null ? fProject.getLocation() : null;
|
||||||
|
@ -255,7 +255,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
System.arraycopy(values, 0, tmp, 0, num);
|
System.arraycopy(values, 0, tmp, 0, num);
|
||||||
values = tmp;
|
values = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(){
|
public void close(){
|
||||||
CProjectDescriptionManager.getInstance().removeCProjectDescriptionListener(this);
|
CProjectDescriptionManager.getInstance().removeCProjectDescriptionListener(this);
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//TODO: check delta and notify listeners
|
//TODO: check delta and notify listeners
|
||||||
|
|
||||||
updateProjCfgInfo(event.getNewCProjectDescription());
|
updateProjCfgInfo(event.getNewCProjectDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue