1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

1. Error parser settings fixes

2. Ensure ther eis only one instance of CProjectDescriptionManager
3. Fix ArrayStoreException External Extension Build Macro  Supplier
This commit is contained in:
Mikhail Sennikovsky 2007-05-15 10:48:29 +00:00
parent 25fe0e8d83
commit 3e5b00fc98
9 changed files with 56 additions and 39 deletions

View file

@ -2326,12 +2326,14 @@ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider
} }
public Set contributeErrorParsers(Set set){ public Set contributeErrorParsers(Set set){
if(set == null) if(getErrorParserIds() != null){
set = new HashSet(); if(set == null)
set = new HashSet();
String ids[] = getErrorParserList(); String ids[] = getErrorParserList();
if(ids.length != 0) if(ids.length != 0)
set.addAll(Arrays.asList(ids)); set.addAll(Arrays.asList(ids));
}
return set; return set;
} }

View file

@ -23,6 +23,7 @@ import java.util.Vector;
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set; import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache; import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry; import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry; import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
import org.eclipse.cdt.core.settings.model.CSourceEntry; import org.eclipse.cdt.core.settings.model.CSourceEntry;
@ -1410,19 +1411,24 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
// } // }
// return errorParsers; // return errorParsers;
Set set = contributeErrorParsers(null, true); Set set = contributeErrorParsers(null, true);
String result[] = new String[set.size()]; if(set != null){
set.toArray(result); String result[] = new String[set.size()];
return result; set.toArray(result);
return result;
}
return CCorePlugin.getDefault().getAllErrorParsersIDs();
} }
public Set contributeErrorParsers(Set set, boolean includeChildren) { public Set contributeErrorParsers(Set set, boolean includeChildren) {
String parserIDs = getErrorParserIdsAttribute(); String parserIDs = getErrorParserIdsAttribute();
if(set == null) if (parserIDs != null){
set = new HashSet(); if(set == null)
if (parserIDs != null && parserIDs.length() != 0) { set = new HashSet();
StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$ if(parserIDs.length() != 0) {
while (tok.hasMoreElements()) { StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
set.add(tok.nextToken()); while (tok.hasMoreElements()) {
set.add(tok.nextToken());
}
} }
} }
@ -1430,7 +1436,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
IResourceInfo[] rcInfos = getResourceInfos(); IResourceInfo[] rcInfos = getResourceInfos();
for(int i = 0; i < rcInfos.length; i++){ for(int i = 0; i < rcInfos.length; i++){
ResourceInfo rcInfo = (ResourceInfo)rcInfos[i]; ResourceInfo rcInfo = (ResourceInfo)rcInfos[i];
rcInfo.contributeErrorParsers(set); set = rcInfo.contributeErrorParsers(set);
} }
} }
return set; return set;

View file

@ -1440,11 +1440,11 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo {
} }
public Set contributeErrorParsers(Set set){ public Set contributeErrorParsers(Set set){
if(set == null) // if(set == null)
set = new HashSet(); // set = new HashSet();
if(toolChain != null) if(toolChain != null)
toolChain.contributeErrorParsers(this, set, true); set = toolChain.contributeErrorParsers(this, set, true);
return set; return set;
} }

View file

@ -469,11 +469,11 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
public abstract Set contributeErrorParsers(Set set); public abstract Set contributeErrorParsers(Set set);
protected Set contributeErrorParsers(ITool[] tools, Set set){ protected Set contributeErrorParsers(ITool[] tools, Set set){
if(set == null) // if(set == null)
set = new HashSet(); // set = new HashSet();
for(int i = 0; i < tools.length; i++){ for(int i = 0; i < tools.length; i++){
Tool tool = (Tool)tools[i]; Tool tool = (Tool)tools[i];
tool.contributeErrorParsers(set); set = tool.contributeErrorParsers(set);
} }
return set; return set;
} }

View file

@ -1717,12 +1717,13 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
} }
public Set contributeErrorParsers(Set set){ public Set contributeErrorParsers(Set set){
if(set == null) if(getErrorParserIds() != null){
set = new HashSet(); if(set == null)
set = new HashSet();
String ids[] = getErrorParserList(); String ids[] = getErrorParserList();
if(ids.length != 0) if(ids.length != 0)
set.addAll(Arrays.asList(ids)); set.addAll(Arrays.asList(ids));
}
return set; return set;
} }

View file

@ -1377,24 +1377,25 @@ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropert
} }
public Set contributeErrorParsers(FolderInfo info, Set set, boolean includeChildren){ public Set contributeErrorParsers(FolderInfo info, Set set, boolean includeChildren){
if(set == null)
set = new HashSet();
String parserIDs = getErrorParserIdsAttribute(); String parserIDs = getErrorParserIdsAttribute();
if (parserIDs != null && parserIDs.length() != 0) { if (parserIDs != null){
StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$ if(set == null)
while (tok.hasMoreElements()) { set = new HashSet();
set.add(tok.nextToken()); if(parserIDs.length() != 0) {
StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
while (tok.hasMoreElements()) {
set.add(tok.nextToken());
}
} }
} }
if(includeChildren){ if(includeChildren){
ITool tools[] = info.getFilteredTools(); ITool tools[] = info.getFilteredTools();
info.contributeErrorParsers(tools, set); set = info.contributeErrorParsers(tools, set);
if(info.isRoot()){ if(info.isRoot()){
Builder builder = (Builder)getBuilder(); Builder builder = (Builder)getBuilder();
builder.contributeErrorParsers(set); set = builder.contributeErrorParsers(set);
} }
} }
return set; return set;

View file

@ -215,7 +215,7 @@ public class ExternalExtensionMacroSupplier implements ICdtVariableSupplier{
if(macros == null || macros.length == 0) if(macros == null || macros.length == 0)
return macros; return macros;
ICdtVariable filtered[] = new IBuildMacro[macros.length]; ICdtVariable filtered[] = new ICdtVariable[macros.length];
int filteredNum = 0; int filteredNum = 0;
for(int i = 0; i < macros.length; i++){ for(int i = 0; i < macros.length; i++){
ICdtVariable var = macros[i]; ICdtVariable var = macros[i];

View file

@ -281,11 +281,18 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
} }
public static CProjectDescriptionManager getInstance(){ public static CProjectDescriptionManager getInstance(){
if(fInstance == null)
fInstance = getInstanceSynch();
return fInstance;
}
private static synchronized CProjectDescriptionManager getInstanceSynch(){
if(fInstance == null) if(fInstance == null)
fInstance = new CProjectDescriptionManager(); fInstance = new CProjectDescriptionManager();
return fInstance; return fInstance;
} }
public void registerResourceListener() { public void registerResourceListener() {
assert fRcChangeHandler == null; assert fRcChangeHandler == null;
fRcChangeHandler = new ResourceChangeHandler(); fRcChangeHandler = new ResourceChangeHandler();

View file

@ -304,7 +304,7 @@ public class CConfigBasedDescriptor implements ICDescriptor {
} }
public void saveProjectData() throws CoreException { public void saveProjectData() throws CoreException {
if(CConfigBasedDescriptorManager.getInstance().reconsile(this, fCfgDes.getProjectDescription())) if(CProjectDescriptionManager.getInstance().getDescriptorManager().reconsile(this, fCfgDes.getProjectDescription()))
fIsDirty = true; fIsDirty = true;
checkApply(); checkApply();