//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicSetMasterViewFeature::onActionTriggered(bool isChecked) { RimView* activeView = RiaApplication::instance()->activeReservoirView(); if (!activeView) return; RimProject* proj = RiaApplication::instance()->project(); RimViewLinker* viewLinker = proj->viewLinkerCollection()->viewLinker(); viewLinker->applyRangeFilterCollectionByUserChoice(); RimView* previousMasterView = viewLinker->masterView(); viewLinker->setMasterView(activeView); viewLinker->updateDependentViews(); viewLinker->addDependentView(previousMasterView); proj->viewLinkerCollection.uiCapability()->updateConnectedEditors(); proj->updateConnectedEditors(); // Set managed view collection to selected and expanded in project tree caf::PdmUiTreeView* projTreeView = RiuMainWindow::instance()->projectTreeView(); projTreeView->selectAsCurrentItem(viewLinker); projTreeView->setExpanded(viewLinker, true); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RicSetMasterViewFeature::isCommandEnabled() { RimView* activeView = RiaApplication::instance()->activeReservoirView(); if (!activeView) return false; RimProject* proj = RiaApplication::instance()->project(); RimViewLinker* viewLinker = activeView->assosiatedViewLinker(); if (viewLinker && viewLinker->masterView() == activeView) { return false; } if (!proj->viewLinkerCollection()->viewLinker()) { return false; } return true; }