Add ActionContainer::addSeparator(...)

Gets rid of a lot of code duplication.

Change-Id: I2ce38fb38a0b61cb821e0bdc7bcc9a7ccdf9da72
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Eike Ziller
2012-06-05 14:22:20 +02:00
committed by hjk
parent d90264d6c2
commit cdd44befff
34 changed files with 132 additions and 394 deletions

View File

@@ -105,17 +105,6 @@ GLSLEditorPlugin::~GLSLEditorPlugin()
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 GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"), errorMessage))
@@ -151,12 +140,9 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
// Insert marker for "Refactoring" menu:
Core::Context globalContext(Core::Constants::C_GLOBAL);
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::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd);