QmlJSEditor: Export ComponentFromObjectDef

This makes it possible to use the functionality from the designer.

Change-Id: Id91ed4c0adb22ff91d39be73689aec4f340342b8
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2016-04-29 13:25:10 +02:00
parent 86e59fa1ab
commit 6ba8be3d8a
2 changed files with 16 additions and 3 deletions

View File

@@ -34,6 +34,7 @@
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljsdocument.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/qmljsutils.h>
#include <qmljs/qmljspropertyreader.h>
#include <qmljs/qmljsrewriter.h>
@@ -253,4 +254,16 @@ void ComponentFromObjectDef::match(const QmlJSQuickFixInterface &interface, Quic
}
}
void ComponentFromObjectDef::perform(const QString &fileName, QmlJS::AST::UiObjectDefinition *objDef)
{
QmlJSRefactoringChanges refactoring(QmlJS::ModelManagerInterface::instance(),
QmlJS::ModelManagerInterface::instance()->snapshot());
QmlJSRefactoringFilePtr current = refactoring.file(fileName);
QmlJSQuickFixInterface interface;
Operation operation(interface, objDef);
operation.performChanges(current, refactoring);
}
} //namespace QmlJSEditor

View File

@@ -28,13 +28,13 @@
#include "qmljsquickfix.h"
namespace QmlJSEditor {
namespace Internal {
class ComponentFromObjectDef: public QmlJSQuickFixFactory
class QMLJSEDITOR_EXPORT ComponentFromObjectDef : public QmlJSQuickFixFactory
{
public:
void match(const QmlJSQuickFixInterface &interface, QuickFixOperations &result);
static void perform(const QString &fileName, QmlJS::AST::UiObjectDefinition *objDef);
};
} // namespace Internal
} // namespace QmlJSEditor