forked from qt-creator/qt-creator
CppEditor: Do not add QuickFixFactories to object pool anymore
Not needed anymore. Also some cleanup, no 'using' in headers etc. Change-Id: I8c4547d80d0c0ffd989d1efbc74687c9f56096a4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -69,6 +69,7 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
using namespace CppTools;
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -128,6 +129,7 @@ CppEditorPlugin::CppEditorPlugin() :
|
|||||||
|
|
||||||
CppEditorPlugin::~CppEditorPlugin()
|
CppEditorPlugin::~CppEditorPlugin()
|
||||||
{
|
{
|
||||||
|
destroyCppQuickFixes();
|
||||||
m_instance = 0;
|
m_instance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +154,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
|||||||
&CppEditor::decorateEditor);
|
&CppEditor::decorateEditor);
|
||||||
|
|
||||||
m_quickFixProvider = new CppQuickFixAssistProvider(this);
|
m_quickFixProvider = new CppQuickFixAssistProvider(this);
|
||||||
registerQuickFixes(this);
|
createCppQuickFixes();
|
||||||
|
|
||||||
Context context(Constants::CPPEDITOR_ID);
|
Context context(Constants::CPPEDITOR_ID);
|
||||||
|
|
||||||
|
@@ -62,12 +62,14 @@ public:
|
|||||||
CppQuickFixFactory();
|
CppQuickFixFactory();
|
||||||
~CppQuickFixFactory();
|
~CppQuickFixFactory();
|
||||||
|
|
||||||
|
using QuickFixOperations = TextEditor::QuickFixOperations;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Implement this function to match and create the appropriate
|
Implement this function to match and create the appropriate
|
||||||
CppQuickFixOperation objects.
|
CppQuickFixOperation objects.
|
||||||
*/
|
*/
|
||||||
virtual void match(const Internal::CppQuickFixInterface &interface,
|
virtual void match(const Internal::CppQuickFixInterface &interface,
|
||||||
TextEditor::QuickFixOperations &result) = 0;
|
QuickFixOperations &result) = 0;
|
||||||
|
|
||||||
static const QList<CppQuickFixFactory *> &cppQuickFixFactories();
|
static const QList<CppQuickFixFactory *> &cppQuickFixFactories();
|
||||||
};
|
};
|
||||||
|
@@ -48,6 +48,7 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppEditor::Internal::Tests;
|
using namespace CppEditor::Internal::Tests;
|
||||||
|
using namespace CppTools;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
using CppTools::Tests::TestIncludePaths;
|
using CppTools::Tests::TestIncludePaths;
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "cppquickfixes.h"
|
#include "cppquickfixes.h"
|
||||||
|
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
|
#include <cpptools/cpprefactoringchanges.h>
|
||||||
|
|
||||||
#include <texteditor/codeassist/genericproposal.h>
|
#include <texteditor/codeassist/genericproposal.h>
|
||||||
#include <texteditor/codeassist/iassistprocessor.h>
|
#include <texteditor/codeassist/iassistprocessor.h>
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include <cpptools/cppclassesfilter.h>
|
#include <cpptools/cppclassesfilter.h>
|
||||||
#include <cpptools/cppcodestylesettings.h>
|
#include <cpptools/cppcodestylesettings.h>
|
||||||
#include <cpptools/cpppointerdeclarationformatter.h>
|
#include <cpptools/cpppointerdeclarationformatter.h>
|
||||||
|
#include <cpptools/cpprefactoringchanges.h>
|
||||||
#include <cpptools/cpptoolsbridge.h>
|
#include <cpptools/cpptoolsbridge.h>
|
||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
#include <cpptools/cpptoolsreuse.h>
|
#include <cpptools/cpptoolsreuse.h>
|
||||||
@@ -99,59 +100,6 @@ const QList<CppQuickFixFactory *> &CppQuickFixFactory::cppQuickFixFactories()
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
void registerQuickFixes(ExtensionSystem::IPlugin *plugIn)
|
|
||||||
{
|
|
||||||
plugIn->addAutoReleasedObject(new AddIncludeForUndefinedIdentifier);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new FlipLogicalOperands);
|
|
||||||
plugIn->addAutoReleasedObject(new InverseLogicalComparison);
|
|
||||||
plugIn->addAutoReleasedObject(new RewriteLogicalAnd);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new ConvertToCamelCase);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new ConvertCStringToNSString);
|
|
||||||
plugIn->addAutoReleasedObject(new ConvertNumericLiteral);
|
|
||||||
plugIn->addAutoReleasedObject(new TranslateStringLiteral);
|
|
||||||
plugIn->addAutoReleasedObject(new WrapStringLiteral);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new MoveDeclarationOutOfIf);
|
|
||||||
plugIn->addAutoReleasedObject(new MoveDeclarationOutOfWhile);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new SplitIfStatement);
|
|
||||||
plugIn->addAutoReleasedObject(new SplitSimpleDeclaration);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new AddLocalDeclaration);
|
|
||||||
plugIn->addAutoReleasedObject(new AddBracesToIf);
|
|
||||||
plugIn->addAutoReleasedObject(new RearrangeParamDeclarationList);
|
|
||||||
plugIn->addAutoReleasedObject(new ReformatPointerDeclaration);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new CompleteSwitchCaseStatement);
|
|
||||||
plugIn->addAutoReleasedObject(new InsertQtPropertyMembers);
|
|
||||||
plugIn->addAutoReleasedObject(new ConvertQt4Connect);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new ApplyDeclDefLinkChanges);
|
|
||||||
plugIn->addAutoReleasedObject(new ConvertFromAndToPointer);
|
|
||||||
plugIn->addAutoReleasedObject(new ExtractFunction);
|
|
||||||
plugIn->addAutoReleasedObject(new ExtractLiteralAsParameter);
|
|
||||||
plugIn->addAutoReleasedObject(new GenerateGetterSetter);
|
|
||||||
plugIn->addAutoReleasedObject(new InsertDeclFromDef);
|
|
||||||
plugIn->addAutoReleasedObject(new InsertDefFromDecl);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new MoveFuncDefOutside);
|
|
||||||
plugIn->addAutoReleasedObject(new MoveAllFuncDefOutside);
|
|
||||||
plugIn->addAutoReleasedObject(new MoveFuncDefToDecl);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new AssignToLocalVariable);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new InsertVirtualMethods);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new OptimizeForLoop);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new EscapeStringLiteral);
|
|
||||||
|
|
||||||
plugIn->addAutoReleasedObject(new ExtraRefactoringOperations);
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the following anonymous namespace all functions are collected, which could be of interest for
|
// In the following anonymous namespace all functions are collected, which could be of interest for
|
||||||
// different quick fixes.
|
// different quick fixes.
|
||||||
namespace {
|
namespace {
|
||||||
@@ -6077,7 +6025,64 @@ void ExtraRefactoringOperations::match(const CppQuickFixInterface &interface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void createCppQuickFixes()
|
||||||
|
{
|
||||||
|
new AddIncludeForUndefinedIdentifier;
|
||||||
|
|
||||||
|
new FlipLogicalOperands;
|
||||||
|
new InverseLogicalComparison;
|
||||||
|
new RewriteLogicalAnd;
|
||||||
|
|
||||||
|
new ConvertToCamelCase;
|
||||||
|
|
||||||
|
new ConvertCStringToNSString;
|
||||||
|
new ConvertNumericLiteral;
|
||||||
|
new TranslateStringLiteral;
|
||||||
|
new WrapStringLiteral;
|
||||||
|
|
||||||
|
new MoveDeclarationOutOfIf;
|
||||||
|
new MoveDeclarationOutOfWhile;
|
||||||
|
|
||||||
|
new SplitIfStatement;
|
||||||
|
new SplitSimpleDeclaration;
|
||||||
|
|
||||||
|
new AddLocalDeclaration;
|
||||||
|
new AddBracesToIf;
|
||||||
|
new RearrangeParamDeclarationList;
|
||||||
|
new ReformatPointerDeclaration;
|
||||||
|
|
||||||
|
new CompleteSwitchCaseStatement;
|
||||||
|
new InsertQtPropertyMembers;
|
||||||
|
new ConvertQt4Connect;
|
||||||
|
|
||||||
|
new ApplyDeclDefLinkChanges;
|
||||||
|
new ConvertFromAndToPointer;
|
||||||
|
new ExtractFunction;
|
||||||
|
new ExtractLiteralAsParameter;
|
||||||
|
new GenerateGetterSetter;
|
||||||
|
new InsertDeclFromDef;
|
||||||
|
new InsertDefFromDecl;
|
||||||
|
|
||||||
|
new MoveFuncDefOutside;
|
||||||
|
new MoveAllFuncDefOutside;
|
||||||
|
new MoveFuncDefToDecl;
|
||||||
|
|
||||||
|
new AssignToLocalVariable;
|
||||||
|
|
||||||
|
new InsertVirtualMethods;
|
||||||
|
|
||||||
|
new OptimizeForLoop;
|
||||||
|
|
||||||
|
new EscapeStringLiteral;
|
||||||
|
|
||||||
|
new ExtraRefactoringOperations;
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroyCppQuickFixes()
|
||||||
|
{
|
||||||
|
for (int i = g_cppQuickFixFactories.size(); --i >= 0; )
|
||||||
|
delete g_cppQuickFixFactories.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
@@ -28,22 +28,6 @@
|
|||||||
#include "cppeditor_global.h"
|
#include "cppeditor_global.h"
|
||||||
#include "cppquickfix.h"
|
#include "cppquickfix.h"
|
||||||
|
|
||||||
#include <cpptools/cpprefactoringchanges.h>
|
|
||||||
#include <extensionsystem/iplugin.h>
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QByteArray;
|
|
||||||
template <class> class QList;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
using namespace CppTools;
|
|
||||||
using namespace CPlusPlus;
|
|
||||||
using namespace TextEditor;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Adding New Quick Fixes
|
/// Adding New Quick Fixes
|
||||||
///
|
///
|
||||||
@@ -55,7 +39,8 @@ using namespace TextEditor;
|
|||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
void registerQuickFixes(ExtensionSystem::IPlugin *plugIn);
|
void createCppQuickFixes();
|
||||||
|
void destroyCppQuickFixes();
|
||||||
|
|
||||||
class ExtraRefactoringOperations : public CppQuickFixFactory
|
class ExtraRefactoringOperations : public CppQuickFixFactory
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user