Files
qt-creator/src/plugins/qmljseditor/qmljsquickfix.cpp

53 lines
1.4 KiB
C++
Raw Normal View History

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmljsquickfix.h"
#include "qmljscomponentfromobjectdef.h"
#include "qmljseditor.h"
#include "qmljsquickfixassist.h"
2010-07-26 13:06:33 +02:00
#include <extensionsystem/iplugin.h>
#include <extensionsystem/pluginmanager.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/parser/qmljsast_p.h>
#include <utils/algorithm.h>
2010-07-26 13:06:33 +02:00
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSTools;
using TextEditor::RefactoringChanges;
namespace QmlJSEditor {
using namespace Internal;
QmlJSQuickFixOperation::QmlJSQuickFixOperation(const QmlJSQuickFixInterface &interface,
int priority)
2010-07-26 13:06:33 +02:00
: QuickFixOperation(priority)
, m_interface(interface)
2010-06-07 12:12:07 +02:00
{
}
void QmlJSQuickFixOperation::perform()
{
QmlJSRefactoringChanges refactoring(ModelManagerInterface::instance(),
m_interface->semanticInfo().snapshot);
QmlJSRefactoringFilePtr current = refactoring.file(fileName());
performChanges(current, refactoring);
}
const QmlJSQuickFixAssistInterface *QmlJSQuickFixOperation::assistInterface() const
2010-07-26 13:06:33 +02:00
{
return m_interface.data();
2010-06-07 12:12:07 +02:00
}
Utils::FilePath QmlJSQuickFixOperation::fileName() const
{
return m_interface->semanticInfo().document->fileName();
}
} // namespace QmlJSEditor