forked from qt-creator/qt-creator
Give TextEditorActionHandler an explicit parent and unify usage.
The action handler implicitly passed ownership to ICore, which is non- to the action handler. We now consistently create the action handler in the editor factory, give ownership to the editor factory, and don't hold a reference to it. Change-Id: I4372f8de966e3ceff87c06c5528c6b54522c1d57 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -80,6 +80,12 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
|
||||
addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
|
||||
addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
||||
|
||||
new TextEditor::TextEditorActionHandler(this, CppEditor::Constants::C_CPPEDITOR,
|
||||
TextEditor::TextEditorActionHandler::Format
|
||||
| TextEditor::TextEditorActionHandler::UnCommentSelection
|
||||
| TextEditor::TextEditorActionHandler::UnCollapseAll
|
||||
| TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
|
||||
|
||||
if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_cpp.png", CppEditor::Constants::CPP_SOURCE_MIMETYPE);
|
||||
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_c.png", CppEditor::Constants::C_SOURCE_MIMETYPE);
|
||||
@@ -100,7 +106,6 @@ IEditor *CppEditorFactory::createEditor(QWidget *parent)
|
||||
CppEditorPlugin *CppEditorPlugin::m_instance = 0;
|
||||
|
||||
CppEditorPlugin::CppEditorPlugin() :
|
||||
m_actionHandler(0),
|
||||
m_sortedOutline(false),
|
||||
m_renameSymbolUnderCursorAction(0),
|
||||
m_findUsagesAction(0),
|
||||
@@ -114,7 +119,6 @@ CppEditorPlugin::CppEditorPlugin() :
|
||||
|
||||
CppEditorPlugin::~CppEditorPlugin()
|
||||
{
|
||||
delete m_actionHandler;
|
||||
m_instance = 0;
|
||||
}
|
||||
|
||||
@@ -290,12 +294,6 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+F12") : tr("Ctrl+Shift+F12")));
|
||||
connect(inspectCppCodeModel, SIGNAL(triggered()), this, SLOT(inspectCppCodeModel()));
|
||||
|
||||
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
|
||||
TextEditor::TextEditorActionHandler::Format
|
||||
| TextEditor::TextEditorActionHandler::UnCommentSelection
|
||||
| TextEditor::TextEditorActionHandler::UnCollapseAll
|
||||
| TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
|
||||
|
||||
contextMenu->addSeparator(context);
|
||||
|
||||
cmd = ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
|
||||
|
||||
Reference in New Issue
Block a user