[C++] Added object pool handling for CompletionAssistProvider.

Change-Id: I89634989a7f360a30f7ed1bde4e67c93551ddfe4
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
Erik Verbruggen
2012-02-21 10:00:32 +01:00
parent f3a3bf78c0
commit 2d262bd3b7
13 changed files with 212 additions and 286 deletions

View File

@@ -34,8 +34,7 @@
#include <cplusplus/Overview.h>
#include "cppmodelmanager.h"
#include "cppcompletionsupport.h"
#include "cppcompletionsupportinternal.h"
#include "cppcompletionassist.h"
#include "cpphighlightingsupport.h"
#include "cpphighlightingsupportinternal.h"
#include "abstracteditorsupport.h"
@@ -735,14 +734,16 @@ CppModelManager::CppModelManager(QObject *parent)
connect(Core::ICore::editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)),
this, SLOT(editorAboutToClose(Core::IEditor *)));
m_completionFallback = new CppCompletionSupportInternalFactory;
m_completionFactory = m_completionFallback;
m_completionFallback = new InternalCompletionAssistProvider;
m_completionAssistProvider = m_completionFallback;
ExtensionSystem::PluginManager::instance()->addObject(m_completionAssistProvider);
m_highlightingFallback = new CppHighlightingSupportInternalFactory;
m_highlightingFactory = m_highlightingFallback;
}
CppModelManager::~CppModelManager()
{
ExtensionSystem::PluginManager::instance()->removeObject(m_completionAssistProvider);
delete m_completionFallback;
delete m_highlightingFallback;
}
@@ -1346,17 +1347,19 @@ void CppModelManager::finishedRefreshingSourceFiles(const QStringList &files)
CppCompletionSupport *CppModelManager::completionSupport(Core::IEditor *editor) const
{
if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor))
return m_completionFactory->completionSupport(textEditor);
return m_completionAssistProvider->completionSupport(textEditor);
else
return 0;
}
void CppModelManager::setCompletionSupportFactory(CppCompletionSupportFactory *completionFactory)
void CppModelManager::setCppCompletionAssistProvider(CppCompletionAssistProvider *completionAssistProvider)
{
if (completionFactory)
m_completionFactory = completionFactory;
ExtensionSystem::PluginManager::instance()->removeObject(m_completionAssistProvider);
if (completionAssistProvider)
m_completionAssistProvider = completionAssistProvider;
else
m_completionFactory = m_completionFallback;
m_completionAssistProvider = m_completionFallback;
ExtensionSystem::PluginManager::instance()->addObject(m_completionAssistProvider);
}
CppHighlightingSupport *CppModelManager::highlightingSupport(Core::IEditor *editor) const