mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#339) Added RicAddScriptPathFeature and RicDeleteScriptPathFeature
Did some additional refactoring - added code common to script related features to RicScriptFeatureImpl.
This commit is contained in:
parent
35a37a5e07
commit
4d1f98c138
@ -7,7 +7,10 @@ endif()
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEditScriptFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicScriptFeatureImpl.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewScriptFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAddScriptPathFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteScriptPathFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExecuteScriptFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExecuteScriptForCasesFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupFeature.h
|
||||
@ -51,8 +54,11 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicScriptFeatureImpl.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEditScriptFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewScriptFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAddScriptPathFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteScriptPathFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExecuteScriptFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExecuteScriptForCasesFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupFeature.cpp
|
||||
|
74
ApplicationCode/Commands/RicAddScriptPathFeature.cpp
Normal file
74
ApplicationCode/Commands/RicAddScriptPathFeature.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicAddScriptPathFeature.h"
|
||||
|
||||
#include "RicScriptFeatureImpl.h"
|
||||
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicAddScriptPathFeature, "RicAddScriptPathFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAddScriptPathFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimScriptCollection*> selection = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddScriptPathFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
QString selectedFolder = QFileDialog::getExistingDirectory(RiuMainWindow::instance(), "Select script folder");
|
||||
if (!selectedFolder.isEmpty())
|
||||
{
|
||||
QString filePathString = RiaApplication::instance()->preferences()->scriptDirectories();
|
||||
|
||||
QChar separator(';');
|
||||
if (!filePathString.isEmpty() && !filePathString.endsWith(separator, Qt::CaseInsensitive))
|
||||
{
|
||||
filePathString += separator;
|
||||
}
|
||||
|
||||
filePathString += selectedFolder;
|
||||
|
||||
RiaApplication::instance()->preferences()->scriptDirectories = filePathString;
|
||||
RiaApplication::instance()->applyPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddScriptPathFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Add Script Path");
|
||||
}
|
40
ApplicationCode/Commands/RicAddScriptPathFeature.h
Normal file
40
ApplicationCode/Commands/RicAddScriptPathFeature.h
Normal file
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicAddScriptPathFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
81
ApplicationCode/Commands/RicDeleteScriptPathFeature.cpp
Normal file
81
ApplicationCode/Commands/RicDeleteScriptPathFeature.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicDeleteScriptPathFeature.h"
|
||||
|
||||
#include "RicScriptFeatureImpl.h"
|
||||
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicDeleteScriptPathFeature, "RicDeleteScriptPathFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteScriptPathFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimScriptCollection*> selection = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteScriptPathFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
RimScriptCollection* scriptCollection = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : NULL;
|
||||
if (scriptCollection)
|
||||
{
|
||||
QString toBeRemoved = scriptCollection->directory;
|
||||
|
||||
QString originalFilePathString = RiaApplication::instance()->preferences()->scriptDirectories();
|
||||
QString filePathString = originalFilePathString.remove(toBeRemoved);
|
||||
|
||||
// Remove duplicate separators
|
||||
QChar separator(';');
|
||||
QString regExpString = QString("%1{1,5}").arg(separator);
|
||||
filePathString.replace(QRegExp(regExpString), separator);
|
||||
|
||||
// Remove separator at end
|
||||
if (filePathString.endsWith(separator))
|
||||
{
|
||||
filePathString = filePathString.left(filePathString.size() - 1);
|
||||
}
|
||||
|
||||
RiaApplication::instance()->preferences()->scriptDirectories = filePathString;
|
||||
RiaApplication::instance()->applyPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteScriptPathFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Delete Script Path");
|
||||
}
|
40
ApplicationCode/Commands/RicDeleteScriptPathFeature.h
Normal file
40
ApplicationCode/Commands/RicDeleteScriptPathFeature.h
Normal file
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicDeleteScriptPathFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "RicEditScriptFeature.h"
|
||||
|
||||
#include "RicScriptFeatureImpl.h"
|
||||
|
||||
#include "RimCalcScript.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
@ -37,7 +39,7 @@ CAF_CMD_SOURCE_INIT(RicEditScriptFeature, "RicEditScriptFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEditScriptFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimCalcScript*> selection = selectedScripts();
|
||||
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
@ -46,7 +48,7 @@ bool RicEditScriptFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEditScriptFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimCalcScript*> selection = selectedScripts();
|
||||
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
|
||||
CVF_ASSERT(selection.size() > 0);
|
||||
|
||||
RimCalcScript* calcScript = selection[0];
|
||||
@ -75,14 +77,3 @@ void RicEditScriptFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Edit");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCalcScript*> RicEditScriptFeature::selectedScripts()
|
||||
{
|
||||
std::vector<RimCalcScript*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimCalcScript;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@ -37,9 +35,6 @@ protected:
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
std::vector<RimCalcScript*> selectedScripts();
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "RicExecuteScriptFeature.h"
|
||||
|
||||
#include "RicScriptFeatureImpl.h"
|
||||
|
||||
#include "RimCalcScript.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
@ -35,7 +37,7 @@ CAF_CMD_SOURCE_INIT(RicExecuteScriptFeature, "RicExecuteScriptFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExecuteScriptFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimCalcScript*> selection = selectedScripts();
|
||||
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
@ -44,7 +46,7 @@ bool RicExecuteScriptFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExecuteScriptFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimCalcScript*> selection = selectedScripts();
|
||||
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
|
||||
CVF_ASSERT(selection.size() > 0);
|
||||
|
||||
RimCalcScript* calcScript = selection[0];
|
||||
@ -74,14 +76,3 @@ void RicExecuteScriptFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Execute");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCalcScript*> RicExecuteScriptFeature::selectedScripts()
|
||||
{
|
||||
std::vector<RimCalcScript*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimCalcScript;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@ -37,9 +35,6 @@ protected:
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
std::vector<RimCalcScript*> selectedScripts();
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,14 +19,14 @@
|
||||
|
||||
#include "RicNewScriptFeature.h"
|
||||
|
||||
#include "RicScriptFeatureImpl.h"
|
||||
|
||||
#include "RimCalcScript.h"
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
@ -38,7 +38,7 @@ CAF_CMD_SOURCE_INIT(RicNewScriptFeature, "RicNewScriptFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewScriptFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimCalcScript*> selection = selectedScripts();
|
||||
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
@ -47,8 +47,8 @@ bool RicNewScriptFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewScriptFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimCalcScript*> calcScripts = selectedScripts();
|
||||
std::vector<RimScriptCollection*> calcScriptCollections = selectedScriptCollections();
|
||||
std::vector<RimCalcScript*> calcScripts = RicScriptFeatureImpl::selectedScripts();
|
||||
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
|
||||
RimCalcScript* calcScript = calcScripts.size() > 0 ? calcScripts[0] : NULL;
|
||||
RimScriptCollection* scriptColl = calcScriptCollections.size() > 0 ? calcScriptCollections[0] : NULL;
|
||||
@ -103,25 +103,3 @@ void RicNewScriptFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("New");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCalcScript*> RicNewScriptFeature::selectedScripts()
|
||||
{
|
||||
std::vector<RimCalcScript*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimScriptCollection*> RicNewScriptFeature::selectedScriptCollections()
|
||||
{
|
||||
std::vector<RimScriptCollection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
@ -23,9 +23,6 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimCalcScript;
|
||||
class RimScriptCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@ -38,10 +35,6 @@ protected:
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
std::vector<RimCalcScript*> selectedScripts();
|
||||
std::vector<RimScriptCollection*> selectedScriptCollections();
|
||||
};
|
||||
|
||||
|
||||
|
46
ApplicationCode/Commands/RicScriptFeatureImpl.cpp
Normal file
46
ApplicationCode/Commands/RicScriptFeatureImpl.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicScriptFeatureImpl.h"
|
||||
|
||||
#include "RimCalcScript.h"
|
||||
#include "RimScriptCollection.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCalcScript*> RicScriptFeatureImpl::selectedScripts()
|
||||
{
|
||||
std::vector<RimCalcScript*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimScriptCollection*> RicScriptFeatureImpl::selectedScriptCollections()
|
||||
{
|
||||
std::vector<RimScriptCollection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection;
|
||||
}
|
39
ApplicationCode/Commands/RicScriptFeatureImpl.h
Normal file
39
ApplicationCode/Commands/RicScriptFeatureImpl.h
Normal file
@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimCalcScript;
|
||||
class RimScriptCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicScriptFeatureImpl
|
||||
{
|
||||
public:
|
||||
static std::vector<RimCalcScript*> selectedScripts();
|
||||
static std::vector<RimScriptCollection*> selectedScriptCollections();
|
||||
};
|
||||
|
||||
|
@ -661,6 +661,11 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicExecuteScriptFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimScriptCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddScriptPathFeature";
|
||||
commandIds << "RicDeleteScriptPathFeature";
|
||||
}
|
||||
}
|
||||
|
||||
if (RicToggleItemsFeatureImpl::isToggleCommandsAvailable())
|
||||
|
@ -1340,6 +1340,7 @@ void RimUiTreeView::setExpandedUpToRoot(const QModelIndex& itemIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// OBSOLETE - see RicAddScriptPathFeature
|
||||
void RimUiTreeView::slotAddScriptPath()
|
||||
{
|
||||
QString selectedFolder = QFileDialog::getExistingDirectory(this, "Select script folder");
|
||||
@ -1363,6 +1364,7 @@ void RimUiTreeView::slotAddScriptPath()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// OBSOLETE - see RicDeleteScriptPathFeature
|
||||
void RimUiTreeView::slotDeleteScriptPath()
|
||||
{
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
|
Loading…
Reference in New Issue
Block a user