1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

bug 288156: [Scanner Discovery] Makefile project pretends not having discovery profile

This commit is contained in:
Andrew Gvozdev 2009-09-01 03:29:32 +00:00
parent 640ca45d95
commit c180619310

View file

@ -301,6 +301,24 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
return (x == -1) ? id : id.substring(x + 1);
}
private boolean toolContainsProfile(ITool tool, String profileId) {
IInputType[] inputTypes = ((Tool) tool).getAllInputTypes();
if (inputTypes == null)
return false;
for (IInputType inputType : inputTypes) {
String[] requiedProfiles = getDiscoveryProfileIds(tool, inputType);
if (requiedProfiles != null) {
for (String requiredProfile : requiedProfiles) {
if (profileId.equals(requiredProfile)) {
return true;
}
}
}
}
return false;
}
private void handleToolSelected() {
if (resTable.getSelectionCount() == 0)
return;
@ -332,7 +350,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
String[] profiles = new String[profilesList.size()];
int counter = 0;
int pos = 0;
String savedId = buildInfo.getSelectedProfileId();
String selectedProfileId = buildInfo.getSelectedProfileId();
ITool[] tools = null;
boolean needPerRcProfile = cbi.isPerRcTypeDiscovery();
if (!page.isForPrefs()) {
@ -349,35 +367,28 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
}
}
for (String profileId : profilesList) {
// do not check selected profile id in tool-chain because
// for Makefile project tool-chain does not contain profile,
// instead default one is loaded from preferences to selectedProfileId
if (!profileId.equals(selectedProfileId)) {
if (tools != null) {
boolean ok = false;
boolean foundProfile = false;
for (ITool tool : tools) {
IInputType[] inputTypes = ((Tool) tool).getAllInputTypes();
if (null != inputTypes) {
for (IInputType it : inputTypes) {
String[] requiedProfiles = getDiscoveryProfileIds(tool, it);
if (null != requiedProfiles) {
for (String requiredProfile : requiedProfiles) {
if (profileId.equals(requiredProfile)) {
ok = true;
foundProfile = toolContainsProfile(tool, profileId);
if (foundProfile)
break;
}
}
}
}
}
if (ok)
break;
}
if (!ok)
if (!foundProfile)
continue;
}
}
if (needPerRcProfile && !CfgScannerConfigProfileManager.isPerFileProfile(profileId))
continue;
visibleProfilesList.add(profileId);
labels[counter] = profiles[counter] = getProfileName(profileId);
if (profileId.equals(savedId))
if (profileId.equals(selectedProfileId))
pos = counter;
buildInfo.setSelectedProfileId(profileId); // needs to create page
for (DiscoveryProfilePageConfiguration p : pagesList) {
@ -399,7 +410,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
}
profileComboBox.setItems(normalize(labels, profiles, counter));
buildInfo.setSelectedProfileId(savedId);
buildInfo.setSelectedProfileId(selectedProfileId);
if (profileComboBox.getItemCount() > 0)
profileComboBox.select(pos);
enableAllControls();