diff options
author | Eike Ziller <eike.ziller@nokia.com> | 2012-06-05 14:22:20 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-06-05 15:19:30 +0200 |
commit | cdd44befff713e99018a92a78aea460504477dce (patch) | |
tree | 41c43f4db7a326370bc20a1c6e2707b8ccf36166 /src/plugins/qmljseditor | |
parent | d90264d6c2a7f9e53863de98145774727ea64e58 (diff) | |
download | qt-creator-cdd44befff713e99018a92a78aea460504477dce.tar.gz |
Add ActionContainer::addSeparator(...)
Gets rid of a lot of code duplication.
Change-Id: I2ce38fb38a0b61cb821e0bdc7bcc9a7ccdf9da72
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r-- | src/plugins/qmljseditor/qmljseditorconstants.h | 3 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljseditorplugin.cpp | 20 |
2 files changed, 3 insertions, 20 deletions
diff --git a/src/plugins/qmljseditor/qmljseditorconstants.h b/src/plugins/qmljseditor/qmljseditorconstants.h index 34dccae4f4..d2cb82ae61 100644 --- a/src/plugins/qmljseditor/qmljseditorconstants.h +++ b/src/plugins/qmljseditor/qmljseditorconstants.h @@ -40,9 +40,6 @@ namespace Constants { const char M_CONTEXT[] = "QML JS Editor.ContextMenu"; -const char SEPARATOR1[] = "QmlJSEditor.Separator1"; -const char SEPARATOR2[] = "QmlJSEditor.Separator2"; -const char SEPARATOR3[] = "QmlJSEditor.Separator3"; const char M_REFACTORING_MENU_INSERTION_POINT[] = "QmlJSEditor.RefactorGroup"; const char C_QMLJSEDITOR_ID[] = "QMLProjectManager.QMLJSEditor"; diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 57bcb026f1..8fbc5979c2 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -115,17 +115,6 @@ QmlJSEditorPlugin::~QmlJSEditorPlugin() m_instance = 0; } -/*! Copied from cppplugin.cpp */ -static inline -Core::Command *createSeparator(QObject *parent, - Core::Context &context, - const char *id) -{ - QAction *separator = new QAction(parent); - separator->setSeparator(true); - return Core::ActionManager::registerAction(separator, Core::Id(id), context); -} - bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/qmljseditor/QmlJSEditor.mimetypes.xml"), errorMessage)) @@ -181,7 +170,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS)); Core::Context globalContext(Core::Constants::C_GLOBAL); - qmlToolsMenu->addAction(createSeparator(this, globalContext, QmlJSEditor::Constants::SEPARATOR3)); + qmlToolsMenu->addSeparator(globalContext); Core::Command *cmd; cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); @@ -222,12 +211,9 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e qmlToolsMenu->addAction(cmd); // Insert marker for "Refactoring" menu: - Core::Command *sep = createSeparator(this, globalContext, - Constants::SEPARATOR1); + Core::Command *sep = contextMenu->addSeparator(globalContext); sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); - contextMenu->addAction(sep); - contextMenu->addAction(createSeparator(this, globalContext, - Constants::SEPARATOR2)); + contextMenu->addSeparator(globalContext); cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); |