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:
@@ -34,6 +34,7 @@
|
||||
#include "qmljseditorplugin.h"
|
||||
|
||||
#include <qmljstools/qmljstoolsconstants.h>
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -52,6 +53,12 @@ QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
|
||||
addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE);
|
||||
addMimeType(QmlJSTools::Constants::JS_MIMETYPE);
|
||||
addMimeType(QmlJSTools::Constants::JSON_MIMETYPE);
|
||||
new TextEditor::TextEditorActionHandler(this, Constants::C_QMLJSEDITOR_ID,
|
||||
TextEditor::TextEditorActionHandler::Format
|
||||
| TextEditor::TextEditorActionHandler::UnCommentSelection
|
||||
| TextEditor::TextEditorActionHandler::UnCollapseAll
|
||||
| TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
|
||||
|
||||
}
|
||||
|
||||
Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <texteditor/textfilewizard.h>
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/json.h>
|
||||
|
||||
@@ -95,7 +94,6 @@ QmlJSEditorPlugin *QmlJSEditorPlugin::m_instance = 0;
|
||||
QmlJSEditorPlugin::QmlJSEditorPlugin() :
|
||||
m_modelManager(0),
|
||||
m_editor(0),
|
||||
m_actionHandler(0),
|
||||
m_quickFixAssistProvider(0),
|
||||
m_reformatFileAction(0),
|
||||
m_currentEditor(0),
|
||||
@@ -109,7 +107,6 @@ QmlJSEditorPlugin::QmlJSEditorPlugin() :
|
||||
QmlJSEditorPlugin::~QmlJSEditorPlugin()
|
||||
{
|
||||
removeObject(m_editor);
|
||||
delete m_actionHandler;
|
||||
m_instance = 0;
|
||||
}
|
||||
|
||||
@@ -165,12 +162,6 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
wizard->setId(QLatin1String("Z.Js"));
|
||||
addAutoReleasedObject(wizard);
|
||||
|
||||
m_actionHandler = new TextEditor::TextEditorActionHandler(Constants::C_QMLJSEDITOR_ID,
|
||||
TextEditor::TextEditorActionHandler::Format
|
||||
| TextEditor::TextEditorActionHandler::UnCommentSelection
|
||||
| TextEditor::TextEditorActionHandler::UnCollapseAll
|
||||
| TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
|
||||
|
||||
Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(Constants::M_CONTEXT);
|
||||
Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS));
|
||||
|
||||
|
||||
@@ -42,10 +42,6 @@ namespace Utils {
|
||||
class JsonSchemaManager;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
class TextEditorActionHandler;
|
||||
} // namespace TextEditor
|
||||
|
||||
namespace Core {
|
||||
class Command;
|
||||
class ActionContainer;
|
||||
@@ -115,7 +111,6 @@ private:
|
||||
|
||||
QmlJS::ModelManagerInterface *m_modelManager;
|
||||
QmlJSEditorFactory *m_editor;
|
||||
TextEditor::TextEditorActionHandler *m_actionHandler;
|
||||
QmlJSQuickFixAssistProvider *m_quickFixAssistProvider;
|
||||
QmlTaskManager *m_qmlTaskManager;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user