forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user