mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
Only show types which inherit from ConfigObject and aren't abstract in Icinga Studio
fixes #10498
This commit is contained in:
parent
9c5758958c
commit
94fb2f9dc2
@ -72,37 +72,35 @@ void MainForm::TypesCompletionHandler(boost::exception_ptr eptr, const std::vect
|
|||||||
|
|
||||||
wxTreeItemId rootNode = m_TypesTree->AddRoot("root");
|
wxTreeItemId rootNode = m_TypesTree->AddRoot("root");
|
||||||
|
|
||||||
bool all = false;
|
BOOST_FOREACH(const ApiType::Ptr& type, types) {
|
||||||
std::map<String, wxTreeItemId> items;
|
m_Types[type->Name] = type;
|
||||||
|
}
|
||||||
|
|
||||||
m_Types.clear();
|
BOOST_FOREACH(const ApiType::Ptr& type, types) {
|
||||||
|
if (type->Abstract)
|
||||||
|
continue;
|
||||||
|
|
||||||
while (!all) {
|
bool configObject = false;
|
||||||
all = true;
|
ApiType::Ptr currentType = type;
|
||||||
|
|
||||||
BOOST_FOREACH(const ApiType::Ptr& type, types) {
|
for (;;) {
|
||||||
std::string name = type->Name;
|
if (currentType->BaseName.IsEmpty())
|
||||||
|
break;
|
||||||
|
|
||||||
if (items.find(name) != items.end())
|
currentType = m_Types[currentType->BaseName];
|
||||||
continue;
|
|
||||||
|
|
||||||
all = false;
|
if (!currentType)
|
||||||
|
break;
|
||||||
|
|
||||||
wxTreeItemId parent;
|
if (currentType->Name == "ConfigObject") {
|
||||||
|
configObject = true;
|
||||||
if (type->BaseName.IsEmpty())
|
break;
|
||||||
parent = rootNode;
|
|
||||||
else {
|
|
||||||
std::map<String, wxTreeItemId>::const_iterator it = items.find(type->BaseName);
|
|
||||||
|
|
||||||
if (it == items.end())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
parent = it->second;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Types[name] = type;
|
if (configObject) {
|
||||||
items[name] = m_TypesTree->AppendItem(parent, name, 0);
|
std::string name = type->Name;
|
||||||
|
m_TypesTree->AppendItem(rootNode, name, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user