forked from qt-creator/qt-creator
... and remove outdated comment. Change-Id: I6dcd0a38608192ccdd6734affd33e170d39e8299 Reviewed-by: David Schulz <david.schulz@qt.io>
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
// 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 "qmljsquickfixassist.h"
|
|
|
|
#include <extensionsystem/iplugin.h>
|
|
#include <extensionsystem/pluginmanager.h>
|
|
|
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
|
#include <qmljs/parser/qmljsast_p.h>
|
|
|
|
#include <utils/algorithm.h>
|
|
|
|
using namespace QmlJS;
|
|
using namespace QmlJS::AST;
|
|
using namespace QmlJSTools;
|
|
using TextEditor::RefactoringFileFactory;
|
|
|
|
namespace QmlJSEditor {
|
|
|
|
using namespace Internal;
|
|
|
|
QmlJSQuickFixOperation::QmlJSQuickFixOperation(const QmlJSQuickFixAssistInterface *interface,
|
|
int priority)
|
|
: QuickFixOperation(priority)
|
|
, m_semanticInfo(interface->semanticInfo())
|
|
{
|
|
}
|
|
|
|
void QmlJSQuickFixOperation::perform()
|
|
{
|
|
QmlJSRefactoringChanges refactoring(ModelManagerInterface::instance(), semanticInfo().snapshot);
|
|
QmlJSRefactoringFilePtr current = refactoring.qmlJSFile(fileName());
|
|
|
|
performChanges(current, refactoring);
|
|
}
|
|
|
|
const QmlJSTools::SemanticInfo &QmlJSQuickFixOperation::semanticInfo() const
|
|
{
|
|
return m_semanticInfo;
|
|
}
|
|
|
|
Utils::FilePath QmlJSQuickFixOperation::fileName() const
|
|
{
|
|
return semanticInfo().document->fileName();
|
|
}
|
|
|
|
} // namespace QmlJSEditor
|