diff options
author | hjk <hjk@qt.io> | 2017-12-15 15:46:37 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-12-18 15:39:51 +0000 |
commit | 479ab4ef22e8810f059307b9eca68b79893db7a4 (patch) | |
tree | 31a9eb3710868f2a2619576af949c97866c15c6b /src/plugins/cppeditor/cppquickfixassistant.cpp | |
parent | 4ed12d95f83a50d6020270b85718b446604df7f2 (diff) |
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>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfixassistant.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppquickfixassistant.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/cppeditor/cppquickfixassistant.cpp b/src/plugins/cppeditor/cppquickfixassistant.cpp index 7517e4c136..8fdcbe6601 100644 --- a/src/plugins/cppeditor/cppquickfixassistant.cpp +++ b/src/plugins/cppeditor/cppquickfixassistant.cpp @@ -55,12 +55,13 @@ class CppQuickFixAssistProcessor : public IAssistProcessor IAssistProposal *perform(const AssistInterface *interface) override { QSharedPointer<const AssistInterface> assistInterface(interface); + auto cppInterface = assistInterface.staticCast<const CppQuickFixInterface>(); + if (cppInterface->path().isEmpty()) + return nullptr; QuickFixOperations quickFixes; - - for (QuickFixFactory *factory : QuickFixFactory::allQuickFixFactories()) - if (qobject_cast<CppQuickFixFactory *>(factory) != nullptr) - factory->matchingOperations(assistInterface, quickFixes); + for (CppQuickFixFactory *factory : CppQuickFixFactory::cppQuickFixFactories()) + factory->match(*cppInterface, quickFixes); return GenericProposal::createProposal(interface, quickFixes); } |