forked from qt-creator/qt-creator
TextEditor: Split the global QuickFixFactory list
It's only ever used in the filtered Cpp/QmlJs variants. Splitting the class simplifies the code and avoids re-doing filtering over and over again. Also inline QuickFixFactory::matchingOperations() into callers Change-Id: I730756315f2e0321649259ef229631233b12fbdd Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -452,26 +452,24 @@ void RunAllQuickFixesTokenAction::run(CppEditorWidget *editorWidget)
|
||||
if (qfi.path().isEmpty())
|
||||
return;
|
||||
|
||||
for (QuickFixFactory *quickFixFactory : QuickFixFactory::allQuickFixFactories()) {
|
||||
if (auto cppQuickFixFactory = qobject_cast<CppQuickFixFactory *>(quickFixFactory)) {
|
||||
QuickFixOperations operations;
|
||||
// Some Quick Fixes pop up a dialog and are therefore inappropriate for this test.
|
||||
// Where possible, use a guiless version of the factory.
|
||||
if (qobject_cast<InsertVirtualMethods *>(cppQuickFixFactory)) {
|
||||
QScopedPointer<CppQuickFixFactory> factoryProducingGuiLessOperations;
|
||||
factoryProducingGuiLessOperations.reset(InsertVirtualMethods::createTestFactory());
|
||||
factoryProducingGuiLessOperations->match(qfi, operations);
|
||||
} else {
|
||||
cppQuickFixFactory->match(qfi, operations);
|
||||
}
|
||||
for (CppQuickFixFactory *cppQuickFixFactory : CppQuickFixFactory::cppQuickFixFactories()) {
|
||||
QuickFixOperations operations;
|
||||
// Some Quick Fixes pop up a dialog and are therefore inappropriate for this test.
|
||||
// Where possible, use a guiless version of the factory.
|
||||
if (qobject_cast<InsertVirtualMethods *>(cppQuickFixFactory)) {
|
||||
QScopedPointer<CppQuickFixFactory> factoryProducingGuiLessOperations;
|
||||
factoryProducingGuiLessOperations.reset(InsertVirtualMethods::createTestFactory());
|
||||
factoryProducingGuiLessOperations->match(qfi, operations);
|
||||
} else {
|
||||
cppQuickFixFactory->match(qfi, operations);
|
||||
}
|
||||
|
||||
foreach (QuickFixOperation::Ptr operation, operations) {
|
||||
qDebug() << " -- Performing Quick Fix" << operation->description();
|
||||
operation->perform();
|
||||
TestActionsTestCase::escape();
|
||||
TestActionsTestCase::undoChangesInAllEditorWidgets();
|
||||
QApplication::processEvents();
|
||||
}
|
||||
foreach (QuickFixOperation::Ptr operation, operations) {
|
||||
qDebug() << " -- Performing Quick Fix" << operation->description();
|
||||
operation->perform();
|
||||
TestActionsTestCase::escape();
|
||||
TestActionsTestCase::undoChangesInAllEditorWidgets();
|
||||
QApplication::processEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user