summaryrefslogtreecommitdiff
path: root/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2012-03-27 23:18:46 +0400
committerhjk <qthjk@ovi.com>2012-03-28 08:38:41 +0200
commit7ae82b9f9453251861394ce9bec95d704353f83b (patch)
tree2bfc313abb7e1b0570664d2b9c976c362bdb74e5 /src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
parentaa722e6a608d04a943267514f1f043e37b19e874 (diff)
downloadqt-creator-7ae82b9f9453251861394ce9bec95d704353f83b.tar.gz
Added TextEditor commands FollowSymbol and JumpToFile.
Most of editors have "jump to file" or "follow symbol" actions. This patch reduces amount of related boilerplate code. New actions are made optional to prevent shortcut clash (both use F2). Change-Id: I2af580ed9d6789df25f4487ba001f3b83887c504 Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
index 17a9ccec1c..f054f6f066 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
@@ -54,7 +54,8 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
m_actionHandler =
new TextEditorActionHandler(Constants::C_CMAKEEDITOR,
- TextEditorActionHandler::UnCommentSelection);
+ TextEditorActionHandler::UnCommentSelection
+ | TextEditorActionHandler::JumpToFileUnderCursor);
ICore *core = ICore::instance();
ActionManager *am = core->actionManager();
@@ -62,11 +63,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
Command *cmd;
Context cmakeEditorContext = Context(Constants::C_CMAKEEDITOR);
- QAction *jumpToFile = new QAction(tr("Jump to File Under Cursor"), this);
- cmd = am->registerAction(jumpToFile,
- Constants::JUMP_TO_FILE, cmakeEditorContext);
- cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F2));
- connect(jumpToFile, SIGNAL(triggered()), this, SLOT(jumpToFile()));
+ cmd = am->command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR);
contextMenu->addAction(cmd);
QAction *separator = new QAction(this);
@@ -101,14 +98,6 @@ Core::IEditor *CMakeEditorFactory::createEditor(QWidget *parent)
return rc->editor();
}
-void CMakeEditorFactory::jumpToFile()
-{
- Core::EditorManager *em = Core::EditorManager::instance();
- CMakeEditorWidget *editor = qobject_cast<CMakeEditorWidget*>(em->currentEditor()->widget());
- if (editor)
- editor->jumpToFile();
-}
-
QStringList CMakeEditorFactory::mimeTypes() const
{
return m_mimeTypes;