aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp36
-rw-r--r--src/plugins/cmakeprojectmanager/cmakelocatorfilter.h13
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp3
3 files changed, 49 insertions, 3 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
index fccf745fc39..cfaaefe1789 100644
--- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
@@ -28,12 +28,13 @@
#include "cmakebuildstep.h"
#include "cmakeproject.h"
+#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/buildsteplist.h>
#include <utils/algorithm.h>
@@ -160,3 +161,34 @@ void BuildCMakeTargetLocatorFilter::accept(Core::LocatorFilterEntry selection,
ProjectExplorerPlugin::buildProject(cmakeProject);
buildStep->setBuildTarget(oldTarget);
}
+
+// --------------------------------------------------------------------
+// OpenCMakeTargetLocatorFilter:
+// --------------------------------------------------------------------
+
+OpenCMakeTargetLocatorFilter::OpenCMakeTargetLocatorFilter()
+{
+ setId("Open CMake target definition");
+ setDisplayName(tr("Open CMake target"));
+ setShortcutString("cmo");
+ setPriority(Medium);
+}
+
+void OpenCMakeTargetLocatorFilter::accept(Core::LocatorFilterEntry selection,
+ QString *newText,
+ int *selectionStart,
+ int *selectionLength) const
+{
+ Q_UNUSED(newText)
+ Q_UNUSED(selectionStart)
+ Q_UNUSED(selectionLength)
+
+ const QVariantMap extraData = selection.internalData.toMap();
+ const int line = extraData.value("line").toInt();
+ const QString file = extraData.value("file").toString();
+
+ if (line >= 0)
+ Core::EditorManager::openEditorAt(file, line);
+ else
+ Core::EditorManager::openEditor(file);
+}
diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h
index d68db1a4967..7bf295dd289 100644
--- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h
+++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h
@@ -61,5 +61,18 @@ public:
int *selectionLength) const final;
};
+class OpenCMakeTargetLocatorFilter : CMakeTargetLocatorFilter
+{
+ Q_OBJECT
+
+public:
+ OpenCMakeTargetLocatorFilter();
+
+ void accept(Core::LocatorFilterEntry selection,
+ QString *newText,
+ int *selectionStart,
+ int *selectionLength) const final;
+};
+
} // namespace Internal
} // namespace CMakeProjectManager
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
index facbcaa9f62..d8d2164395e 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
@@ -75,7 +75,8 @@ public:
SimpleRunWorkerFactory<SimpleTargetRunner, CMakeRunConfiguration> runWorkerFactory;
CMakeBuildConfigurationFactory buildConfigFactory;
CMakeEditorFactory editorFactor;
- BuildCMakeTargetLocatorFilter buildCMakeTargetLocatorFiler;
+ BuildCMakeTargetLocatorFilter buildCMakeTargetLocatorFilter;
+ OpenCMakeTargetLocatorFilter openCMakeTargetLocationFilter;
CMakeKitAspect cmakeKitAspect;
CMakeGeneratorKitAspect cmakeGeneratorKitAspect;