Commit 2ae6d86e authored by Eike Ziller's avatar Eike Ziller
Browse files

Don't add singleton model manager to object pool.



Change-Id: Iffca99867b25500fc77bbcf1e17a50a7cc4cf832
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent 5539ed41
......@@ -87,17 +87,9 @@ bool BaseTextEditModifier::renameId(const QString &oldId, const QString &newId)
}
}
namespace {
static inline QmlJS::ModelManagerInterface *getModelManager()
{
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
return pluginManager->getObject<QmlJS::ModelManagerInterface>();
}
}
QmlJS::Snapshot BaseTextEditModifier::getSnapshot() const
{
QmlJS::ModelManagerInterface *modelManager = getModelManager();
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
if (modelManager)
return modelManager->snapshot();
else
......@@ -106,7 +98,7 @@ QmlJS::Snapshot BaseTextEditModifier::getSnapshot() const
QStringList BaseTextEditModifier::importPaths() const
{
QmlJS::ModelManagerInterface *modelManager = getModelManager();
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
if (modelManager)
return modelManager->importPaths();
else
......
......@@ -203,17 +203,9 @@ void PlainTextEditModifier::reactivateChangeSignals()
}
}
namespace {
static inline QmlJS::ModelManagerInterface *getModelManager()
{
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
return pluginManager->getObject<QmlJS::ModelManagerInterface>();
}
}
QmlJS::Snapshot NotIndentingTextEditModifier::getSnapshot() const
{
QmlJS::ModelManagerInterface *modelManager = getModelManager();
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
if (modelManager)
return modelManager->snapshot();
else
......@@ -223,7 +215,7 @@ QmlJS::Snapshot NotIndentingTextEditModifier::getSnapshot() const
QStringList NotIndentingTextEditModifier::importPaths() const
{
QmlJS::ModelManagerInterface *modelManager = getModelManager();
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
if (modelManager)
return modelManager->importPaths();
else
......
......@@ -507,7 +507,7 @@ QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) :
baseTextDocument()->setSyntaxHighlighter(new Highlighter(document()));
baseTextDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>();
m_modelManager = QmlJS::ModelManagerInterface::instance();
m_contextPane = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::IContextPane>();
......
......@@ -93,8 +93,7 @@ namespace {
HoverHandler::HoverHandler(QObject *parent) : BaseHoverHandler(parent), m_modelManager(0)
{
m_modelManager =
ExtensionSystem::PluginManager::instance()->getObject<QmlJS::ModelManagerInterface>();
m_modelManager = QmlJS::ModelManagerInterface::instance();
}
bool HoverHandler::acceptEditor(IEditor *editor)
......
......@@ -65,7 +65,7 @@ QmlJSQuickFixOperation::~QmlJSQuickFixOperation()
void QmlJSQuickFixOperation::perform()
{
QmlJSRefactoringChanges refactoring(ExtensionSystem::PluginManager::instance()->getObject<QmlJS::ModelManagerInterface>(),
QmlJSRefactoringChanges refactoring(QmlJS::ModelManagerInterface::instance(),
m_interface->semanticInfo().snapshot);
QmlJSRefactoringFilePtr current = refactoring.file(fileName());
......
......@@ -121,13 +121,6 @@ enum {
InspectorUi *InspectorUi::m_instance = 0;
QmlJS::ModelManagerInterface *modelManager()
{
ExtensionSystem::PluginManager *pm
= ExtensionSystem::PluginManager::instance();
return pm->getObject<QmlJS::ModelManagerInterface>();
}
InspectorUi::InspectorUi(QObject *parent)
: QObject(parent)
, m_listeningToEditorManager(false)
......@@ -365,7 +358,7 @@ void InspectorUi::connected(ClientProxy *clientProxy)
} else {
m_toolBar->setZoomToolEnabled(true);
}
QmlJS::Snapshot snapshot = modelManager()->snapshot();
QmlJS::Snapshot snapshot = QmlJS::ModelManagerInterface::instance()->snapshot();
for (QHash<QString, QmlJSLiveTextPreview *>::const_iterator it
= m_textPreviews.constBegin();
it != m_textPreviews.constEnd(); ++it) {
......@@ -481,11 +474,11 @@ void InspectorUi::changeSelectedItems(
void InspectorUi::initializeDocuments()
{
if (!modelManager() || !m_clientProxy)
if (!QmlJS::ModelManagerInterface::instance() || !m_clientProxy)
return;
Core::EditorManager *em = Core::EditorManager::instance();
m_loadedSnapshot = modelManager()->snapshot();
m_loadedSnapshot = QmlJS::ModelManagerInterface::instance()->snapshot();
if (!m_listeningToEditorManager) {
m_listeningToEditorManager = true;
......@@ -493,7 +486,7 @@ void InspectorUi::initializeDocuments()
this, SLOT(removePreviewForEditor(Core::IEditor*)));
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
this, SLOT(createPreviewForEditor(Core::IEditor*)));
connect(modelManager(),
connect(QmlJS::ModelManagerInterface::instance(),
SIGNAL(documentChangedOnDisk(QmlJS::Document::Ptr)),
this, SLOT(updatePendingPreviewDocuments(QmlJS::Document::Ptr)));
}
......@@ -508,7 +501,7 @@ void InspectorUi::initializeDocuments()
void InspectorUi::serverReloaded()
{
QmlJS::Snapshot snapshot = modelManager()->snapshot();
QmlJS::Snapshot snapshot = QmlJS::ModelManagerInterface::instance()->snapshot();
m_loadedSnapshot = snapshot;
for (QHash<QString, QmlJSLiveTextPreview *>::const_iterator it
= m_textPreviews.constBegin();
......@@ -540,7 +533,7 @@ QmlJSLiveTextPreview *InspectorUi::createPreviewForEditor(
)
{
QString filename = newEditor->document()->fileName();
QmlJS::Document::Ptr doc = modelManager()->snapshot().document(filename);
QmlJS::Document::Ptr doc = QmlJS::ModelManagerInterface::instance()->snapshot().document(filename);
if (!doc) {
if (filename.endsWith(".qml")) {
// add to list of docs that we have to update when
......
......@@ -70,13 +70,6 @@ InspectorPlugin::~InspectorPlugin()
{
}
QmlJS::ModelManagerInterface *InspectorPlugin::modelManager() const
{
ExtensionSystem::PluginManager *pluginManager
= ExtensionSystem::PluginManager::instance();
return pluginManager->getObject<QmlJS::ModelManagerInterface>();
}
InspectorUi *InspectorPlugin::inspector() const
{
return m_inspectorUi;
......
......@@ -61,7 +61,6 @@ public:
//static InspectorPlugin *instance();
QmlJS::ModelManagerInterface *modelManager() const;
InspectorUi *inspector() const;
// ExtensionSystem::IPlugin interface
......
......@@ -137,13 +137,6 @@ void MapObjectWithDebugReference::process(UiObjectBinding *ast)
}
}
QmlJS::ModelManagerInterface *QmlJSLiveTextPreview::modelManager()
{
ExtensionSystem::PluginManager *pm
= ExtensionSystem::PluginManager::instance();
return pm->getObject<QmlJS::ModelManagerInterface>();
}
void QmlJSLiveTextPreview::associateEditor(Core::IEditor *editor)
{
using namespace TextEditor;
......@@ -197,7 +190,7 @@ QmlJSLiveTextPreview::QmlJSLiveTextPreview(const QmlJS::Document::Ptr &doc,
Q_ASSERT(doc->fileName() == initDoc->fileName());
m_filename = doc->fileName();
connect(modelManager(), SIGNAL(documentChangedOnDisk(QmlJS::Document::Ptr)),
connect(QmlJS::ModelManagerInterface::instance(), SIGNAL(documentChangedOnDisk(QmlJS::Document::Ptr)),
SLOT(documentChanged(QmlJS::Document::Ptr)));
if (m_clientProxy.data()) {
......
......@@ -100,7 +100,6 @@ private slots:
void reloadQmlViewer();
private:
static QmlJS::ModelManagerInterface *modelManager();
QList<int> objectReferencesForOffset(quint32 offset);
QVariant castToLiteral(const QString &expression,
QmlJS::AST::UiScriptBinding *scriptBinding);
......
......@@ -89,7 +89,6 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
// m_modelManager, SLOT(updateModifiedSourceFiles()));
// connect(fileManager, SIGNAL(filesChangedInternally(QStringList)),
// m_modelManager, SLOT(updateSourceFiles(QStringList)));
addAutoReleasedObject(m_modelManager);
LocatorData *locatorData = new LocatorData;
addAutoReleasedObject(locatorData);
......
......@@ -61,7 +61,7 @@ namespace QmlProjectManager {
QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
: m_manager(manager),
m_fileName(fileName),
m_modelManager(ExtensionSystem::PluginManager::instance()->getObject<QmlJS::ModelManagerInterface>())
m_modelManager(QmlJS::ModelManagerInterface::instance())
{
setProjectContext(Core::Context(QmlProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguage(Core::Context(QmlProjectManager::Constants::LANG_QML));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment