Commit d80fb696 authored by Eike Ziller's avatar Eike Ziller

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: default avatarDavid Schulz <david.schulz@digia.com>
parent 3d1b70c5
...@@ -41,12 +41,12 @@ using namespace Android::Internal; ...@@ -41,12 +41,12 @@ using namespace Android::Internal;
AndroidManifestEditorFactory::AndroidManifestEditorFactory(QObject *parent) AndroidManifestEditorFactory::AndroidManifestEditorFactory(QObject *parent)
: Core::IEditorFactory(parent), : Core::IEditorFactory(parent)
m_actionHandler(new TextEditor::TextEditorActionHandler(Constants::ANDROID_MANIFEST_EDITOR_CONTEXT))
{ {
setId(Constants::ANDROID_MANIFEST_EDITOR_ID); setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
setDisplayName(tr("Android Manifest editor")); setDisplayName(tr("Android Manifest editor"));
addMimeType(Constants::ANDROID_MANIFEST_MIME_TYPE); addMimeType(Constants::ANDROID_MANIFEST_MIME_TYPE);
new TextEditor::TextEditorActionHandler(this, Constants::ANDROID_MANIFEST_EDITOR_CONTEXT);
} }
Core::IEditor *AndroidManifestEditorFactory::createEditor(QWidget *parent) Core::IEditor *AndroidManifestEditorFactory::createEditor(QWidget *parent)
......
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditorfactory.h>
namespace TextEditor { class TextEditorActionHandler; }
namespace Android { namespace Android {
namespace Internal { namespace Internal {
...@@ -45,9 +43,6 @@ public: ...@@ -45,9 +43,6 @@ public:
explicit AndroidManifestEditorFactory(QObject *parent = 0); explicit AndroidManifestEditorFactory(QObject *parent = 0);
Core::IEditor *createEditor(QWidget *parent); Core::IEditor *createEditor(QWidget *parent);
private:
TextEditor::TextEditorActionHandler *m_actionHandler;
}; };
} // namespace Internal } // namespace Internal
......
...@@ -52,8 +52,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager) ...@@ -52,8 +52,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME)); setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME));
addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
m_actionHandler = new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR,
new TextEditorActionHandler(Constants::C_CMAKEEDITOR,
TextEditorActionHandler::UnCommentSelection TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::JumpToFileUnderCursor); | TextEditorActionHandler::JumpToFileUnderCursor);
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditorfactory.h>
namespace TextEditor { class TextEditorActionHandler; }
namespace CMakeProjectManager { namespace CMakeProjectManager {
namespace Internal { namespace Internal {
...@@ -50,7 +48,6 @@ public: ...@@ -50,7 +48,6 @@ public:
private: private:
const QStringList m_mimeTypes; const QStringList m_mimeTypes;
CMakeManager *m_manager; CMakeManager *m_manager;
TextEditor::TextEditorActionHandler *m_actionHandler;
}; };
} // namespace Internal } // namespace Internal
......
...@@ -80,6 +80,12 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) : ...@@ -80,6 +80,12 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE); addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
addMimeType(CppEditor::Constants::CPP_HEADER_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()) { if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_cpp.png", CppEditor::Constants::CPP_SOURCE_MIMETYPE); FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_cpp.png", CppEditor::Constants::CPP_SOURCE_MIMETYPE);
FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_c.png", CppEditor::Constants::C_SOURCE_MIMETYPE); FileIconProvider::registerIconOverlayForMimeType(":/cppeditor/images/qt_c.png", CppEditor::Constants::C_SOURCE_MIMETYPE);
...@@ -100,7 +106,6 @@ IEditor *CppEditorFactory::createEditor(QWidget *parent) ...@@ -100,7 +106,6 @@ IEditor *CppEditorFactory::createEditor(QWidget *parent)
CppEditorPlugin *CppEditorPlugin::m_instance = 0; CppEditorPlugin *CppEditorPlugin::m_instance = 0;
CppEditorPlugin::CppEditorPlugin() : CppEditorPlugin::CppEditorPlugin() :
m_actionHandler(0),
m_sortedOutline(false), m_sortedOutline(false),
m_renameSymbolUnderCursorAction(0), m_renameSymbolUnderCursorAction(0),
m_findUsagesAction(0), m_findUsagesAction(0),
...@@ -114,7 +119,6 @@ CppEditorPlugin::CppEditorPlugin() : ...@@ -114,7 +119,6 @@ CppEditorPlugin::CppEditorPlugin() :
CppEditorPlugin::~CppEditorPlugin() CppEditorPlugin::~CppEditorPlugin()
{ {
delete m_actionHandler;
m_instance = 0; m_instance = 0;
} }
...@@ -290,12 +294,6 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err ...@@ -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"))); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+F12") : tr("Ctrl+Shift+F12")));
connect(inspectCppCodeModel, SIGNAL(triggered()), this, SLOT(inspectCppCodeModel())); 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); contextMenu->addSeparator(context);
cmd = ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION); cmd = ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <QAction> #include <QAction>
namespace TextEditor { namespace TextEditor {
class TextEditorActionHandler;
class ITextEditor; class ITextEditor;
} // namespace TextEditor } // namespace TextEditor
...@@ -234,7 +233,6 @@ private: ...@@ -234,7 +233,6 @@ private:
static CppEditorPlugin *m_instance; static CppEditorPlugin *m_instance;
TextEditor::TextEditorActionHandler *m_actionHandler;
bool m_sortedOutline; bool m_sortedOutline;
QAction *m_renameSymbolUnderCursorAction; QAction *m_renameSymbolUnderCursorAction;
QAction *m_findUsagesAction; QAction *m_findUsagesAction;
......
...@@ -58,6 +58,8 @@ ProjectFilesFactory::ProjectFilesFactory(Manager *manager) ...@@ -58,6 +58,8 @@ ProjectFilesFactory::ProjectFilesFactory(Manager *manager)
addMimeType(Constants::FILES_MIMETYPE); addMimeType(Constants::FILES_MIMETYPE);
addMimeType(Constants::INCLUDES_MIMETYPE); addMimeType(Constants::INCLUDES_MIMETYPE);
addMimeType(Constants::CONFIG_MIMETYPE); addMimeType(Constants::CONFIG_MIMETYPE);
new TextEditor::TextEditorActionHandler(this, Constants::C_FILESEDITOR);
} }
Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent) Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent)
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/selectablefilesmodel.h> #include <projectexplorer/selectablefilesmodel.h>
#include <texteditor/texteditoractionhandler.h>
#include <QtPlugin> #include <QtPlugin>
#include <QDebug> #include <QDebug>
...@@ -75,8 +74,6 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage ...@@ -75,8 +74,6 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
Manager *manager = new Manager; Manager *manager = new Manager;
new TextEditor::TextEditorActionHandler(Constants::C_FILESEDITOR); // owned by ICore
m_projectFilesEditorFactory = new ProjectFilesFactory(manager); m_projectFilesEditorFactory = new ProjectFilesFactory(manager);
addObject(m_projectFilesEditorFactory); addObject(m_projectFilesEditorFactory);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <extensionsystem/pluginspec.h> #include <extensionsystem/pluginspec.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <QCoreApplication> #include <QCoreApplication>
...@@ -55,6 +56,11 @@ GLSLEditorFactory::GLSLEditorFactory(QObject *parent) ...@@ -55,6 +56,11 @@ GLSLEditorFactory::GLSLEditorFactory(QObject *parent)
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG); addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG);
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES); addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES);
addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES); addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES);
new TextEditor::TextEditorActionHandler(this, Constants::C_GLSLEDITOR_ID,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
} }
Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent) Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <texteditor/textfilewizard.h> #include <texteditor/textfilewizard.h>
#include <texteditor/texteditoractionhandler.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <glsl/glslengine.h> #include <glsl/glslengine.h>
...@@ -76,7 +75,6 @@ class GLSLEditorPluginPrivate ...@@ -76,7 +75,6 @@ class GLSLEditorPluginPrivate
public: public:
GLSLEditorPluginPrivate() : GLSLEditorPluginPrivate() :
m_editor(0), m_editor(0),
m_actionHandler(0),
m_glsl_120_frag(0), m_glsl_120_frag(0),
m_glsl_120_vert(0), m_glsl_120_vert(0),
m_glsl_120_common(0), m_glsl_120_common(0),
...@@ -87,7 +85,6 @@ public: ...@@ -87,7 +85,6 @@ public:
~GLSLEditorPluginPrivate() ~GLSLEditorPluginPrivate()
{ {
delete m_actionHandler;
delete m_glsl_120_frag; delete m_glsl_120_frag;
delete m_glsl_120_vert; delete m_glsl_120_vert;
delete m_glsl_120_common; delete m_glsl_120_common;
...@@ -97,7 +94,6 @@ public: ...@@ -97,7 +94,6 @@ public:
} }
GLSLEditorFactory *m_editor; GLSLEditorFactory *m_editor;
TextEditor::TextEditorActionHandler *m_actionHandler;
QPointer<TextEditor::ITextEditor> m_currentTextEditable; QPointer<TextEditor::ITextEditor> m_currentTextEditable;
GLSLEditorPlugin::InitFile *m_glsl_120_frag; GLSLEditorPlugin::InitFile *m_glsl_120_frag;
...@@ -144,11 +140,6 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er ...@@ -144,11 +140,6 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
addAutoReleasedObject(new GLSLCompletionAssistProvider); addAutoReleasedObject(new GLSLCompletionAssistProvider);
dd->m_actionHandler = new TextEditorActionHandler(Constants::C_GLSLEDITOR_ID,
TextEditorActionHandler::Format
| TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::UnCollapseAll);
ActionContainer *contextMenu = ActionManager::createMenu(GLSLEditor::Constants::M_CONTEXT); ActionContainer *contextMenu = ActionManager::createMenu(GLSLEditor::Constants::M_CONTEXT);
ActionContainer *glslToolsMenu = ActionManager::createMenu(Id(Constants::M_TOOLS_GLSL)); ActionContainer *glslToolsMenu = ActionManager::createMenu(Id(Constants::M_TOOLS_GLSL));
glslToolsMenu->setOnAllDisabledBehavior(ActionContainer::Hide); glslToolsMenu->setOnAllDisabledBehavior(ActionContainer::Hide);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <QDebug> #include <QDebug>
...@@ -47,6 +48,11 @@ EditorFactory::EditorFactory(QObject *parent) ...@@ -47,6 +48,11 @@ EditorFactory::EditorFactory(QObject *parent)
setId(Constants::C_PYTHONEDITOR_ID); setId(Constants::C_PYTHONEDITOR_ID);
setDisplayName(tr(Constants::C_EDITOR_DISPLAY_NAME)); setDisplayName(tr(Constants::C_EDITOR_DISPLAY_NAME));
addMimeType(QLatin1String(Constants::C_PY_MIMETYPE)); addMimeType(QLatin1String(Constants::C_PY_MIMETYPE));
new TextEditor::TextEditorActionHandler(this,
Constants::C_PYTHONEDITOR_ID,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
} }
Core::IEditor *EditorFactory::createEditor(QWidget *parent) Core::IEditor *EditorFactory::createEditor(QWidget *parent)
......
...@@ -197,7 +197,6 @@ static void copyIdentifiers(const char * const words[], size_t bytesCount, QSet< ...@@ -197,7 +197,6 @@ static void copyIdentifiers(const char * const words[], size_t bytesCount, QSet<
PythonEditorPlugin::PythonEditorPlugin() PythonEditorPlugin::PythonEditorPlugin()
: m_factory(0) : m_factory(0)
, m_actionHandler(0)
{ {
m_instance = this; m_instance = this;
copyIdentifiers(LIST_OF_PYTHON_KEYWORDS, sizeof(LIST_OF_PYTHON_KEYWORDS), m_keywords); copyIdentifiers(LIST_OF_PYTHON_KEYWORDS, sizeof(LIST_OF_PYTHON_KEYWORDS), m_keywords);
...@@ -222,12 +221,6 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error ...@@ -222,12 +221,6 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error
addObject(m_factory); addObject(m_factory);
// Initialize editor actions handler // Initialize editor actions handler
m_actionHandler = new TextEditor::TextEditorActionHandler(
C_PYTHONEDITOR_ID,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
// Add MIME overlay icons (these icons displayed at Project dock panel) // Add MIME overlay icons (these icons displayed at Project dock panel)
const QIcon icon = QIcon::fromTheme(QLatin1String(C_PY_MIME_ICON)); const QIcon icon = QIcon::fromTheme(QLatin1String(C_PY_MIME_ICON));
if (!icon.isNull()) if (!icon.isNull())
......
...@@ -31,9 +31,7 @@ ...@@ -31,9 +31,7 @@
#define PYTHONEDITOR_PLUGIN_H #define PYTHONEDITOR_PLUGIN_H
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <texteditor/texteditoractionhandler.h>
#include <QSet> #include <QSet>
#include <QScopedPointer>
namespace PythonEditor { namespace PythonEditor {
namespace Internal { namespace Internal {
...@@ -65,7 +63,6 @@ public: ...@@ -65,7 +63,6 @@ public:
private: private:
static PythonEditorPlugin *m_instance; static PythonEditorPlugin *m_instance;
EditorFactory *m_factory; EditorFactory *m_factory;
TextEditor::TextEditorActionHandler *m_actionHandler;
QSet<QString> m_keywords; QSet<QString> m_keywords;
QSet<QString> m_magics; QSet<QString> m_magics;
QSet<QString> m_builtins; QSet<QString> m_builtins;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <QCoreApplication> #include <QCoreApplication>
...@@ -42,15 +43,17 @@ ...@@ -42,15 +43,17 @@
using namespace QmakeProjectManager; using namespace QmakeProjectManager;
using namespace QmakeProjectManager::Internal; using namespace QmakeProjectManager::Internal;
ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager, TextEditor::TextEditorActionHandler *handler) : ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager) :
m_manager(manager), m_manager(manager)
m_actionHandler(handler)
{ {
setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID); setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID);
setDisplayName(qApp->translate("OpenWith::Editors", QmakeProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME)); setDisplayName(qApp->translate("OpenWith::Editors", QmakeProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME));
addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE); addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE); addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE); addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE);
new TextEditor::TextEditorActionHandler(this, Constants::C_PROFILEEDITOR,
TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::JumpToFileUnderCursor);
Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pro"); Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pro");
Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pri"); Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pri");
......
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditorfactory.h>
namespace TextEditor { class TextEditorActionHandler; }
namespace QmakeProjectManager { namespace QmakeProjectManager {
class QmakeManager; class QmakeManager;
...@@ -45,7 +43,7 @@ class ProFileEditorFactory : public Core::IEditorFactory ...@@ -45,7 +43,7 @@ class ProFileEditorFactory : public Core::IEditorFactory
Q_OBJECT Q_OBJECT
public: public:
ProFileEditorFactory(QmakeManager *parent, TextEditor::TextEditorActionHandler *handler); ProFileEditorFactory(QmakeManager *parent);
Core::IEditor *createEditor(QWidget *parent); Core::IEditor *createEditor(QWidget *parent);
...@@ -53,7 +51,6 @@ public: ...@@ -53,7 +51,6 @@ public:
private: private:
QmakeManager *m_manager; QmakeManager *m_manager;
TextEditor::TextEditorActionHandler *m_actionHandler;
}; };
} // namespace Internal } // namespace Internal
......
...@@ -111,12 +111,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString ...@@ -111,12 +111,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
m_qmakeProjectManager = new QmakeManager(this); m_qmakeProjectManager = new QmakeManager(this);
addObject(m_qmakeProjectManager); addObject(m_qmakeProjectManager);
TextEditor::TextEditorActionHandler *editorHandler m_proFileEditorFactory = new ProFileEditorFactory(m_qmakeProjectManager);
= new TextEditor::TextEditorActionHandler(Constants::C_PROFILEEDITOR,
TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::JumpToFileUnderCursor);
m_proFileEditorFactory = new ProFileEditorFactory(m_qmakeProjectManager, editorHandler);
ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation); ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "qmljseditorplugin.h" #include "qmljseditorplugin.h"
#include <qmljstools/qmljstoolsconstants.h> #include <qmljstools/qmljstoolsconstants.h>
#include <texteditor/texteditoractionhandler.h>
#include <QCoreApplication> #include <QCoreApplication>
...@@ -52,6 +53,12 @@ QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent) ...@@ -52,6 +53,12 @@ QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE); addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE);
addMimeType(QmlJSTools::Constants::JS_MIMETYPE); addMimeType(QmlJSTools::Constants::JS_MIMETYPE);
addMimeType(QmlJSTools::Constants::JSON_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) Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <texteditor/textfilewizard.h> #include <texteditor/textfilewizard.h>
#include <texteditor/texteditoractionhandler.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/json.h> #include <utils/json.h>
...@@ -95,7 +94,6 @@ QmlJSEditorPlugin *QmlJSEditorPlugin::m_instance = 0; ...@@ -95,7 +94,6 @@ QmlJSEditorPlugin *QmlJSEditorPlugin::m_instance = 0;
QmlJSEditorPlugin::QmlJSEditorPlugin() : QmlJSEditorPlugin::QmlJSEditorPlugin() :
m_modelManager(0), m_modelManager(0),
m_editor(0), m_editor(0),
m_actionHandler(0),
m_quickFixAssistProvider(0), m_quickFixAssistProvider(0),
m_reformatFileAction(0), m_reformatFileAction(0),
m_currentEditor(0), m_currentEditor(0),
...@@ -109,7 +107,6 @@ QmlJSEditorPlugin::QmlJSEditorPlugin() : ...@@ -109,7 +107,6 @@ QmlJSEditorPlugin::QmlJSEditorPlugin() :
QmlJSEditorPlugin::~QmlJSEditorPlugin() QmlJSEditorPlugin::~QmlJSEditorPlugin()
{ {
removeObject(m_editor); removeObject(m_editor);
delete m_actionHandler;
m_instance = 0; m_instance = 0;
} }
...@@ -165,12 +162,6 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e ...@@ -165,12 +162,6 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
wizard->setId(QLatin1String("Z.Js")); wizard->setId(QLatin1String("Z.Js"));
addAutoReleasedObject(wizard); 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 *contextMenu = Core::ActionManager::createMenu(Constants::M_CONTEXT);
Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS)); Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS));
......
...@@ -42,10 +42,6 @@ namespace Utils { ...@@ -42,10 +42,6 @@ namespace Utils {
class JsonSchemaManager; class JsonSchemaManager;
} }
namespace TextEditor {
class TextEditorActionHandler;
} // namespace TextEditor
namespace Core { namespace Core {
class Command; class Command;
class ActionContainer; class ActionContainer;
...@@ -115,7 +111,6 @@ private: ...@@ -115,7 +111,6 @@ private:
QmlJS::ModelManagerInterface *m_modelManager; QmlJS::ModelManagerInterface *m_modelManager;
QmlJSEditorFactory *m_editor; QmlJSEditorFactory *m_editor;
TextEditor::TextEditorActionHandler *m_actionHandler;
QmlJSQuickFixAssistProvider *m_quickFixAssistProvider; QmlJSQuickFixAssistProvider *m_quickFixAssistProvider;
QmlTaskManager *m_qmlTaskManager; QmlTaskManager *m_qmlTaskManager;
......
...@@ -44,8 +44,8 @@ using namespace Qnx::Internal; ...@@ -44,8 +44,8 @@ using namespace Qnx::Internal;
class BarDescriptorActionHandler : public TextEditor::TextEditorActionHandler class BarDescriptorActionHandler : public TextEditor::TextEditorActionHandler
{ {
public: public:
BarDescriptorActionHandler() BarDescriptorActionHandler(QObject *parent)
: TextEditor::TextEditorActionHandler(Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT) : TextEditor::TextEditorActionHandler(parent, Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT)
{ {
} }
protected: protected:
...@@ -58,16 +58,11 @@ protected: ...@@ -58,16 +58,11 @@ protected:
BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent) BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent)
: Core::IEditorFactory(parent) : Core::IEditorFactory(parent)
, m_actionHandler(new BarDescriptorActionHandler)
{ {
setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID); setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID);
setDisplayName(tr("Bar descriptor editor")); setDisplayName(tr("Bar descriptor editor"));
addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE); addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE);
} new BarDescriptorActionHandler(this);
BarDescriptorEditorFactory::~BarDescriptorEditorFactory()