Add `Find References' of a symbol to the context menu only when the environment variable QTCREATOR_REFERENCES is defined.

This commit is contained in:
Roberto Raggi
2009-09-23 16:45:11 +02:00
parent 9b501d6369
commit f8725cf9f3

View File

@@ -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