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

more easy way of integrating to the general project types in the new project wizard

This commit is contained in:
Mikhail Sennikovsky 2007-06-19 09:29:21 +00:00
parent 1ec487930f
commit d31446aba0
3 changed files with 28 additions and 13 deletions

View file

@ -341,6 +341,7 @@ Specifying this attribute is fully equivalent to specifying the "org.eclips
<element ref="builder" minOccurs="0" maxOccurs="1"/>
<element ref="optionCategory" minOccurs="0" maxOccurs="unbounded"/>
<element ref="option" minOccurs="0" maxOccurs="unbounded"/>
<element ref="supportedProperties" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>

View file

@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@ -4145,7 +4146,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
public static IConfiguration[] getExtensionConfigurations(IToolChain tChain, String propertyType, String propertyValue){
// List all = getSortedToolChains();
List list = findIdenticalElements((ToolChain)tChain, fToolChainSorter);
List result = new ArrayList();
LinkedHashSet result = new LinkedHashSet();
boolean tcFound = false;
if(list != null){
for(int i = 0; i < list.size(); i++){
@ -4371,11 +4372,15 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
public static IToolChain[] getExtensionsToolChains(String propertyType, String propertyValue){
return getExtensionsToolChains(propertyType, propertyValue, true);
}
public static IToolChain[] getExtensionsToolChains(String propertyType, String propertyValue, boolean supportedPropsOnly){
HashMap all = getSortedToolChains();
List result = new ArrayList();
for(Iterator iter = all.values().iterator(); iter.hasNext();){
List list = (List)iter.next();
IToolChain tc = findToolChain(list, propertyType, propertyValue);
IToolChain tc = findToolChain(list, propertyType, propertyValue, supportedPropsOnly);
if(tc != null)
result.add(tc);
}
@ -4397,53 +4402,62 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
getSortedBuilders();
}
private static IToolChain findToolChain(List list, String propertyType, String propertyValue){
private static IToolChain findToolChain(List list, String propertyType, String propertyValue, boolean supportedOnly){
ToolChain bestMatch = null;
IConfiguration cfg = null;
IProjectType type = null;
boolean valueSupported = false;
for(int i = 0; i < list.size(); i++){
ToolChain tc = (ToolChain)list.get(i);
if(!tc.supportsValue(propertyType, propertyValue))
return null;
if(tc.supportsValue(propertyType, propertyValue)){
valueSupported = true;
} else if (valueSupported){
continue;
}
if(!tc.supportsBuild(true))
return null;
if(bestMatch == null)
if(bestMatch == null && valueSupported)
bestMatch = tc;
IConfiguration tcCfg = tc.getParent();
if(tcCfg != null){
if(cfg == null){
if(cfg == null && valueSupported){
bestMatch = tc;
cfg = tcCfg;
}
IBuildObjectProperties props =tcCfg.getBuildProperties();
IBuildProperty prop = props.getProperty(propertyType);
if(prop != null && propertyValue.equals(prop.getValue().getId())){
if(valueSupported && prop != null && propertyValue.equals(prop.getValue().getId())){
bestMatch = tc;
cfg = tcCfg;
}
IProjectType tcType = tcCfg.getProjectType();
if(tcType != null){
if(type == null){
if(type == null && valueSupported){
type = tcType;
bestMatch = tc;
}
props = tcType.getBuildProperties();
prop = props.getProperty(propertyType);
if(prop != null && propertyValue.equals(prop.getValue().getId())){
type = tcType;
bestMatch = tc;
break;
if(valueSupported){
type = tcType;
break;
}
}
}
}
}
return bestMatch;
if(valueSupported || ! supportedOnly)
return bestMatch;
return null;
}
private static List findIdenticalElements(IMatchKeyProvider p, ISorter sorter){

View file

@ -47,7 +47,7 @@ public class ManagedBuildWizard extends AbstractCWizard {
ArrayList items = new ArrayList();
// new style project types
for (int i=0; i<vs.length; i++) {
IToolChain[] tcs = ManagedBuildManager.getExtensionsToolChains(MBSWizardHandler.ARTIFACT, vs[i].getId());
IToolChain[] tcs = ManagedBuildManager.getExtensionsToolChains(MBSWizardHandler.ARTIFACT, vs[i].getId(), false);
if (tcs == null || tcs.length == 0) continue;
MBSWizardHandler h = new MBSWizardHandler(vs[i], parent, wizard);
for (int j=0; j<tcs.length; j++) {