From f8725cf9f3d4844cd5a78841fbfab7f1892cb627 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Wed, 23 Sep 2009 16:45:11 +0200
Subject: [PATCH] Add `Find References' of a symbol to the context menu only
 when the environment variable QTCREATOR_REFERENCES is defined.

---
 src/plugins/cppeditor/cppplugin.cpp | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp
index ca734678ac1..504ed2490a7 100644
--- a/src/plugins/cppeditor/cppplugin.cpp
+++ b/src/plugins/cppeditor/cppplugin.cpp
@@ -220,13 +220,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
     am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd);
     am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
 
-    QAction *findReferencesAction = new QAction(tr("Find References"), this);
-    cmd = am->registerAction(findReferencesAction,
-        Constants::FIND_REFERENCES, context);
-    cmd->setDefaultKeySequence(QKeySequence("F3"));
-    connect(findReferencesAction, SIGNAL(triggered()), this, SLOT(findReferences()));
-    am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd);
-    am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
+    if (! qgetenv("QTCREATOR_REFERENCES").isEmpty()) {
+        QAction *findReferencesAction = new QAction(tr("Find References"), this);
+        cmd = am->registerAction(findReferencesAction,
+                                 Constants::FIND_REFERENCES, context);
+        connect(findReferencesAction, SIGNAL(triggered()), this, SLOT(findReferences()));
+        am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd);
+        am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
+    }
 
     m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
         TextEditor::TextEditorActionHandler::Format
-- 
GitLab