summaryrefslogtreecommitdiff
path: root/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@theqtcompany.com>2016-04-29 13:25:10 +0200
committerThomas Hartmann <Thomas.Hartmann@theqtcompany.com>2016-05-02 07:42:02 +0000
commit6ba8be3d8a108f014f681a15e38b330efabe0913 (patch)
tree6250c694fd273887fc5965af79630aeb3c02cb8f /src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
parent86e59fa1abce8b345c52270a4f755692a561eb49 (diff)
downloadqt-creator-6ba8be3d8a108f014f681a15e38b330efabe0913.tar.gz
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>
Diffstat (limited to 'src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp')
-rw-r--r--src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
index f0116d28c2..bbe1c5c3dd 100644
--- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
+++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
@@ -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