Commit 57655e3e authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.rewriter: adding use of ModelManager to NotIndentingTextEditModifier

This fixes bugs in the copy and paste code.
Before we used an invalid snapshot and empty import paths and could
not resolve library imports properly.

Change-Id: I53df67bbba2b5abc73065b5729d0957e908cc874
Reviewed-on: http://codereview.qt.nokia.com/1708


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent a826ee72
......@@ -114,11 +114,9 @@ public:
virtual int indentDepth() const
{ return 0; }
virtual QmlJS::Snapshot getSnapshot() const
{ return QmlJS::Snapshot(); }
virtual QmlJS::Snapshot getSnapshot() const;
virtual QStringList importPaths() const
{ return QStringList(); }
virtual QStringList importPaths() const;
};
}
......
......@@ -33,6 +33,8 @@
#include "plaintexteditmodifier.h"
#include <utils/changeset.h>
#include <extensionsystem/pluginmanager.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <QtGui/QPlainTextEdit>
#include <QtGui/QUndoStack>
......@@ -189,3 +191,30 @@ void PlainTextEditModifier::reactivateChangeSignals()
emit textChanged();
}
}
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();
if (modelManager)
return modelManager->snapshot();
else
return QmlJS::Snapshot();
}
QStringList NotIndentingTextEditModifier::importPaths() const
{
QmlJS::ModelManagerInterface *modelManager = getModelManager();
if (modelManager)
return modelManager->importPaths();
else
return QStringList();
}
Supports Markdown
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