#1495 Move feature to leaf object

This commit is contained in:
Magne Sjaastad 2017-05-20 20:34:07 +02:00
parent 1acc54d059
commit 4c19123b2d
2 changed files with 12 additions and 9 deletions

View File

@ -40,7 +40,7 @@ CAF_CMD_SOURCE_INIT(RicWellPathImportCompletionsFileFeature, "RicWellPathImportC
//--------------------------------------------------------------------------------------------------
bool RicWellPathImportCompletionsFileFeature::isCommandEnabled()
{
if (RicWellPathImportCompletionsFileFeature::selectedWellPathCompletions() != nullptr)
if (RicWellPathImportCompletionsFileFeature::selectedWellPathCollection() != nullptr)
{
return true;
}
@ -53,8 +53,8 @@ bool RicWellPathImportCompletionsFileFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicWellPathImportCompletionsFileFeature::onActionTriggered(bool isChecked)
{
RimWellPathCompletions* wellPathCompletions = RicWellPathImportCompletionsFileFeature::selectedWellPathCompletions();
CVF_ASSERT(wellPathCompletions);
RimFishboneWellPathCollection* wellPathCollection = RicWellPathImportCompletionsFileFeature::selectedWellPathCollection();
CVF_ASSERT(wellPathCollection);
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
@ -66,7 +66,7 @@ void RicWellPathImportCompletionsFileFeature::onActionTriggered(bool isChecked)
// Remember the path to next time
app->setLastUsedDialogDirectory("WELLPATH_DIR", QFileInfo(wellPathFilePaths.last()).absolutePath());
wellPathCompletions->fishbonesCollection()->wellPathCollection()->importCompletionsFromFile(wellPathFilePaths);
wellPathCollection->importCompletionsFromFile(wellPathFilePaths);
if (app->project())
{
@ -86,14 +86,17 @@ void RicWellPathImportCompletionsFileFeature::setupActionLook(QAction* actionToS
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletions* RicWellPathImportCompletionsFileFeature::selectedWellPathCompletions()
RimFishboneWellPathCollection* RicWellPathImportCompletionsFileFeature::selectedWellPathCollection()
{
std::vector<RimWellPathCompletions*> objects;
std::vector<caf::PdmObject*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() > 0)
{
return objects[0];
RimFishboneWellPathCollection* fbWellColl = nullptr;
objects[0]->firstAncestorOrThisOfType(fbWellColl);
return fbWellColl;
}
return nullptr;

View File

@ -20,7 +20,7 @@
#include "cafCmdFeature.h"
class RimWellPathCompletions;
class RimFishboneWellPathCollection;
//==================================================================================================
///
@ -36,6 +36,6 @@ protected:
virtual void setupActionLook( QAction* actionToSetup ) override;
private:
static RimWellPathCompletions* selectedWellPathCompletions();
static RimFishboneWellPathCollection* selectedWellPathCollection();
};