mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3528 Allow deleting of the whole casing design table.
This commit is contained in:
@@ -42,6 +42,13 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled()
|
||||
return true;
|
||||
}
|
||||
}
|
||||
{
|
||||
if (caf::SelectionManager::instance()->selectedItemOfType<RimWellPathAttributeCollection>())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -53,24 +60,32 @@ void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPathAttribute*> attributes;
|
||||
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
||||
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
|
||||
if (attributes.size() > 0)
|
||||
{
|
||||
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
|
||||
{
|
||||
attributes[0]->firstAncestorOrThisOfTypeAsserted(wellPathAttributeCollection);
|
||||
for (RimWellPathAttribute* attributeToDelete : attributes)
|
||||
{
|
||||
wellPathAttributeCollection->deleteAttribute(attributeToDelete);
|
||||
}
|
||||
wellPathAttributeCollection->updateAllRequiredEditors();
|
||||
|
||||
if (wellPathAttributeCollection->attributes().empty())
|
||||
}
|
||||
else
|
||||
{
|
||||
wellPathAttributeCollection = caf::SelectionManager::instance()->selectedItemOfType<RimWellPathAttributeCollection>();
|
||||
if (wellPathAttributeCollection)
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
wellPathAttributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||
wellPath->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(wellPath);
|
||||
wellPathAttributeCollection->deleteAllAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
if (wellPathAttributeCollection->attributes().empty())
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
wellPathAttributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||
wellPath->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(wellPath);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -78,6 +93,16 @@ void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteWellPathAttributeFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Delete Attribute");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
std::vector<RimWellPathAttribute*> attributes;
|
||||
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
||||
if (attributes.size() > 0)
|
||||
{
|
||||
actionToSetup->setText("Delete Attribute");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
}
|
||||
else if (caf::SelectionManager::instance()->selectedItemOfType<RimWellPathAttributeCollection>())
|
||||
{
|
||||
actionToSetup->setText("Delete Casing Design");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user