cppmodelmanagerinterface: use singleton instead of object pool

This commit is contained in:
hjk
2011-01-04 18:50:18 +01:00
parent 9d72c55347
commit d6a459c332
6 changed files with 13 additions and 29 deletions

View File

@@ -710,16 +710,6 @@ bool currentTextEditorPosition(QString *fileNameIn /* = 0 */,
return !fileName.isEmpty();
}
static CPlusPlus::CppModelManagerInterface *cppModelManager()
{
using namespace CPlusPlus;
static QPointer<CppModelManagerInterface> modelManager;
if (!modelManager.data())
modelManager = ExtensionSystem::PluginManager::instance()->
getObject<CPlusPlus::CppModelManagerInterface>();
return modelManager.data();
}
// Return the Cpp expression, and, if desired, the function
QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
int *line, int *column, QString *function /* = 0 */)
@@ -735,7 +725,7 @@ QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
return QByteArray();
QString expr = plaintext->textCursor().selectedText();
CppModelManagerInterface *modelManager = cppModelManager();
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
if (expr.isEmpty() && modelManager) {
QTextCursor tc(plaintext->document());
tc.setPosition(pos);