1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +02:00

Bug #224309 : Problem with ordering of ErrorParser

This commit is contained in:
Oleg Krasilnikov 2008-03-28 13:37:28 +00:00
parent 8336ec368b
commit 599d1947f7

View file

@ -13,8 +13,8 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -98,10 +98,6 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
private IConfiguration parent; private IConfiguration parent;
private ProjectType projectType; private ProjectType projectType;
private ManagedProject managedProject; private ManagedProject managedProject;
// private ToolChain toolChain;
// private List resourceConfigurationList;
// private Map resourceConfigurationMap;
// Managed Build model attributes
private String artifactName; private String artifactName;
private String cleanCommand; private String cleanCommand;
private String artifactExtension; private String artifactExtension;
@ -1392,28 +1388,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserList() * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserList()
*/ */
public String[] getErrorParserList() { public String[] getErrorParserList() {
// String parserIDs = getErrorParserIds(); Set<String> set = contributeErrorParsers(null, true);
// String[] errorParsers;
// if (parserIDs != null) {
// // Check for an empty string
// if (parserIDs.length() == 0) {
// errorParsers = new String[0];
// } else {
// StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
// List list = new ArrayList(tok.countTokens());
// while (tok.hasMoreElements()) {
// list.add(tok.nextToken());
// }
// String[] strArr = {""}; //$NON-NLS-1$
// errorParsers = (String[]) list.toArray(strArr);
// }
// } else {
// // If no error parsers are specified, the default is
// // all error parsers
// errorParsers = CCorePlugin.getDefault().getAllErrorParsersIDs();
// }
// return errorParsers;
Set set = contributeErrorParsers(null, true);
if(set != null){ if(set != null){
String result[] = new String[set.size()]; String result[] = new String[set.size()];
set.toArray(result); set.toArray(result);
@ -1422,11 +1397,11 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return CCorePlugin.getDefault().getAllErrorParsersIDs(); return CCorePlugin.getDefault().getAllErrorParsersIDs();
} }
public Set contributeErrorParsers(Set set, boolean includeChildren) { public Set<String> contributeErrorParsers(Set<String> set, boolean includeChildren) {
String parserIDs = getErrorParserIdsAttribute(); String parserIDs = getErrorParserIdsAttribute();
if (parserIDs != null){ if (parserIDs != null){
if(set == null) if(set == null)
set = new HashSet(); set = new LinkedHashSet<String>();
if(parserIDs.length() != 0) { if(parserIDs.length() != 0) {
StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$ StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
while (tok.hasMoreElements()) { while (tok.hasMoreElements()) {
@ -2356,23 +2331,24 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
} }
} }
@SuppressWarnings("unchecked")
public void setErrorParserList(String[] ids) { public void setErrorParserList(String[] ids) {
if(ids == null){ if(ids == null){
//reset //reset
resetErrorParsers(); resetErrorParsers();
} else { } else {
resetErrorParsers(); resetErrorParsers();
Set oldSet = contributeErrorParsers(null, true); Set<String> oldSet = contributeErrorParsers(null, true);
if(oldSet == null) if(oldSet == null)
oldSet = new HashSet(); oldSet = new LinkedHashSet<String>();
HashSet newSet = new HashSet(); LinkedHashSet<String> newSet = new LinkedHashSet<String>();
newSet.addAll(Arrays.asList(ids)); newSet.addAll(Arrays.asList(ids));
newSet.remove(null); newSet.remove(null);
HashSet newCopy = (HashSet)newSet.clone(); LinkedHashSet<String> newCopy = (LinkedHashSet<String>)newSet.clone();
newSet.removeAll(oldSet); newSet.removeAll(oldSet);
oldSet.removeAll(newCopy); oldSet.removeAll(newCopy);
Set removed = oldSet; Set<String> removed = oldSet;
Set added = newSet; Set<String> added = newSet;
removeErrorParsers(removed); removeErrorParsers(removed);
setErrorParserAttribute((String[])added.toArray(new String[added.size()])); setErrorParserAttribute((String[])added.toArray(new String[added.size()]));
@ -2388,10 +2364,10 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
} }
} }
void removeErrorParsers(Set set){ void removeErrorParsers(Set<String> set){
Set oldSet = contributeErrorParsers(null, false); Set<String> oldSet = contributeErrorParsers(null, false);
if(oldSet == null) if(oldSet == null)
oldSet = new HashSet(); oldSet = new LinkedHashSet<String>();
oldSet.removeAll(set); oldSet.removeAll(set);
setErrorParserAttribute((String[])oldSet.toArray(new String[oldSet.size()])); setErrorParserAttribute((String[])oldSet.toArray(new String[oldSet.size()]));