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:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
namespace TextEditor {
|
||||
|
||||
class BaseTextDocument;
|
||||
class TextEditorActionHandler;
|
||||
class CodeAssistant;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user