diff --git a/src/plugins/android/androidmanifesteditorfactory.cpp b/src/plugins/android/androidmanifesteditorfactory.cpp index 58cdbaaa968c04bc1a242eba8d8dec4fabe82ddf..ac2e1f5e5aba858ecd9c7be8b8ba66e0315a5241 100644 --- a/src/plugins/android/androidmanifesteditorfactory.cpp +++ b/src/plugins/android/androidmanifesteditorfactory.cpp @@ -41,12 +41,12 @@ using namespace Android::Internal; AndroidManifestEditorFactory::AndroidManifestEditorFactory(QObject *parent) - : Core::IEditorFactory(parent), - m_actionHandler(new TextEditor::TextEditorActionHandler(Constants::ANDROID_MANIFEST_EDITOR_CONTEXT)) + : Core::IEditorFactory(parent) { setId(Constants::ANDROID_MANIFEST_EDITOR_ID); setDisplayName(tr("Android Manifest editor")); addMimeType(Constants::ANDROID_MANIFEST_MIME_TYPE); + new TextEditor::TextEditorActionHandler(this, Constants::ANDROID_MANIFEST_EDITOR_CONTEXT); } Core::IEditor *AndroidManifestEditorFactory::createEditor(QWidget *parent) diff --git a/src/plugins/android/androidmanifesteditorfactory.h b/src/plugins/android/androidmanifesteditorfactory.h index 3a1fa07844e633ef764230041112bfbb251184b7..afcb8abe241f00361948acc14687387bc4821081 100644 --- a/src/plugins/android/androidmanifesteditorfactory.h +++ b/src/plugins/android/androidmanifesteditorfactory.h @@ -32,8 +32,6 @@ #include <coreplugin/editormanager/ieditorfactory.h> -namespace TextEditor { class TextEditorActionHandler; } - namespace Android { namespace Internal { @@ -45,9 +43,6 @@ public: explicit AndroidManifestEditorFactory(QObject *parent = 0); Core::IEditor *createEditor(QWidget *parent); - -private: - TextEditor::TextEditorActionHandler *m_actionHandler; }; } // namespace Internal diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp index 629518f08a257f5ac3b87c416affe23a5dec8dc7..fd16bf2d7de804e2e311bdad2507d72785595678 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp @@ -52,8 +52,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager) setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME)); addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); - m_actionHandler = - new TextEditorActionHandler(Constants::C_CMAKEEDITOR, + new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR, TextEditorActionHandler::UnCommentSelection | TextEditorActionHandler::JumpToFileUnderCursor); diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h index aafa5a4875f540c2d4e98076036362503fe2e267..7356b445fec1f03663d716c2936f049fd712eb2e 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h +++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h @@ -34,8 +34,6 @@ #include <coreplugin/editormanager/ieditorfactory.h> -namespace TextEditor { class TextEditorActionHandler; } - namespace CMakeProjectManager { namespace Internal { @@ -50,7 +48,6 @@ public: private: const QStringList m_mimeTypes; CMakeManager *m_manager; - TextEditor::TextEditorActionHandler *m_actionHandler; }; } // namespace Internal diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp index 6ed4ed215a69aefb63e6d818b78f9a0d17d5f27a..e4eadfb98e11408951172160abfe9a110b9c0531 100644 --- a/src/plugins/cppeditor/cppeditorplugin.cpp +++ b/src/plugins/cppeditor/cppeditorplugin.cpp @@ -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); diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h index f321274cd00245b793ba5fb5cc7e6a0fc52cc0a0..9bf3e13d106219418bf122fdc38f39157ed6a71b 100644 --- a/src/plugins/cppeditor/cppeditorplugin.h +++ b/src/plugins/cppeditor/cppeditorplugin.h @@ -38,7 +38,6 @@ #include <QAction> namespace TextEditor { -class TextEditorActionHandler; class ITextEditor; } // namespace TextEditor @@ -234,7 +233,6 @@ private: static CppEditorPlugin *m_instance; - TextEditor::TextEditorActionHandler *m_actionHandler; bool m_sortedOutline; QAction *m_renameSymbolUnderCursorAction; QAction *m_findUsagesAction; diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp index 61470effc4807dcaa8511004a8547fc9f1cd20fb..531cd516a517522bbfeb1fd92daa17b3a130e1bd 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp @@ -58,6 +58,8 @@ ProjectFilesFactory::ProjectFilesFactory(Manager *manager) addMimeType(Constants::FILES_MIMETYPE); addMimeType(Constants::INCLUDES_MIMETYPE); addMimeType(Constants::CONFIG_MIMETYPE); + new TextEditor::TextEditorActionHandler(this, Constants::C_FILESEDITOR); + } Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent) diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp index d43c175d53bf75ec9bdf9c1afa03d6b5c8a035ab..713c9be77103d1879261bd134bca245ca6ba1160 100644 --- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp +++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp @@ -46,7 +46,6 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/selectablefilesmodel.h> -#include <texteditor/texteditoractionhandler.h> #include <QtPlugin> #include <QDebug> @@ -75,8 +74,6 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage Manager *manager = new Manager; - new TextEditor::TextEditorActionHandler(Constants::C_FILESEDITOR); // owned by ICore - m_projectFilesEditorFactory = new ProjectFilesFactory(manager); addObject(m_projectFilesEditorFactory); diff --git a/src/plugins/glsleditor/glsleditorfactory.cpp b/src/plugins/glsleditor/glsleditorfactory.cpp index 4ccceddae178989b471c26cd449db59dd711cdc0..a6bfc4e143b241e4b47a85120c618d42bbfd9995 100644 --- a/src/plugins/glsleditor/glsleditorfactory.cpp +++ b/src/plugins/glsleditor/glsleditorfactory.cpp @@ -37,6 +37,7 @@ #include <extensionsystem/pluginspec.h> #include <coreplugin/icore.h> +#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditorsettings.h> #include <QCoreApplication> @@ -55,6 +56,11 @@ GLSLEditorFactory::GLSLEditorFactory(QObject *parent) addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG); addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_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) diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp index de927d26ecad82686c12ca38fb339a73824505b0..41a3f5db2de5f83b3aaa70cfec7e193bb7a0503f 100644 --- a/src/plugins/glsleditor/glsleditorplugin.cpp +++ b/src/plugins/glsleditor/glsleditorplugin.cpp @@ -49,7 +49,6 @@ #include <extensionsystem/pluginmanager.h> #include <texteditor/texteditorconstants.h> #include <texteditor/textfilewizard.h> -#include <texteditor/texteditoractionhandler.h> #include <utils/qtcassert.h> #include <glsl/glslengine.h> @@ -76,7 +75,6 @@ class GLSLEditorPluginPrivate public: GLSLEditorPluginPrivate() : m_editor(0), - m_actionHandler(0), m_glsl_120_frag(0), m_glsl_120_vert(0), m_glsl_120_common(0), @@ -87,7 +85,6 @@ public: ~GLSLEditorPluginPrivate() { - delete m_actionHandler; delete m_glsl_120_frag; delete m_glsl_120_vert; delete m_glsl_120_common; @@ -97,7 +94,6 @@ public: } GLSLEditorFactory *m_editor; - TextEditor::TextEditorActionHandler *m_actionHandler; QPointer<TextEditor::ITextEditor> m_currentTextEditable; GLSLEditorPlugin::InitFile *m_glsl_120_frag; @@ -144,11 +140,6 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er 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 *glslToolsMenu = ActionManager::createMenu(Id(Constants::M_TOOLS_GLSL)); glslToolsMenu->setOnAllDisabledBehavior(ActionContainer::Hide); diff --git a/src/plugins/pythoneditor/pythoneditorfactory.cpp b/src/plugins/pythoneditor/pythoneditorfactory.cpp index e8b0d6727403bd1d7db75a1fa469bf3a112eb545..4837e0241961012b77294d6c46db31ea71519e2c 100644 --- a/src/plugins/pythoneditor/pythoneditorfactory.cpp +++ b/src/plugins/pythoneditor/pythoneditorfactory.cpp @@ -34,6 +34,7 @@ #include <coreplugin/icore.h> #include <coreplugin/editormanager/editormanager.h> +#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditorsettings.h> #include <QDebug> @@ -47,6 +48,11 @@ EditorFactory::EditorFactory(QObject *parent) setId(Constants::C_PYTHONEDITOR_ID); setDisplayName(tr(Constants::C_EDITOR_DISPLAY_NAME)); 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) diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index 873661e185ec40eadc4cff51e1b5fa005e7c87ae..97b17d06ea020e3b21b57868cb78eed0161a22a3 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -197,7 +197,6 @@ static void copyIdentifiers(const char * const words[], size_t bytesCount, QSet< PythonEditorPlugin::PythonEditorPlugin() : m_factory(0) - , m_actionHandler(0) { m_instance = this; copyIdentifiers(LIST_OF_PYTHON_KEYWORDS, sizeof(LIST_OF_PYTHON_KEYWORDS), m_keywords); @@ -222,12 +221,6 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error addObject(m_factory); // 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) const QIcon icon = QIcon::fromTheme(QLatin1String(C_PY_MIME_ICON)); if (!icon.isNull()) diff --git a/src/plugins/pythoneditor/pythoneditorplugin.h b/src/plugins/pythoneditor/pythoneditorplugin.h index 529d30202cba1ed5fb159188c1c3c768ac281623..895a94e2f5380be29fe1223907eeb939fa2d9b1b 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.h +++ b/src/plugins/pythoneditor/pythoneditorplugin.h @@ -31,9 +31,7 @@ #define PYTHONEDITOR_PLUGIN_H #include <extensionsystem/iplugin.h> -#include <texteditor/texteditoractionhandler.h> #include <QSet> -#include <QScopedPointer> namespace PythonEditor { namespace Internal { @@ -65,7 +63,6 @@ public: private: static PythonEditorPlugin *m_instance; EditorFactory *m_factory; - TextEditor::TextEditorActionHandler *m_actionHandler; QSet<QString> m_keywords; QSet<QString> m_magics; QSet<QString> m_builtins; diff --git a/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp b/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp index b3ea76a576b8ad1e1e13e0ff1d0ddfa87c880c6e..13860e4519fcac537b7ff581cfa4f572b428e334 100644 --- a/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp @@ -35,6 +35,7 @@ #include <qtsupport/qtsupportconstants.h> #include <coreplugin/fileiconprovider.h> +#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditorsettings.h> #include <QCoreApplication> @@ -42,15 +43,17 @@ using namespace QmakeProjectManager; using namespace QmakeProjectManager::Internal; -ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager, TextEditor::TextEditorActionHandler *handler) : - m_manager(manager), - m_actionHandler(handler) +ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager) : + m_manager(manager) { setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID); setDisplayName(qApp->translate("OpenWith::Editors", QmakeProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME)); addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE); addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_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, "pri"); diff --git a/src/plugins/qmakeprojectmanager/profileeditorfactory.h b/src/plugins/qmakeprojectmanager/profileeditorfactory.h index 07a2e5e21c1631e09f9e6f61d4dd8520297a3a21..2d7814b3eea66c06c3ab976bc94b70a3d1cd1f81 100644 --- a/src/plugins/qmakeprojectmanager/profileeditorfactory.h +++ b/src/plugins/qmakeprojectmanager/profileeditorfactory.h @@ -32,8 +32,6 @@ #include <coreplugin/editormanager/ieditorfactory.h> -namespace TextEditor { class TextEditorActionHandler; } - namespace QmakeProjectManager { class QmakeManager; @@ -45,7 +43,7 @@ class ProFileEditorFactory : public Core::IEditorFactory Q_OBJECT public: - ProFileEditorFactory(QmakeManager *parent, TextEditor::TextEditorActionHandler *handler); + ProFileEditorFactory(QmakeManager *parent); Core::IEditor *createEditor(QWidget *parent); @@ -53,7 +51,6 @@ public: private: QmakeManager *m_manager; - TextEditor::TextEditorActionHandler *m_actionHandler; }; } // namespace Internal diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index b5763e5d14bd6922ba71185956ac4f74ed9da34c..00f2ca4ba95b72ddbc7565f9e58793ecd48fe31e 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -111,12 +111,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString m_qmakeProjectManager = new QmakeManager(this); addObject(m_qmakeProjectManager); - TextEditor::TextEditorActionHandler *editorHandler - = new TextEditor::TextEditorActionHandler(Constants::C_PROFILEEDITOR, - TextEditor::TextEditorActionHandler::UnCommentSelection - | TextEditor::TextEditorActionHandler::JumpToFileUnderCursor); - - m_proFileEditorFactory = new ProFileEditorFactory(m_qmakeProjectManager, editorHandler); + m_proFileEditorFactory = new ProFileEditorFactory(m_qmakeProjectManager); ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation); diff --git a/src/plugins/qmljseditor/qmljseditorfactory.cpp b/src/plugins/qmljseditor/qmljseditorfactory.cpp index 4a2efa605381beeeecd05082ac6e77860be40ce1..90a8825bc08417fe037cb31aa0f7a0a877d6d38b 100644 --- a/src/plugins/qmljseditor/qmljseditorfactory.cpp +++ b/src/plugins/qmljseditor/qmljseditorfactory.cpp @@ -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) diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 672a9dd813a7e04b309d8e3ba6336ce84e7c35f7..f7f0ce5eeceb7b334d66776a7be5041e48c266eb 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -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)); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h index 45f224012389bf84b3fbfedf1286ae742e3b1a0e..1c3305037344deab7e5c972529a0f0b9d8faac01 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.h +++ b/src/plugins/qmljseditor/qmljseditorplugin.h @@ -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; diff --git a/src/plugins/qnx/bardescriptoreditorfactory.cpp b/src/plugins/qnx/bardescriptoreditorfactory.cpp index c89e09fcc5d83e828666001c17e38edd9fb09b34..5cba705085634d8c83c4a0c1e7864f472f2d7ff4 100644 --- a/src/plugins/qnx/bardescriptoreditorfactory.cpp +++ b/src/plugins/qnx/bardescriptoreditorfactory.cpp @@ -44,8 +44,8 @@ using namespace Qnx::Internal; class BarDescriptorActionHandler : public TextEditor::TextEditorActionHandler { public: - BarDescriptorActionHandler() - : TextEditor::TextEditorActionHandler(Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT) + BarDescriptorActionHandler(QObject *parent) + : TextEditor::TextEditorActionHandler(parent, Constants::QNX_BAR_DESCRIPTOR_EDITOR_CONTEXT) { } protected: @@ -58,16 +58,11 @@ protected: BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent) : Core::IEditorFactory(parent) - , m_actionHandler(new BarDescriptorActionHandler) { setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID); setDisplayName(tr("Bar descriptor editor")); addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE); -} - -BarDescriptorEditorFactory::~BarDescriptorEditorFactory() -{ - delete m_actionHandler; + new BarDescriptorActionHandler(this); } Core::IEditor *BarDescriptorEditorFactory::createEditor(QWidget *parent) diff --git a/src/plugins/qnx/bardescriptoreditorfactory.h b/src/plugins/qnx/bardescriptoreditorfactory.h index ed5a012d6a31cd6503cf8fc502ec0884f098f1b5..fac30e792089a09f625e179a73712c103a39386c 100644 --- a/src/plugins/qnx/bardescriptoreditorfactory.h +++ b/src/plugins/qnx/bardescriptoreditorfactory.h @@ -34,10 +34,6 @@ #include <coreplugin/editormanager/ieditorfactory.h> -namespace TextEditor { -class TextEditorActionHandler; -} - namespace Qnx { namespace Internal { @@ -47,12 +43,8 @@ class BarDescriptorEditorFactory : public Core::IEditorFactory public: explicit BarDescriptorEditorFactory(QObject *parent = 0); - ~BarDescriptorEditorFactory(); Core::IEditor *createEditor(QWidget *parent); - -private: - TextEditor::TextEditorActionHandler *m_actionHandler; }; } // namespace Internal diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index 0ea3d5fdf68b79a5d7306332eca201c04e45b156..54ccd52a2b82e69629ec87d5c0cae1709a9fb159 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -49,7 +49,6 @@ namespace TextEditor { class BaseTextDocument; -class TextEditorActionHandler; class CodeAssistant; namespace Internal { diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp index af85d21ac5eeafaa3cdb1f6f21790620ef2e8fb5..2efee71e0a8810b49307232c0de04c3548220d18 100644 --- a/src/plugins/texteditor/plaintexteditorfactory.cpp +++ b/src/plugins/texteditor/plaintexteditorfactory.cpp @@ -51,18 +51,13 @@ PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent) setDisplayName(qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME)); addMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT)); - m_actionHandler = new TextEditorActionHandler( + new TextEditorActionHandler(this, TextEditor::Constants::C_TEXTEDITOR, TextEditorActionHandler::Format | TextEditorActionHandler::UnCommentSelection | TextEditorActionHandler::UnCollapseAll); } -PlainTextEditorFactory::~PlainTextEditorFactory() -{ - delete m_actionHandler; -} - Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent) { PlainTextEditorWidget *rc = new PlainTextEditorWidget(parent); diff --git a/src/plugins/texteditor/plaintexteditorfactory.h b/src/plugins/texteditor/plaintexteditorfactory.h index facf43fa9b7c9ed3bbfb6005f2f5a64fc3a5e336..b60a1d1fcac861334e0f5697362773529293e553 100644 --- a/src/plugins/texteditor/plaintexteditorfactory.h +++ b/src/plugins/texteditor/plaintexteditorfactory.h @@ -35,7 +35,6 @@ #include <QStringList> namespace TextEditor { -class TextEditorActionHandler; namespace Internal { class PlainTextEditorFactory : public Core::IEditorFactory @@ -44,17 +43,12 @@ class PlainTextEditorFactory : public Core::IEditorFactory public: PlainTextEditorFactory(QObject *parent = 0); - ~PlainTextEditorFactory(); using Core::IEditorFactory::addMimeType; Core::IEditor *createEditor(QWidget *parent); - TextEditor::TextEditorActionHandler *actionHandler() const { return m_actionHandler; } private slots: void updateEditorInfoBar(Core::IEditor *editor); - -private: - TextEditor::TextEditorActionHandler *m_actionHandler; }; } // namespace Internal diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index eeaf6affd92bba6be273b0c21d8271e80c22857d..64ed02eaf5535a72b3b1be899de50a8f8f7e739c 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -49,8 +49,9 @@ using namespace TextEditor; using namespace TextEditor::Internal; -TextEditorActionHandler::TextEditorActionHandler(Core::Id contextId, uint optionalActions) - : QObject(Core::ICore::instance()), +TextEditorActionHandler::TextEditorActionHandler(QObject *parent, Core::Id contextId, + uint optionalActions) + : QObject(parent), m_undoAction(0), m_redoAction(0), m_copyAction(0), diff --git a/src/plugins/texteditor/texteditoractionhandler.h b/src/plugins/texteditor/texteditoractionhandler.h index eaea4735cfb4b2bfd141d4d519dac8f02190a5c4..bee5dc293b59fc0e240495f584d3564ab4a4f663 100644 --- a/src/plugins/texteditor/texteditoractionhandler.h +++ b/src/plugins/texteditor/texteditoractionhandler.h @@ -65,7 +65,7 @@ public: JumpToFileUnderCursor = 16 }; - explicit TextEditorActionHandler(Core::Id contextId, uint optionalActions = None); + explicit TextEditorActionHandler(QObject *parent, Core::Id contextId, uint optionalActions = None); ~TextEditorActionHandler(); protected: diff --git a/src/plugins/vcsbase/basevcseditorfactory.cpp b/src/plugins/vcsbase/basevcseditorfactory.cpp index 85512b08fbbd12a762f8d47a6f31cc4aac3903cd..bbd641a09604efa274691c1645369e1a33c28606 100644 --- a/src/plugins/vcsbase/basevcseditorfactory.cpp +++ b/src/plugins/vcsbase/basevcseditorfactory.cpp @@ -54,12 +54,10 @@ public: BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t); const VcsBaseEditorParameters *m_type; - TextEditor::TextEditorActionHandler *m_editorHandler; }; BaseVcsEditorFactoryPrivate::BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t) : - m_type(t), - m_editorHandler(new TextEditor::TextEditorActionHandler(t->context)) + m_type(t) { } @@ -71,6 +69,7 @@ BaseVcsEditorFactory::BaseVcsEditorFactory(const VcsBaseEditorParameters *t) setId(t->id); setDisplayName(QCoreApplication::translate("VCS", t->displayName)); addMimeType(t->mimeType); + new TextEditor::TextEditorActionHandler(this, t->context); } BaseVcsEditorFactory::~BaseVcsEditorFactory()