diff options
author | hjk <hjk@theqtcompany.com> | 2015-02-19 11:35:47 +0100 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-02-26 10:09:03 +0000 |
commit | 7f001dab1b9dd05160e78adb0554ad3478ba363c (patch) | |
tree | 6d4dcafbd9ded333eb6e971bb70af17b36f5cae2 | |
parent | 5b8046305028f936cc00aa3e4a9a31a64f6776fe (diff) | |
download | qt-creator-7f001dab1b9dd05160e78adb0554ad3478ba363c.tar.gz |
Core: Make Context parameter to registerAction optional
... and default to C_GLOBAL. A rather common case.
Similar for ActionContainer::addSeparator().
Change-Id: I7f9ba573af201c0a472132d5a494ad17cc4175b7
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
38 files changed, 169 insertions, 224 deletions
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 63be4faeff..60adec51e6 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -216,7 +216,6 @@ AnalyzerManagerPrivate::~AnalyzerManagerPrivate() void AnalyzerManagerPrivate::setupActions() { - const Context globalcontext(C_GLOBAL); Command *command = 0; // Menus @@ -235,15 +234,16 @@ void AnalyzerManagerPrivate::setupActions() m_startAction = new QAction(tr("Start"), m_menu); m_startAction->setIcon(QIcon(QLatin1String(ANALYZER_CONTROL_START_ICON))); - ActionManager::registerAction(m_startAction, "Analyzer.Start", globalcontext); + ActionManager::registerAction(m_startAction, "Analyzer.Start"); connect(m_startAction, &QAction::triggered, this, &AnalyzerManagerPrivate::startTool); m_stopAction = new QAction(tr("Stop"), m_menu); m_stopAction->setEnabled(false); m_stopAction->setIcon(QIcon(QLatin1String(ANALYZER_CONTROL_STOP_ICON))); - command = ActionManager::registerAction(m_stopAction, "Analyzer.Stop", globalcontext); + command = ActionManager::registerAction(m_stopAction, "Analyzer.Stop"); m_menu->addAction(command, G_ANALYZER_CONTROL); + const Context globalcontext(C_GLOBAL); m_menu->addSeparator(globalcontext, G_ANALYZER_TOOLS); m_menu->addSeparator(globalcontext, G_ANALYZER_REMOTE_TOOLS); m_menu->addSeparator(globalcontext, G_ANALYZER_OPTIONS); @@ -377,12 +377,10 @@ void AnalyzerManagerPrivate::activateDock(Qt::DockWidgetArea area, QDockWidget * dockWidget->setParent(m_mainWindow); m_mainWindow->addDockWidget(area, dockWidget); - Context globalContext(C_GLOBAL); - QAction *toggleViewAction = dockWidget->toggleViewAction(); toggleViewAction->setText(dockWidget->windowTitle()); Command *cmd = ActionManager::registerAction(toggleViewAction, - Id("Analyzer.").withSuffix(dockWidget->objectName()), globalContext); + Id("Analyzer.").withSuffix(dockWidget->objectName())); cmd->setAttribute(Command::CA_Hide); ActionContainer *viewsMenu = ActionManager::actionContainer(Id(M_WINDOW_VIEWS)); @@ -525,7 +523,7 @@ void AnalyzerManagerPrivate::addAction(AnalyzerAction *action) Id menuGroup = action->menuGroup(); if (menuGroup.isValid()) { - Command *command = ActionManager::registerAction(action, action->actionId(), Context(C_GLOBAL)); + Command *command = ActionManager::registerAction(action, action->actionId()); m_menu->addAction(command, menuGroup); } diff --git a/src/plugins/beautifier/artisticstyle/artisticstyle.cpp b/src/plugins/beautifier/artisticstyle/artisticstyle.cpp index af81a9726d..e6ffd8808c 100644 --- a/src/plugins/beautifier/artisticstyle/artisticstyle.cpp +++ b/src/plugins/beautifier/artisticstyle/artisticstyle.cpp @@ -79,11 +79,8 @@ bool ArtisticStyle::initialize() menu->menu()->setTitle(QLatin1String(Constants::ArtisticStyle::DISPLAY_NAME)); m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this); - Core::Command *cmd - = Core::ActionManager::registerAction(m_formatFile, - Constants::ArtisticStyle::ACTION_FORMATFILE, - Core::Context(Core::Constants::C_GLOBAL)); - menu->addAction(cmd); + menu->addAction(Core::ActionManager::registerAction(m_formatFile, + Constants::ArtisticStyle::ACTION_FORMATFILE)); connect(m_formatFile, &QAction::triggered, this, &ArtisticStyle::formatFile); Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu); diff --git a/src/plugins/beautifier/clangformat/clangformat.cpp b/src/plugins/beautifier/clangformat/clangformat.cpp index 206b49b4df..fb04d0756e 100644 --- a/src/plugins/beautifier/clangformat/clangformat.cpp +++ b/src/plugins/beautifier/clangformat/clangformat.cpp @@ -77,15 +77,13 @@ bool ClangFormat::initialize() m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this); Core::Command *cmd = Core::ActionManager::registerAction(m_formatFile, - Constants::ClangFormat::ACTION_FORMATFILE, - Core::Context(Core::Constants::C_GLOBAL)); + Constants::ClangFormat::ACTION_FORMATFILE); menu->addAction(cmd); connect(m_formatFile, &QAction::triggered, this, &ClangFormat::formatFile); m_formatRange = new QAction(BeautifierPlugin::msgFormatSelectedText(), this); cmd = Core::ActionManager::registerAction(m_formatRange, - Constants::ClangFormat::ACTION_FORMATSELECTED, - Core::Context(Core::Constants::C_GLOBAL)); + Constants::ClangFormat::ACTION_FORMATSELECTED); menu->addAction(cmd); connect(m_formatRange, &QAction::triggered, this, &ClangFormat::formatSelectedText); diff --git a/src/plugins/beautifier/uncrustify/uncrustify.cpp b/src/plugins/beautifier/uncrustify/uncrustify.cpp index 656974fbab..1e8aa673a8 100644 --- a/src/plugins/beautifier/uncrustify/uncrustify.cpp +++ b/src/plugins/beautifier/uncrustify/uncrustify.cpp @@ -80,8 +80,7 @@ bool Uncrustify::initialize() m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this); Core::Command *cmd = Core::ActionManager::registerAction(m_formatFile, - Constants::Uncrustify::ACTION_FORMATFILE, - Core::Context(Core::Constants::C_GLOBAL)); + Constants::Uncrustify::ACTION_FORMATFILE); menu->addAction(cmd); connect(m_formatFile, &QAction::triggered, this, &Uncrustify::formatFile); diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index 0ae43fcf5c..4b991f72c4 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -72,7 +72,6 @@ BookmarksPlugin::BookmarksPlugin() : bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) { Context textcontext(TextEditor::Constants::C_TEXTEDITOR); - Context globalcontext(Core::Constants::C_GLOBAL); ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS); ActionContainer *mbm = ActionManager::createMenu(Id(BOOKMARKS_MENU)); @@ -89,26 +88,26 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) //Previous m_prevAction = new QAction(tr("Previous Bookmark"), this); - cmd = ActionManager::registerAction(m_prevAction, BOOKMARKS_PREV_ACTION, globalcontext); + cmd = ActionManager::registerAction(m_prevAction, BOOKMARKS_PREV_ACTION); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+,") : tr("Ctrl+,"))); mbm->addAction(cmd); //Next m_nextAction = new QAction(tr("Next Bookmark"), this); - cmd = ActionManager::registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION, globalcontext); + cmd = ActionManager::registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+.") : tr("Ctrl+."))); mbm->addAction(cmd); - mbm->addSeparator(globalcontext); + mbm->addSeparator(); //Previous Doc m_docPrevAction = new QAction(tr("Previous Bookmark in Document"), this); - cmd = ActionManager::registerAction(m_docPrevAction, BOOKMARKS_PREVDOC_ACTION, globalcontext); + cmd = ActionManager::registerAction(m_docPrevAction, BOOKMARKS_PREVDOC_ACTION); mbm->addAction(cmd); //Next Doc m_docNextAction = new QAction(tr("Next Bookmark in Document"), this); - cmd = ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, globalcontext); + cmd = ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION); mbm->addAction(cmd); m_editBookmarkAction = new QAction(tr("Edit Bookmark"), this); diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.h b/src/plugins/coreplugin/actionmanager/actioncontainer.h index 2bfed0950a..e81cb5c748 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer.h +++ b/src/plugins/coreplugin/actionmanager/actioncontainer.h @@ -71,7 +71,7 @@ public: virtual void addAction(Command *action, Id group = Id()) = 0; virtual void addMenu(ActionContainer *menu, Id group = Id()) = 0; virtual void addMenu(ActionContainer *before, ActionContainer *menu, Id group = Id()) = 0; - virtual Command *addSeparator(const Context &context, Id group = Id(), QAction **outSeparator = 0) = 0; + virtual Command *addSeparator(const Context &context = Context(), Id group = Id(), QAction **outSeparator = 0) = 0; // This clears this menu and submenus from all actions and submenus. // It does not destroy the submenus and commands, just removes them from their parents. diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index 9648ba620e..f189e4b7c2 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -243,6 +243,8 @@ ActionContainer *ActionManager::createMenuBar(Id id) same \a id as long as the \a context is different. In this case a trigger of the actual action is forwarded to the registered QAction for the currently active context. + If the optional \a context argument is not specified, the global context + will be assumed. A scriptable action can be called from a script without the need for the user to interact with it. */ diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.h b/src/plugins/coreplugin/actionmanager/actionmanager.h index eeab8fba9b..493143cfbb 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager.h @@ -32,7 +32,8 @@ #define ACTIONMANAGER_H #include "coreplugin/core_global.h" -#include "coreplugin/id.h" +#include "coreplugin/coreconstants.h" +#include "coreplugin/icontext.h" #include <coreplugin/actionmanager/command.h> #include <QObject> @@ -62,7 +63,9 @@ public: static ActionContainer *createMenu(Id id); static ActionContainer *createMenuBar(Id id); - static Command *registerAction(QAction *action, Id id, const Context &context, bool scriptable = false); + static Command *registerAction(QAction *action, Id id, + const Context &context = Context(Constants::C_GLOBAL), + bool scriptable = false); static Command *command(Id id); static ActionContainer *actionContainer(Id id); diff --git a/src/plugins/coreplugin/externaltoolmanager.cpp b/src/plugins/coreplugin/externaltoolmanager.cpp index 9b99c1a420..72efa03bb2 100644 --- a/src/plugins/coreplugin/externaltoolmanager.cpp +++ b/src/plugins/coreplugin/externaltoolmanager.cpp @@ -244,7 +244,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<ExternalT MessageManager::write(runner->errorString()); }); - command = ActionManager::registerAction(action, externalToolsPrefix.withSuffix(toolId), Context(Constants::C_GLOBAL)); + command = ActionManager::registerAction(action, externalToolsPrefix.withSuffix(toolId)); command->setAttribute(Command::CA_UpdateText); } action->setText(tool->displayName()); diff --git a/src/plugins/coreplugin/find/findplugin.cpp b/src/plugins/coreplugin/find/findplugin.cpp index ecf97af1d8..ad601c7710 100644 --- a/src/plugins/coreplugin/find/findplugin.cpp +++ b/src/plugins/coreplugin/find/findplugin.cpp @@ -213,7 +213,7 @@ void FindPlugin::setupMenu() mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS); d->m_openFindDialog = new QAction(tr("Open Advanced Find..."), this); d->m_openFindDialog->setIconText(tr("Advanced...")); - cmd = ActionManager::registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext); + cmd = ActionManager::registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F"))); mfindadvanced->addAction(cmd); connect(d->m_openFindDialog, &QAction::triggered, @@ -225,7 +225,6 @@ void FindPlugin::setupFilterMenuItems() QList<IFindFilter*> findInterfaces = ExtensionSystem::PluginManager::getObjects<IFindFilter>(); Command *cmd; - Context globalcontext(Constants::C_GLOBAL); ActionContainer *mfindadvanced = ActionManager::actionContainer(Constants::M_FIND_ADVANCED); d->m_filterActions.clear(); @@ -238,8 +237,7 @@ void FindPlugin::setupFilterMenuItems() haveEnabledFilters = true; action->setEnabled(isEnabled); action->setData(qVariantFromValue(filter)); - cmd = ActionManager::registerAction(action, - base.withSuffix(filter->id()), globalcontext); + cmd = ActionManager::registerAction(action, base.withSuffix(filter->id())); cmd->setDefaultKeySequence(filter->defaultShortcut()); mfindadvanced->addAction(cmd); d->m_filterActions.insert(filter, action); diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp index 493aea53b4..b21d7c0518 100644 --- a/src/plugins/coreplugin/find/findtoolbar.cpp +++ b/src/plugins/coreplugin/find/findtoolbar.cpp @@ -153,7 +153,6 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen QMetaTypeId<QStringList>::qt_metatype_id(); // register actions - Context globalcontext(Constants::C_GLOBAL); Context findcontext(Constants::C_FINDTOOLBAR); ActionContainer *mfind = ActionManager::actionContainer(Constants::M_FIND); Command *cmd; @@ -168,7 +167,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace")); m_findInDocumentAction = new QAction(icon, tr("Find/Replace"), this); - cmd = ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT, globalcontext); + cmd = ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT); cmd->setDefaultKeySequence(QKeySequence::Find); mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT); connect(m_findInDocumentAction, SIGNAL(triggered()), this, SLOT(openFind())); @@ -183,7 +182,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen if (QApplication::clipboard()->supportsFindBuffer()) { m_enterFindStringAction = new QAction(tr("Enter Find String"), this); - cmd = ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext); + cmd = ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString"); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+E"))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_enterFindStringAction, &QAction::triggered, this, &FindToolBar::putSelectionToFindClipboard); @@ -191,7 +190,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen } m_findNextAction = new QAction(tr("Find Next"), this); - cmd = ActionManager::registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext); + cmd = ActionManager::registerAction(m_findNextAction, Constants::FIND_NEXT); cmd->setDefaultKeySequence(QKeySequence::FindNext); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_findNextAction, &QAction::triggered, this, &FindToolBar::invokeGlobalFindNext); @@ -202,7 +201,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_ui.findNextButton->setDefaultAction(m_localFindNextAction); m_findPreviousAction = new QAction(tr("Find Previous"), this); - cmd = ActionManager::registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext); + cmd = ActionManager::registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS); cmd->setDefaultKeySequence(QKeySequence::FindPrevious); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_findPreviousAction, &QAction::triggered, this, &FindToolBar::invokeGlobalFindPrevious); @@ -213,19 +212,19 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_ui.findPreviousButton->setDefaultAction(m_localFindPreviousAction); m_findNextSelectedAction = new QAction(tr("Find Next (Selected)"), this); - cmd = ActionManager::registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext); + cmd = ActionManager::registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F3"))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_findNextSelectedAction, &QAction::triggered, this, &FindToolBar::findNextSelected); m_findPreviousSelectedAction = new QAction(tr("Find Previous (Selected)"), this); - cmd = ActionManager::registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED, globalcontext); + cmd = ActionManager::registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F3"))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_findPreviousSelectedAction, &QAction::triggered, this, &FindToolBar::findPreviousSelected); m_replaceAction = new QAction(tr("Replace"), this); - cmd = ActionManager::registerAction(m_replaceAction, Constants::REPLACE, globalcontext); + cmd = ActionManager::registerAction(m_replaceAction, Constants::REPLACE); cmd->setDefaultKeySequence(QKeySequence()); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_replaceAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplace); @@ -236,7 +235,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_ui.replaceButton->setDefaultAction(m_localReplaceAction); m_replaceNextAction = new QAction(tr("Replace && Find"), this); - cmd = ActionManager::registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext); + cmd = ActionManager::registerAction(m_replaceNextAction, Constants::REPLACE_NEXT); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+="))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_replaceNextAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplaceNext); @@ -248,7 +247,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_ui.replaceNextButton->setDefaultAction(m_localReplaceNextAction); m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this); - cmd = ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext); + cmd = ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_replacePreviousAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplacePrevious); m_localReplacePreviousAction = new QAction(m_replacePreviousAction->text(), this); @@ -257,7 +256,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen connect(m_localReplacePreviousAction, &QAction::triggered, this, &FindToolBar::invokeReplacePrevious); m_replaceAllAction = new QAction(tr("Replace All"), this); - cmd = ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext); + cmd = ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_replaceAllAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplaceAll); m_localReplaceAllAction = new QAction(m_replaceAllAction->text(), this); @@ -270,7 +269,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_caseSensitiveAction->setIcon(QIcon(QLatin1String(":/find/images/casesensitively.png"))); m_caseSensitiveAction->setCheckable(true); m_caseSensitiveAction->setChecked(false); - cmd = ActionManager::registerAction(m_caseSensitiveAction, Constants::CASE_SENSITIVE, globalcontext); + cmd = ActionManager::registerAction(m_caseSensitiveAction, Constants::CASE_SENSITIVE); mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_caseSensitiveAction, &QAction::toggled, this, &FindToolBar::setCaseSensitive); @@ -278,7 +277,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_wholeWordAction->setIcon(QIcon(QLatin1String(":/find/images/wholewords.png"))); m_wholeWordAction->setCheckable(true); m_wholeWordAction->setChecked(false); - cmd = ActionManager::registerAction(m_wholeWordAction, Constants::WHOLE_WORDS, globalcontext); + cmd = ActionManager::registerAction(m_wholeWordAction, Constants::WHOLE_WORDS); mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_wholeWordAction, &QAction::toggled, this, &FindToolBar::setWholeWord); @@ -286,7 +285,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_regularExpressionAction->setIcon(QIcon(QLatin1String(":/find/images/regexp.png"))); m_regularExpressionAction->setCheckable(true); m_regularExpressionAction->setChecked(false); - cmd = ActionManager::registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext); + cmd = ActionManager::registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS); mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_regularExpressionAction, &QAction::toggled, this, &FindToolBar::setRegularExpressions); @@ -294,7 +293,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_preserveCaseAction->setIcon(QPixmap(QLatin1String(":/find/images/preservecase.png"))); m_preserveCaseAction->setCheckable(true); m_preserveCaseAction->setChecked(false); - cmd = ActionManager::registerAction(m_preserveCaseAction, Constants::PRESERVE_CASE, globalcontext); + cmd = ActionManager::registerAction(m_preserveCaseAction, Constants::PRESERVE_CASE); mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_preserveCaseAction, &QAction::toggled, this, &FindToolBar::setPreserveCase); diff --git a/src/plugins/coreplugin/find/searchresultwindow.cpp b/src/plugins/coreplugin/find/searchresultwindow.cpp index 006b39d037..f440c726eb 100644 --- a/src/plugins/coreplugin/find/searchresultwindow.cpp +++ b/src/plugins/coreplugin/find/searchresultwindow.cpp @@ -313,9 +313,7 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel) d->m_expandCollapseAction = new QAction(tr("Expand All"), this); d->m_expandCollapseAction->setCheckable(true); d->m_expandCollapseAction->setIcon(QIcon(QLatin1String(":/find/images/expand.png"))); - Command *cmd = ActionManager::registerAction( - d->m_expandCollapseAction, "Find.ExpandAll", - Context(Constants::C_GLOBAL)); + Command *cmd = ActionManager::registerAction( d->m_expandCollapseAction, "Find.ExpandAll"); cmd->setAttribute(Command::CA_UpdateText); d->m_expandCollapseButton->setDefaultAction(cmd->action()); diff --git a/src/plugins/coreplugin/locator/locator.cpp b/src/plugins/coreplugin/locator/locator.cpp index f0b60c6ef6..6e80703cd1 100644 --- a/src/plugins/coreplugin/locator/locator.cpp +++ b/src/plugins/coreplugin/locator/locator.cpp @@ -98,8 +98,7 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) m_corePlugin->addAutoReleasedObject(view); QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); - Command *cmd = ActionManager::registerAction(action, Constants::LOCATE, - Context(Constants::C_GLOBAL)); + Command *cmd = ActionManager::registerAction(action, Constants::LOCATE); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); connect(action, &QAction::triggered, this, &Locator::openLocator); connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText())); diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index f05f079770..5c38f647c8 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -327,8 +327,7 @@ void LocatorWidget::updateFilterList() if (!actionCopy.contains(filterId)) { // register new action action = new QAction(filter->displayName(), this); - cmd = ActionManager::registerAction(action, locatorId, - Context(Constants::C_GLOBAL)); + cmd = ActionManager::registerAction(action, locatorId); cmd->setAttribute(Command::CA_UpdateText); connect(action, SIGNAL(triggered()), this, SLOT(filterSelected())); action->setData(qVariantFromValue(filter)); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index dd04c34010..f8449998ed 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -484,14 +484,14 @@ void MainWindow::registerDefaultActions() // Return to editor shortcut: Note this requires Qt to fix up // handling of shortcut overrides in menus, item views, combos.... m_focusToEditor = new QAction(tr("Return to Editor"), this); - Command *cmd = ActionManager::registerAction(m_focusToEditor, Constants::S_RETURNTOEDITOR, globalContext); + Command *cmd = ActionManager::registerAction(m_focusToEditor, Constants::S_RETURNTOEDITOR); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_Escape)); connect(m_focusToEditor, SIGNAL(triggered()), this, SLOT(setFocusToEditor())); // New File Action QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(Constants::ICON_NEWFILE))); m_newAction = new QAction(icon, tr("&New File or Project..."), this); - cmd = ActionManager::registerAction(m_newAction, Constants::NEW, globalContext); + cmd = ActionManager::registerAction(m_newAction, Constants::NEW); cmd->setDefaultKeySequence(QKeySequence::New); mfile->addAction(cmd, Constants::G_FILE_NEW); connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile())); @@ -499,14 +499,14 @@ void MainWindow::registerDefaultActions() // Open Action icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(QLatin1String(Constants::ICON_OPENFILE))); m_openAction = new QAction(icon, tr("&Open File or Project..."), this); - cmd = ActionManager::registerAction(m_openAction, Constants::OPEN, globalContext); + cmd = ActionManager::registerAction(m_openAction, Constants::OPEN); cmd->setDefaultKeySequence(QKeySequence::Open); mfile->addAction(cmd, Constants::G_FILE_OPEN); connect(m_openAction, SIGNAL(triggered()), this, SLOT(openFile())); // Open With Action m_openWithAction = new QAction(tr("Open File &With..."), this); - cmd = ActionManager::registerAction(m_openWithAction, Constants::OPEN_WITH, globalContext); + cmd = ActionManager::registerAction(m_openWithAction, Constants::OPEN_WITH); mfile->addAction(cmd, Constants::G_FILE_OPEN); connect(m_openWithAction, SIGNAL(triggered()), this, SLOT(openFileWith())); @@ -520,7 +520,7 @@ void MainWindow::registerDefaultActions() icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(QLatin1String(Constants::ICON_SAVEFILE))); QAction *tmpaction = new QAction(icon, tr("&Save"), this); tmpaction->setEnabled(false); - cmd = ActionManager::registerAction(tmpaction, Constants::SAVE, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::SAVE); cmd->setDefaultKeySequence(QKeySequence::Save); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Save")); @@ -530,7 +530,7 @@ void MainWindow::registerDefaultActions() icon = QIcon::fromTheme(QLatin1String("document-save-as")); tmpaction = new QAction(icon, tr("Save &As..."), this); tmpaction->setEnabled(false); - cmd = ActionManager::registerAction(tmpaction, Constants::SAVEAS, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::SAVEAS); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+S") : QString())); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Save As...")); @@ -538,7 +538,7 @@ void MainWindow::registerDefaultActions() // SaveAll Action m_saveAllAction = new QAction(tr("Save A&ll"), this); - cmd = ActionManager::registerAction(m_saveAllAction, Constants::SAVEALL, globalContext); + cmd = ActionManager::registerAction(m_saveAllAction, Constants::SAVEALL); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("Ctrl+Shift+S"))); mfile->addAction(cmd, Constants::G_FILE_SAVE); connect(m_saveAllAction, SIGNAL(triggered()), this, SLOT(saveAll())); @@ -547,7 +547,7 @@ void MainWindow::registerDefaultActions() icon = QIcon::fromTheme(QLatin1String("document-print")); tmpaction = new QAction(icon, tr("&Print..."), this); tmpaction->setEnabled(false); - cmd = ActionManager::registerAction(tmpaction, Constants::PRINT, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::PRINT); cmd->setDefaultKeySequence(QKeySequence::Print); mfile->addAction(cmd, Constants::G_FILE_PRINT); @@ -555,7 +555,7 @@ void MainWindow::registerDefaultActions() icon = QIcon::fromTheme(QLatin1String("application-exit")); m_exitAction = new QAction(icon, tr("E&xit"), this); m_exitAction->setMenuRole(QAction::QuitRole); - cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT, globalContext); + cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q"))); mfile->addAction(cmd, Constants::G_FILE_OTHER); connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit())); @@ -563,7 +563,7 @@ void MainWindow::registerDefaultActions() // Undo Action icon = QIcon::fromTheme(QLatin1String("edit-undo"), QIcon(QLatin1String(Constants::ICON_UNDO))); tmpaction = new QAction(icon, tr("&Undo"), this); - cmd = ActionManager::registerAction(tmpaction, Constants::UNDO, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::UNDO); cmd->setDefaultKeySequence(QKeySequence::Undo); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Undo")); @@ -573,7 +573,7 @@ void MainWindow::registerDefaultActions() // Redo Action icon = QIcon::fromTheme(QLatin1String("edit-redo"), QIcon(QLatin1String(Constants::ICON_REDO))); tmpaction = new QAction(icon, tr("&Redo"), this); - cmd = ActionManager::registerAction(tmpaction, Constants::REDO, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::REDO); cmd->setDefaultKeySequence(QKeySequence::Redo); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Redo")); @@ -583,7 +583,7 @@ void MainWindow::registerDefaultActions() // Cut Action icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT))); tmpaction = new QAction(icon, tr("Cu&t"), this); - cmd = ActionManager::registerAction(tmpaction, Constants::CUT, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::CUT); cmd->setDefaultKeySequence(QKeySequence::Cut); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); tmpaction->setEnabled(false); @@ -591,7 +591,7 @@ void MainWindow::registerDefaultActions() // Copy Action icon = QIcon::fromTheme(QLatin1String("edit-copy"), QIcon(QLatin1String(Constants::ICON_COPY))); tmpaction = new QAction(icon, tr("&Copy"), this); - cmd = ActionManager::registerAction(tmpaction, Constants::COPY, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::COPY); cmd->setDefaultKeySequence(QKeySequence::Copy); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); tmpaction->setEnabled(false); @@ -599,7 +599,7 @@ void MainWindow::registerDefaultActions() // Paste Action icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(QLatin1String(Constants::ICON_PASTE))); tmpaction = new QAction(icon, tr("&Paste"), this); - cmd = ActionManager::registerAction(tmpaction, Constants::PASTE, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::PASTE); cmd->setDefaultKeySequence(QKeySequence::Paste); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); tmpaction->setEnabled(false); @@ -607,7 +607,7 @@ void MainWindow::registerDefaultActions() // Select All icon = QIcon::fromTheme(QLatin1String("edit-select-all")); tmpaction = new QAction(icon, tr("Select &All"), this); - cmd = ActionManager::registerAction(tmpaction, Constants::SELECTALL, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::SELECTALL); cmd->setDefaultKeySequence(QKeySequence::SelectAll); medit->addAction(cmd, Constants::G_EDIT_SELECTALL); tmpaction->setEnabled(false); @@ -615,7 +615,7 @@ void MainWindow::registerDefaultActions() // Goto Action icon = QIcon::fromTheme(QLatin1String("go-jump")); tmpaction = new QAction(icon, tr("&Go to Line..."), this); - cmd = ActionManager::registerAction(tmpaction, Constants::GOTO, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::GOTO); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L"))); medit->addAction(cmd, Constants::G_EDIT_OTHER); tmpaction->setEnabled(false); @@ -626,7 +626,7 @@ void MainWindow::registerDefaultActions() m_optionsAction = new QAction(tr("&Options..."), this); m_optionsAction->setMenuRole(QAction::PreferencesRole); - cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS, globalContext); + cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS); cmd->setDefaultKeySequence(QKeySequence::Preferences); mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS); connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog())); @@ -637,14 +637,14 @@ void MainWindow::registerDefaultActions() // Minimize Action QAction *minimizeAction = new QAction(tr("Minimize"), this); minimizeAction->setEnabled(false); // actual implementation in WindowSupport - cmd = ActionManager::registerAction(minimizeAction, Constants::MINIMIZE_WINDOW, globalContext); + cmd = ActionManager::registerAction(minimizeAction, Constants::MINIMIZE_WINDOW); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M"))); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); // Zoom Action QAction *zoomAction = new QAction(tr("Zoom"), this); zoomAction->setEnabled(false); // actual implementation in WindowSupport - cmd = ActionManager::registerAction(zoomAction, Constants::ZOOM_WINDOW, globalContext); + cmd = ActionManager::registerAction(zoomAction, Constants::ZOOM_WINDOW); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); } @@ -652,7 +652,7 @@ void MainWindow::registerDefaultActions() QAction *toggleFullScreenAction = new QAction(tr("Full Screen"), this); toggleFullScreenAction->setCheckable(!HostOsInfo::isMacHost()); toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport - cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext); + cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11"))); if (HostOsInfo::isMacHost()) cmd->setAttribute(Command::CA_UpdateText); @@ -663,7 +663,7 @@ void MainWindow::registerDefaultActions() QAction *closeAction = new QAction(tr("Close Window"), this); closeAction->setEnabled(false); - cmd = ActionManager::registerAction(closeAction, Constants::CLOSE_WINDOW, globalContext); + cmd = ActionManager::registerAction(closeAction, Constants::CLOSE_WINDOW); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Meta+W"))); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); @@ -674,7 +674,7 @@ void MainWindow::registerDefaultActions() m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)), tr(Constants::TR_SHOW_SIDEBAR), this); m_toggleSideBarAction->setCheckable(true); - cmd = ActionManager::registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext); + cmd = ActionManager::registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR); cmd->setAttribute(Command::CA_UpdateText); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+0") : tr("Alt+0"))); connect(m_toggleSideBarAction, &QAction::triggered, this, &MainWindow::setSidebarVisible); @@ -685,7 +685,7 @@ void MainWindow::registerDefaultActions() // Show Mode Selector Action m_toggleModeSelectorAction = new QAction(tr("Show Mode Selector"), this); m_toggleModeSelectorAction->setCheckable(true); - cmd = ActionManager::registerAction(m_toggleModeSelectorAction, Constants::TOGGLE_MODE_SELECTOR, globalContext); + cmd = ActionManager::registerAction(m_toggleModeSelectorAction, Constants::TOGGLE_MODE_SELECTOR); connect(m_toggleModeSelectorAction, &QAction::triggered, ModeManager::instance(), &ModeManager::setModeSelectorVisible); mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS); @@ -706,7 +706,7 @@ void MainWindow::registerDefaultActions() else tmpaction = new QAction(icon, tr("About &Qt Creator..."), this); tmpaction->setMenuRole(QAction::AboutRole); - cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_QTCREATOR, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_QTCREATOR); mhelp->addAction(cmd, Constants::G_HELP_ABOUT); tmpaction->setEnabled(true); connect(tmpaction, &QAction::triggered, this, &MainWindow::aboutQtCreator); @@ -714,13 +714,13 @@ void MainWindow::registerDefaultActions() //About Plugins Action tmpaction = new QAction(tr("About &Plugins..."), this); tmpaction->setMenuRole(QAction::ApplicationSpecificRole); - cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_PLUGINS, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_PLUGINS); mhelp->addAction(cmd, Constants::G_HELP_ABOUT); tmpaction->setEnabled(true); connect(tmpaction, &QAction::triggered, this, &MainWindow::aboutPlugins); // About Qt Action // tmpaction = new QAction(tr("About &Qt..."), this); -// cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT, globalContext); +// cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT); // mhelp->addAction(cmd, Constants::G_HELP_ABOUT); // tmpaction->setEnabled(true); // connect(tmpaction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); @@ -728,7 +728,7 @@ void MainWindow::registerDefaultActions() if (!HostOsInfo::isMacHost()) { // doesn't have the "About" actions in the Help menu tmpaction = new QAction(this); tmpaction->setSeparator(true); - cmd = ActionManager::registerAction(tmpaction, "QtCreator.Help.Sep.About", globalContext); + cmd = ActionManager::registerAction(tmpaction, "QtCreator.Help.Sep.About"); mhelp->addAction(cmd, Constants::G_HELP_ABOUT); } } diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 0b21a24ac7..800d125d21 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -180,7 +180,7 @@ void ModeManager::objectAdded(QObject *obj) // Register mode shortcut const Id actionId = mode->id().withPrefix("QtCreator.Mode."); QAction *action = new QAction(tr("Switch to <b>%1</b> mode").arg(mode->displayName()), this); - Command *cmd = ActionManager::registerAction(action, actionId, Context(Constants::C_GLOBAL)); + Command *cmd = ActionManager::registerAction(action, actionId); d->m_modeCommands.insert(index, cmd); connect(cmd, SIGNAL(keySequenceChanged()), m_instance, SLOT(updateModeToolTip())); diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index e95ded4b2a..1a7a7dc580 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -203,7 +203,6 @@ static inline int paneShortCut(int number) void OutputPaneManager::init() { ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); - const Context globalContext(Constants::C_GLOBAL); // Window->Output Panes ActionContainer *mpanes = ActionManager::createMenu(Constants::M_WINDOW_PANES); @@ -214,21 +213,21 @@ void OutputPaneManager::init() Command *cmd; - cmd = ActionManager::registerAction(m_clearAction, "Coreplugin.OutputPane.clear", globalContext); + cmd = ActionManager::registerAction(m_clearAction, "Coreplugin.OutputPane.clear"); m_clearButton->setDefaultAction(cmd->action()); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); - cmd = ActionManager::registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalContext); + cmd = ActionManager::registerAction(m_prevAction, "Coreplugin.OutputPane.previtem"); cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6"))); m_prevToolButton->setDefaultAction(cmd->action()); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); - cmd = ActionManager::registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalContext); + cmd = ActionManager::registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem"); m_nextToolButton->setDefaultAction(cmd->action()); cmd->setDefaultKeySequence(QKeySequence(tr("F6"))); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); - cmd = ActionManager::registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalContext); + cmd = ActionManager::registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax"); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+9") : tr("Alt+9"))); cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateIcon); @@ -236,7 +235,7 @@ void OutputPaneManager::init() connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax())); m_minMaxButton->setDefaultAction(cmd->action()); - mpanes->addSeparator(globalContext, "Coreplugin.OutputPane.ActionsGroup"); + mpanes->addSeparator(Context(Constants::C_GLOBAL), "Coreplugin.OutputPane.ActionsGroup"); QFontMetrics titleFm = m_titleLabel->fontMetrics(); int minTitleWidth = 0; @@ -278,7 +277,7 @@ void OutputPaneManager::init() suffix.remove(QLatin1Char(' ')); const Id id = baseId.withSuffix(suffix); QAction *action = new QAction(outPane->displayName(), this); - Command *cmd = ActionManager::registerAction(action, id, globalContext); + Command *cmd = ActionManager::registerAction(action, id); mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup"); m_actions.append(action); diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 50cf7bc6ab..dcfd838bcc 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -341,8 +341,7 @@ void ProgressManagerPrivate::init() p.fill(Qt::transparent); toggleProgressView->setIcon(QIcon(p)); Command *cmd = ActionManager::registerAction(toggleProgressView, - "QtCreator.ToggleProgressDetails", - Context(Constants::C_GLOBAL)); + "QtCreator.ToggleProgressDetails"); cmd->setDefaultKeySequence(QKeySequence(HostOsInfo::isMacHost() ? tr("Ctrl+Shift+0") : tr("Alt+Shift+0"))); diff --git a/src/plugins/coreplugin/windowsupport.cpp b/src/plugins/coreplugin/windowsupport.cpp index ae229fef26..742472e8f7 100644 --- a/src/plugins/coreplugin/windowsupport.cpp +++ b/src/plugins/coreplugin/windowsupport.cpp @@ -166,8 +166,7 @@ void WindowList::addWindow(QWidget *window) QObject::connect(action, &QAction::triggered, [action]() { WindowList::activateWindow(action); }); action->setCheckable(true); action->setChecked(false); - Command *cmd = ActionManager::registerAction(action, id, - Context(Constants::C_GLOBAL)); + Command *cmd = ActionManager::registerAction(action, id); cmd->setAttribute(Command::CA_UpdateText); ActionManager::actionContainer(Constants::M_WINDOW)->addAction(cmd, Constants::G_WINDOW_LIST); action->setVisible(window->isVisible() || window->isMinimized()); // minimized windows are hidden but should be shown diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index 5e3caad193..f3904750c6 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -121,9 +121,6 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe Q_UNUSED(arguments) Q_UNUSED(errorMessage) - // Create the globalcontext list to register actions accordingly - Context globalcontext(Core::Constants::C_GLOBAL); - // Create the settings Page m_settings->fromSettings(ICore::settings()); SettingsPage *settingsPage = new SettingsPage(m_settings); @@ -162,19 +159,19 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe Command *command; m_postEditorAction = new QAction(tr("Paste Snippet..."), this); - command = ActionManager::registerAction(m_postEditorAction, "CodePaster.Post", globalcontext); + command = ActionManager::registerAction(m_postEditorAction, "CodePaster.Post"); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+P") : tr("Alt+C,Alt+P"))); connect(m_postEditorAction, &QAction::triggered, this, &CodepasterPlugin::pasteSnippet); cpContainer->addAction(command); m_fetchAction = new QAction(tr("Fetch Snippet..."), this); - command = ActionManager::registerAction(m_fetchAction, "CodePaster.Fetch", globalcontext); + command = ActionManager::registerAction(m_fetchAction, "CodePaster.Fetch"); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+F") : tr("Alt+C,Alt+F"))); connect(m_fetchAction, &QAction::triggered, this, &CodepasterPlugin::fetch); cpContainer->addAction(command); m_fetchUrlAction = new QAction(tr("Fetch from URL..."), this); - command = ActionManager::registerAction(m_fetchUrlAction, "CodePaster.FetchUrl", globalcontext); + command = ActionManager::registerAction(m_fetchUrlAction, "CodePaster.FetchUrl"); connect(m_fetchUrlAction, &QAction::triggered, this, &CodepasterPlugin::fetchUrl); cpContainer->addAction(command); diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp index f8874787cf..b4d99499c9 100644 --- a/src/plugins/cppeditor/cppeditorplugin.cpp +++ b/src/plugins/cppeditor/cppeditorplugin.cpp @@ -232,10 +232,9 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err cppToolsMenu->addAction(cmd); // Refactoring sub-menu - Context globalContext(Core::Constants::C_GLOBAL); - Command *sep = contextMenu->addSeparator(globalContext); + Command *sep = contextMenu->addSeparator(); sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)); - contextMenu->addSeparator(globalContext); + contextMenu->addSeparator(); m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol Under Cursor"), this); @@ -248,16 +247,16 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err cppToolsMenu->addAction(cmd); // Update context in global context - cppToolsMenu->addSeparator(globalContext); + cppToolsMenu->addSeparator(); m_reparseExternallyChangedFiles = new QAction(tr("Reparse Externally Changed Files"), this); - cmd = ActionManager::registerAction(m_reparseExternallyChangedFiles, Constants::UPDATE_CODEMODEL, globalContext); + cmd = ActionManager::registerAction(m_reparseExternallyChangedFiles, Constants::UPDATE_CODEMODEL); CppTools::CppModelManager *cppModelManager = CppTools::CppModelManager::instance(); connect(m_reparseExternallyChangedFiles, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); cppToolsMenu->addAction(cmd); - cppToolsMenu->addSeparator(globalContext); + cppToolsMenu->addSeparator(); QAction *inspectCppCodeModel = new QAction(tr("Inspect C++ Code Model..."), this); - cmd = ActionManager::registerAction(inspectCppCodeModel, Constants::INSPECT_CPP_CODEMODEL, globalContext); + cmd = ActionManager::registerAction(inspectCppCodeModel, Constants::INSPECT_CPP_CODEMODEL); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+F12") : tr("Ctrl+Shift+F12"))); connect(inspectCppCodeModel, SIGNAL(triggered()), this, SLOT(inspectCppCodeModel())); cppToolsMenu->addAction(cmd); diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index b2610ebf43..d357e87747 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -400,11 +400,9 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua if (!(d->m_activeDebugLanguages & language)) dockWidget->hide(); - Context globalContext(Core::Constants::C_GLOBAL); - QAction *toggleViewAction = dockWidget->toggleViewAction(); Command *cmd = ActionManager::registerAction(toggleViewAction, - Id("Debugger.").withSuffix(widget->objectName()), globalContext); + Id("Debugger.").withSuffix(widget->objectName())); cmd->setAttribute(Command::CA_Hide); dockWidget->installEventFilter(&d->m_resizeEventFilter); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 2af73f2abc..46da006cbf 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2412,7 +2412,6 @@ void DebuggerPluginPrivate::extensionsInitialized() connect(ICore::instance(), &ICore::coreAboutToClose, this, &DebuggerPluginPrivate::coreShutdown); - const Context globalcontext(CC::C_GLOBAL); const Context cppDebuggercontext(C_CPPDEBUGGER); const Context cppeditorcontext(CppEditor::Constants::CPPEDITOR_ID); @@ -2670,7 +2669,7 @@ void DebuggerPluginPrivate::extensionsInitialized() Command *cmd = 0; ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); - cmd = ActionManager::registerAction(m_startAction, Constants::DEBUG, globalcontext); + cmd = ActionManager::registerAction(m_startAction, Constants::DEBUG); cmd->setDescription(tr("Start Debugging")); cmd->setDefaultKeySequence(debugKey); cmd->setAttribute(Command::CA_UpdateText); @@ -2684,102 +2683,92 @@ void DebuggerPluginPrivate::extensionsInitialized() ModeManager::addAction(m_visibleStartAction, Constants::P_ACTION_DEBUG); cmd = ActionManager::registerAction(m_debugWithoutDeployAction, - "Debugger.DebugWithoutDeploy", globalcontext); + "Debugger.DebugWithoutDeploy"); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, CC::G_DEFAULT_ONE); cmd = ActionManager::registerAction(m_attachToRunningApplication, - "Debugger.AttachToRemoteProcess", globalcontext); + "Debugger.AttachToRemoteProcess"); cmd->setDescription(tr("Attach to Running Application")); mstart->addAction(cmd, G_GENERAL); cmd = ActionManager::registerAction(m_attachToUnstartedApplication, - "Debugger.AttachToUnstartedProcess", globalcontext); + "Debugger.AttachToUnstartedProcess"); cmd->setDescription(tr("Attach to Unstarted Application")); mstart->addAction(cmd, G_GENERAL); cmd = ActionManager::registerAction(m_startAndDebugApplicationAction, - "Debugger.StartAndDebugApplication", globalcontext); + "Debugger.StartAndDebugApplication"); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, G_GENERAL); cmd = ActionManager::registerAction(m_attachToCoreAction, - "Debugger.AttachCore", globalcontext); + "Debugger.AttachCore"); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_GENERAL); cmd = ActionManager::registerAction(m_attachToRemoteServerAction, - "Debugger.AttachToRemoteServer", globalcontext); + "Debugger.AttachToRemoteServer"); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_SPECIAL); cmd = ActionManager::registerAction(m_startRemoteServerAction, - "Debugger.StartRemoteServer", globalcontext); + "Debugger.StartRemoteServer"); cmd->setDescription(tr("Start Gdbserver")); mstart->addAction(cmd, Constants::G_SPECIAL); if (m_startRemoteCdbAction) { cmd = ActionManager::registerAction(m_startRemoteCdbAction, - "Debugger.AttachRemoteCdb", globalcontext); + "Debugger.AttachRemoteCdb"); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_SPECIAL); } - mstart->addSeparator(globalcontext, Constants::G_START_QML); + mstart->addSeparator(Context(CC::C_GLOBAL), Constants::G_START_QML); - cmd = ActionManager::registerAction(m_attachToQmlPortAction, - "Debugger.AttachToQmlPort", globalcontext); + cmd = ActionManager::registerAction(m_attachToQmlPortAction, "Debugger.AttachToQmlPort"); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_START_QML); - cmd = ActionManager::registerAction(m_detachAction, - "Debugger.Detach", globalcontext); + cmd = ActionManager::registerAction(m_detachAction, "Debugger.Detach"); cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = ActionManager::registerAction(m_interruptAction, - Constants::INTERRUPT, globalcontext); + cmd = ActionManager::registerAction(m_interruptAction, Constants::INTERRUPT); cmd->setDescription(tr("Interrupt Debugger")); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = ActionManager::registerAction(m_continueAction, - Constants::CONTINUE, globalcontext); + cmd = ActionManager::registerAction(m_continueAction, Constants::CONTINUE); cmd->setDefaultKeySequence(debugKey); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = ActionManager::registerAction(m_exitAction, - Constants::STOP, globalcontext); + cmd = ActionManager::registerAction(m_exitAction, Constants::STOP); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); m_hiddenStopAction = new ProxyAction(this); m_hiddenStopAction->initialize(cmd->action()); m_hiddenStopAction->setAttribute(ProxyAction::UpdateText); m_hiddenStopAction->setAttribute(ProxyAction::UpdateIcon); - cmd = ActionManager::registerAction(m_hiddenStopAction, - Constants::HIDDEN_STOP, globalcontext); + cmd = ActionManager::registerAction(m_hiddenStopAction, Constants::HIDDEN_STOP); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+Ctrl+Y") : tr("Shift+F5"))); - cmd = ActionManager::registerAction(m_abortAction, - Constants::ABORT, globalcontext); + cmd = ActionManager::registerAction(m_abortAction, Constants::ABORT); cmd->setDescription(tr("Reset Debugger")); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = ActionManager::registerAction(m_resetAction, - Constants::RESET, globalcontext); + cmd = ActionManager::registerAction(m_resetAction, Constants::RESET); cmd->setDescription(tr("Restart Debugging")); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); - debugMenu->addSeparator(globalcontext); + debugMenu->addSeparator(); - cmd = ActionManager::registerAction(m_nextAction, - Constants::NEXT, globalcontext); + cmd = ActionManager::registerAction(m_nextAction, Constants::NEXT); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+O") : tr("F10"))); cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_UpdateText); debugMenu->addAction(cmd); - cmd = ActionManager::registerAction(m_stepAction, - Constants::STEP, globalcontext); + cmd = ActionManager::registerAction(m_stepAction, Constants::STEP); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+I") : tr("F11"))); cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_UpdateText); @@ -2821,7 +2810,7 @@ void DebuggerPluginPrivate::extensionsInitialized() cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd); - debugMenu->addSeparator(globalcontext); + debugMenu->addSeparator(); //cmd = ActionManager::registerAction(m_snapshotAction, // "Debugger.Snapshot", cppDebuggercontext); @@ -2842,56 +2831,51 @@ void DebuggerPluginPrivate::extensionsInitialized() if (isNativeMixedEnabled()) { SavedAction *act = action(OperateNativeMixed); act->setValue(true); - cmd = ActionManager::registerAction(act, - Constants::OPERATE_NATIVE_MIXED, globalcontext); + cmd = ActionManager::registerAction(act, Constants::OPERATE_NATIVE_MIXED); cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd); connect(cmd->action(), &QAction::triggered, [this] { currentEngine()->updateAll(); }); } - cmd = ActionManager::registerAction(m_breakAction, - "Debugger.ToggleBreak", globalcontext); + cmd = ActionManager::registerAction(m_breakAction, "Debugger.ToggleBreak"); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("F8") : tr("F9"))); debugMenu->addAction(cmd); connect(m_breakAction, &QAction::triggered, this, &DebuggerPluginPrivate::toggleBreakpoint); - debugMenu->addSeparator(globalcontext); + debugMenu->addSeparator(); // currently broken // QAction *qmlUpdateOnSaveDummyAction = new QAction(tr("Apply Changes on Save"), this); // qmlUpdateOnSaveDummyAction->setCheckable(true); // qmlUpdateOnSaveDummyAction->setIcon(QIcon(_(":/debugger/images/qml/apply-on-save.png"))); // qmlUpdateOnSaveDummyAction->setEnabled(false); -// cmd = ActionManager::registerAction(qmlUpdateOnSaveDummyAction, Constants::QML_UPDATE_ON_SAVE, -// globalcontext); +// cmd = ActionManager::registerAction(qmlUpdateOnSaveDummyAction, Constants::QML_UPDATE_ON_SAVE); // debugMenu->addAction(cmd); QAction *qmlShowAppOnTopDummyAction = new QAction(tr("Show Application on Top"), this); qmlShowAppOnTopDummyAction->setCheckable(true); qmlShowAppOnTopDummyAction->setIcon(QIcon(_(":/debugger/images/qml/app-on-top.png"))); qmlShowAppOnTopDummyAction->setEnabled(false); - cmd = ActionManager::registerAction(qmlShowAppOnTopDummyAction, Constants::QML_SHOW_APP_ON_TOP, - globalcontext); + cmd = ActionManager::registerAction(qmlShowAppOnTopDummyAction, Constants::QML_SHOW_APP_ON_TOP); debugMenu->addAction(cmd); QAction *qmlSelectDummyAction = new QAction(tr("Select"), this); qmlSelectDummyAction->setCheckable(true); qmlSelectDummyAction->setIcon(QIcon(_(":/debugger/images/qml/select.png"))); qmlSelectDummyAction->setEnabled(false); - cmd = ActionManager::registerAction(qmlSelectDummyAction, Constants::QML_SELECTTOOL, - globalcontext); + cmd = ActionManager::registerAction(qmlSelectDummyAction, Constants::QML_SELECTTOOL); debugMenu->addAction(cmd); QAction *qmlZoomDummyAction = new QAction(tr("Zoom"), this); qmlZoomDummyAction->setCheckable(true); qmlZoomDummyAction->setIcon(QIcon(_(":/debugger/images/qml/zoom.png"))); qmlZoomDummyAction->setEnabled(false); - cmd = ActionManager::registerAction(qmlZoomDummyAction, Constants::QML_ZOOMTOOL, globalcontext); + cmd = ActionManager::registerAction(qmlZoomDummyAction, Constants::QML_ZOOMTOOL); debugMenu->addAction(cmd); - debugMenu->addSeparator(globalcontext); + debugMenu->addSeparator(); // Don't add '1' to the string as it shows up in the shortcut dialog. cmd = ActionManager::registerAction(m_watchAction1, diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index ba78bc8a06..984931dea0 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -160,11 +160,9 @@ bool DiffEditorPlugin::initialize(const QStringList &arguments, QString *errorMe toolsContainer->insertGroup(Core::Constants::G_TOOLS_OPTIONS, Constants::G_TOOLS_DIFF); - Core::Context globalcontext(Core::Constants::C_GLOBAL); - QAction *diffAction = new QAction(tr("Diff..."), this); Core::Command *diffCommand = Core::ActionManager::registerAction(diffAction, - "DiffEditor.Diff", globalcontext); + "DiffEditor.Diff"); connect(diffAction, &QAction::triggered, this, &DiffEditorPlugin::diff); toolsContainer->addAction(diffCommand, Constants::G_TOOLS_DIFF); diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 2f2dc7ca81..ff23c96717 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -1207,7 +1207,7 @@ bool FakeVimPluginPrivate::initialize() for (int i = 1; i < 10; ++i) { auto act = new QAction(this); act->setText(Tr::tr("Execute User Action #%1").arg(i)); - cmd = ActionManager::registerAction(act, base.withSuffix(i), globalcontext); + cmd = ActionManager::registerAction(act, base.withSuffix(i)); cmd->setDefaultKeySequence(QKeySequence((UseMacShortcuts ? Tr::tr("Meta+V,%1") : Tr::tr("Alt+V,%1")).arg(i))); connect(act, &QAction::triggered, this, [this, i] { userActionTriggered(i); }); } diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index 32601b4725..9baaddedff 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -297,16 +297,14 @@ bool GerritPlugin::initialize(ActionContainer *ac) QAction *openViewAction = new QAction(tr("Gerrit..."), this); m_gerritCommand = - ActionManager::registerAction(openViewAction, Constants::GERRIT_OPEN_VIEW, - Context(Core::Constants::C_GLOBAL)); + ActionManager::registerAction(openViewAction, Constants::GERRIT_OPEN_VIEW); connect(openViewAction, SIGNAL(triggered()), this, SLOT(openView())); ac->addAction(m_gerritCommand); QAction *pushAction = new QAction(tr("Push to Gerrit..."), this); m_pushToGerritCommand = - ActionManager::registerAction(pushAction, Constants::GERRIT_PUSH, - Context(Core::Constants::C_GLOBAL)); + ActionManager::registerAction(pushAction, Constants::GERRIT_PUSH); connect(pushAction, SIGNAL(triggered()), this, SLOT(push())); ac->addAction(m_pushToGerritCommand); diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 222d76bd72..36e6b590ec 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -279,9 +279,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) initializeVcs(new GitVersionControl(m_gitClient), context); - // Create the contexts to register actions accordingly - Context globalcontext(Core::Constants::C_GLOBAL); - // Create the settings Page addAutoReleasedObject(new SettingsPage()); @@ -631,7 +628,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_createRepositryAction = new QAction(tr("Create Repository..."), this); Command *createRepositoryCommand = ActionManager::registerAction( - m_createRepositryAction, "Git.CreateRepository", globalcontext); + m_createRepositryAction, "Git.CreateRepository"); connect(m_createRepositryAction, SIGNAL(triggered()), this, SLOT(createRepository())); gitContainer->addAction(createRepositoryCommand); diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp index bd6c2fde17..3695c0ef83 100644 --- a/src/plugins/glsleditor/glsleditorplugin.cpp +++ b/src/plugins/glsleditor/glsleditorplugin.cpp @@ -138,10 +138,9 @@ bool GlslEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er Command *cmd = 0; // Insert marker for "Refactoring" menu: - Context globalContext(Core::Constants::C_GLOBAL); - Command *sep = contextMenu->addSeparator(globalContext); + Command *sep = contextMenu->addSeparator(); sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)); - contextMenu->addSeparator(globalContext); + contextMenu->addSeparator(); cmd = ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index e3ff3e32a0..5915c9f102 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -124,7 +124,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) { Q_UNUSED(arguments) Q_UNUSED(error) - Context globalcontext(Core::Constants::C_GLOBAL); Context modecontext(Constants::C_MODE_HELP); const QString &locale = ICore::userInterfaceLanguage(); @@ -177,28 +176,28 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) // Add Contents, Index, and Context menu items action = new QAction(QIcon::fromTheme(QLatin1String("help-contents")), tr(Constants::SB_CONTENTS), this); - cmd = ActionManager::registerAction(action, "Help.ContentsMenu", globalcontext); + cmd = ActionManager::registerAction(action, "Help.ContentsMenu"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); connect(action, SIGNAL(triggered()), this, SLOT(activateContents())); action = new QAction(tr(Constants::SB_INDEX), this); - cmd = ActionManager::registerAction(action, "Help.IndexMenu", globalcontext); + cmd = ActionManager::registerAction(action, "Help.IndexMenu"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); connect(action, SIGNAL(triggered()), this, SLOT(activateIndex())); action = new QAction(tr("Context Help"), this); - cmd = ActionManager::registerAction(action, Help::Constants::CONTEXT_HELP, globalcontext); + cmd = ActionManager::registerAction(action, Help::Constants::CONTEXT_HELP); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1)); connect(action, SIGNAL(triggered()), this, SLOT(showContextHelp())); action = new QAction(tr("Technical Support"), this); - cmd = ActionManager::registerAction(action, "Help.TechSupport", globalcontext); + cmd = ActionManager::registerAction(action, "Help.TechSupport"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); connect(action, SIGNAL(triggered()), this, SLOT(slotOpenSupportPage())); action = new QAction(tr("Report Bug..."), this); - cmd = ActionManager::registerAction(action, "Help.ReportBug", globalcontext); + cmd = ActionManager::registerAction(action, "Help.ReportBug"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); connect(action, SIGNAL(triggered()), this, SLOT(slotReportBug())); diff --git a/src/plugins/macros/macrosplugin.cpp b/src/plugins/macros/macrosplugin.cpp index 46ee1e5bd6..519cc9a678 100644 --- a/src/plugins/macros/macrosplugin.cpp +++ b/src/plugins/macros/macrosplugin.cpp @@ -70,7 +70,6 @@ bool MacrosPlugin::initialize(const QStringList &arguments, QString *errorMessag addAutoReleasedObject(new MacroOptionsPage); addAutoReleasedObject(new MacroLocatorFilter); - Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context textContext(TextEditor::Constants::C_TEXTEDITOR); m_macroManager = new MacroManager(this); @@ -90,7 +89,7 @@ bool MacrosPlugin::initialize(const QStringList &arguments, QString *errorMessag QAction *endMacro = new QAction(tr("Stop Recording Macro"), this); endMacro->setEnabled(false); - command = Core::ActionManager::registerAction(endMacro, Constants::END_MACRO, globalcontext); + command = Core::ActionManager::registerAction(endMacro, Constants::END_MACRO); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+)") : tr("Alt+)"))); mmacrotools->addAction(command); connect(endMacro, &QAction::triggered, m_macroManager, &MacroManager::endMacro); diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 152178d6cb..aa2877116a 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -161,15 +161,13 @@ AppOutputPane::AppOutputPane() : this, SLOT(reRunRunControl())); // Stop - Core::Context globalcontext(Core::Constants::C_GLOBAL); - QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL)); m_stopAction->setIcon(stopIcon); m_stopAction->setToolTip(tr("Stop")); m_stopAction->setEnabled(false); - Core::Command *cmd = Core::ActionManager::registerAction(m_stopAction, Constants::STOP, globalcontext); + Core::Command *cmd = Core::ActionManager::registerAction(m_stopAction, Constants::STOP); m_stopButton->setDefaultAction(cmd->action()); m_stopButton->setAutoRaise(true); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 82a092ede1..68bb5d0ebe 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -748,13 +748,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // new action dd->m_newAction = new QAction(tr("New Project..."), this); - cmd = ActionManager::registerAction(dd->m_newAction, Constants::NEWPROJECT, globalcontext); + cmd = ActionManager::registerAction(dd->m_newAction, Constants::NEWPROJECT); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+N"))); msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES); // open action dd->m_loadAction = new QAction(tr("Load Project..."), this); - cmd = ActionManager::registerAction(dd->m_loadAction, Constants::LOAD, globalcontext); + cmd = ActionManager::registerAction(dd->m_loadAction, Constants::LOAD); #ifndef Q_OS_MAC cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+O"))); #endif @@ -809,7 +809,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // session manager action dd->m_sessionManagerAction = new QAction(tr("Session Manager..."), this); - cmd = ActionManager::registerAction(dd->m_sessionManagerAction, Constants::NEWSESSION, globalcontext); + cmd = ActionManager::registerAction(dd->m_sessionManagerAction, Constants::NEWSESSION); mfile->addAction(cmd, Core::Constants::G_FILE_OPEN); cmd->setDefaultKeySequence(QKeySequence()); @@ -817,7 +817,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // unload action dd->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - cmd = ActionManager::registerAction(dd->m_unloadAction, Constants::UNLOAD, globalcontext); + cmd = ActionManager::registerAction(dd->m_unloadAction, Constants::UNLOAD); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(dd->m_unloadAction->text()); mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT); @@ -832,7 +832,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // unload session action dd->m_closeAllProjects = new QAction(tr("Close All Projects and Editors"), this); - cmd = ActionManager::registerAction(dd->m_closeAllProjects, Constants::CLEARSESSION, globalcontext); + cmd = ActionManager::registerAction(dd->m_closeAllProjects, Constants::CLEARSESSION); mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT); msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES); @@ -840,14 +840,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er QIcon buildIcon = QIcon(QLatin1String(Constants::ICON_BUILD)); buildIcon.addFile(QLatin1String(Constants::ICON_BUILD_SMALL)); dd->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this); - cmd = ActionManager::registerAction(dd->m_buildSessionAction, Constants::BUILDSESSION, globalcontext); + cmd = ActionManager::registerAction(dd->m_buildSessionAction, Constants::BUILDSESSION); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B"))); mbuild->addAction(cmd, Constants::G_BUILD_BUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); // deploy session dd->m_deploySessionAction = new QAction(tr("Deploy All"), this); - cmd = ActionManager::registerAction(dd->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext); + cmd = ActionManager::registerAction(dd->m_deploySessionAction, Constants::DEPLOYSESSION); mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY); msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); @@ -855,7 +855,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er QIcon rebuildIcon = QIcon(QLatin1String(Constants::ICON_REBUILD)); rebuildIcon.addFile(QLatin1String(Constants::ICON_REBUILD_SMALL)); dd->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this); - cmd = ActionManager::registerAction(dd->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext); + cmd = ActionManager::registerAction(dd->m_rebuildSessionAction, Constants::REBUILDSESSION); mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); @@ -863,7 +863,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er QIcon cleanIcon = QIcon(QLatin1String(Constants::ICON_CLEAN)); cleanIcon.addFile(QLatin1String(Constants::ICON_CLEAN_SMALL)); dd->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this); - cmd = ActionManager::registerAction(dd->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext); + cmd = ActionManager::registerAction(dd->m_cleanSessionAction, Constants::CLEANSESSION); mbuild->addAction(cmd, Constants::G_BUILD_CLEAN); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); @@ -871,7 +871,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er dd->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); dd->m_buildAction->setIcon(buildIcon); - cmd = ActionManager::registerAction(dd->m_buildAction, Constants::BUILD, globalcontext); + cmd = ActionManager::registerAction(dd->m_buildAction, Constants::BUILD); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(dd->m_buildAction->text()); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B"))); @@ -883,7 +883,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // deploy action dd->m_deployAction = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - cmd = ActionManager::registerAction(dd->m_deployAction, Constants::DEPLOY, globalcontext); + cmd = ActionManager::registerAction(dd->m_deployAction, Constants::DEPLOY); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(dd->m_deployAction->text()); mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY); @@ -891,7 +891,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // rebuild action dd->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - cmd = ActionManager::registerAction(dd->m_rebuildAction, Constants::REBUILD, globalcontext); + cmd = ActionManager::registerAction(dd->m_rebuildAction, Constants::REBUILD); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(dd->m_rebuildAction->text()); mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); @@ -899,7 +899,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // clean action dd->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - cmd = ActionManager::registerAction(dd->m_cleanAction, Constants::CLEAN, globalcontext); + cmd = ActionManager::registerAction(dd->m_cleanAction, Constants::CLEAN); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(dd->m_cleanAction->text()); mbuild->addAction(cmd, Constants::G_BUILD_CLEAN); @@ -908,12 +908,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL)); dd->m_cancelBuildAction = new QAction(stopIcon, tr("Cancel Build"), this); - cmd = ActionManager::registerAction(dd->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext); + cmd = ActionManager::registerAction(dd->m_cancelBuildAction, Constants::CANCELBUILD); mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); // run action dd->m_runAction = new QAction(runIcon, tr("Run"), this); - cmd = ActionManager::registerAction(dd->m_runAction, Constants::RUN, globalcontext); + cmd = ActionManager::registerAction(dd->m_runAction, Constants::RUN); cmd->setAttribute(Command::CA_UpdateText); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); @@ -923,7 +923,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // Run without deployment action dd->m_runWithoutDeployAction = new QAction(tr("Run Without Deployment"), this); - cmd = ActionManager::registerAction(dd->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY, globalcontext); + cmd = ActionManager::registerAction(dd->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY); mbuild->addAction(cmd, Constants::G_BUILD_RUN); // build action (context menu) @@ -946,19 +946,19 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // build without dependencies action dd->m_buildProjectOnlyAction = new QAction(tr("Build Without Dependencies"), this); - ActionManager::registerAction(dd->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY, globalcontext); + ActionManager::registerAction(dd->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY); // rebuild without dependencies action dd->m_rebuildProjectOnlyAction = new QAction(tr("Rebuild Without Dependencies"), this); - ActionManager::registerAction(dd->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY, globalcontext); + ActionManager::registerAction(dd->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY); // deploy without dependencies action dd->m_deployProjectOnlyAction = new QAction(tr("Deploy Without Dependencies"), this); - ActionManager::registerAction(dd->m_deployProjectOnlyAction, Constants::DEPLOYPROJECTONLY, globalcontext); + ActionManager::registerAction(dd->m_deployProjectOnlyAction, Constants::DEPLOYPROJECTONLY); // clean without dependencies action dd->m_cleanProjectOnlyAction = new QAction(tr("Clean Without Dependencies"), this); - ActionManager::registerAction(dd->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext); + ActionManager::registerAction(dd->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY); // deploy action (context menu) dd->m_deployActionContextMenu = new QAction(tr("Deploy"), this); @@ -1005,7 +1005,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // unload project again, in right position dd->m_unloadActionContextMenu = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - cmd = ActionManager::registerAction(dd->m_unloadActionContextMenu, Constants::UNLOADCM, globalcontext); + cmd = ActionManager::registerAction(dd->m_unloadActionContextMenu, Constants::UNLOADCM); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(dd->m_unloadActionContextMenu->text()); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST); @@ -1080,8 +1080,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er dd->m_projectSelectorActionMenu->setText(tr("Open Build and Run Kit Selector...")); connect(dd->m_projectSelectorActionMenu, &QAction::triggered, dd->m_targetSelector, &MiniProjectTargetSelector::toggleVisible); - cmd = ActionManager::registerAction(dd->m_projectSelectorActionMenu, Constants::SELECTTARGET, - globalcontext); + cmd = ActionManager::registerAction(dd->m_projectSelectorActionMenu, Constants::SELECTTARGET); mbuild->addAction(cmd, Constants::G_BUILD_RUN); dd->m_projectSelectorActionQuick = new QAction(this); @@ -1089,7 +1088,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er dd->m_projectSelectorActionQuick->setText(tr("Quick Switch Kit Selector")); connect(dd->m_projectSelectorActionQuick, &QAction::triggered, dd->m_targetSelector, &MiniProjectTargetSelector::nextOrShow); - cmd = ActionManager::registerAction(dd->m_projectSelectorActionQuick, Constants::SELECTTARGETQUICK, globalcontext); + cmd = ActionManager::registerAction(dd->m_projectSelectorActionQuick, Constants::SELECTTARGETQUICK); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+T"))); connect(ICore::instance(), &ICore::saveSettingsRequested, diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index 8f7d32684c..b9a2f234d0 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -96,7 +96,6 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * Q_UNUSED(errorMessage); const Core::Context projectContext(::QbsProjectManager::Constants::PROJECT_ID); - const Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "qbs"); @@ -146,7 +145,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * m_buildFile = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = Core::ActionManager::registerAction(m_buildFile, Constants::ACTION_BUILD_FILE, globalcontext); + command = Core::ActionManager::registerAction(m_buildFile, Constants::ACTION_BUILD_FILE); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_buildFile->text()); @@ -162,7 +161,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * m_buildProduct = new Utils::ParameterAction(tr("Build Product"), tr("Build Product \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = Core::ActionManager::registerAction(m_buildProduct, Constants::ACTION_BUILD_PRODUCT, globalcontext); + command = Core::ActionManager::registerAction(m_buildProduct, Constants::ACTION_BUILD_PRODUCT); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_buildFile->text()); @@ -178,7 +177,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * m_buildSubproject = new Utils::ParameterAction(tr("Build Subproject"), tr("Build Subproject \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = Core::ActionManager::registerAction(m_buildSubproject, Constants::ACTION_BUILD_SUBPROJECT, globalcontext); + command = Core::ActionManager::registerAction(m_buildSubproject, Constants::ACTION_BUILD_SUBPROJECT); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_buildFile->text()); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index 0e0c6fbdb6..de5d916813 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -218,10 +218,9 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_CLEAN); connect(m_cleanSubProjectAction, SIGNAL(triggered()), m_qmakeProjectManager, SLOT(cleanSubDirContextMenu())); - const Core::Context globalcontext(Core::Constants::C_GLOBAL); m_buildFileAction = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = Core::ActionManager::registerAction(m_buildFileAction, Constants::BUILDFILE, globalcontext); + command = Core::ActionManager::registerAction(m_buildFileAction, Constants::BUILDFILE); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_buildFileAction->text()); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index ed460e4445..557935896b 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -126,8 +126,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_CONTEXT); ActionContainer *qmlToolsMenu = ActionManager::actionContainer(Id(QmlJSTools::Constants::M_TOOLS_QMLJS)); - Context globalContext(Core::Constants::C_GLOBAL); - qmlToolsMenu->addSeparator(globalContext); + qmlToolsMenu->addSeparator(); Command *cmd; cmd = ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); @@ -149,7 +148,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e qmlToolsMenu->addAction(cmd); QAction *semanticScan = new QAction(tr("Run Checks"), this); - cmd = ActionManager::registerAction(semanticScan, Id(Constants::RUN_SEMANTIC_SCAN), globalContext); + cmd = ActionManager::registerAction(semanticScan, Id(Constants::RUN_SEMANTIC_SCAN)); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+C"))); connect(semanticScan, SIGNAL(triggered()), this, SLOT(runSemanticScan())); qmlToolsMenu->addAction(cmd); @@ -168,9 +167,9 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e qmlToolsMenu->addAction(cmd); // Insert marker for "Refactoring" menu: - Command *sep = contextMenu->addSeparator(globalContext); + Command *sep = contextMenu->addSeparator(); sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)); - contextMenu->addSeparator(globalContext); + contextMenu->addSeparator(); cmd = ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); diff --git a/src/plugins/qmljstools/qmljstoolsplugin.cpp b/src/plugins/qmljstools/qmljstoolsplugin.cpp index 113aa2bce4..43bdbca48d 100644 --- a/src/plugins/qmljstools/qmljstoolsplugin.cpp +++ b/src/plugins/qmljstools/qmljstoolsplugin.cpp @@ -105,9 +105,8 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error) // Update context in global context m_resetCodeModelAction = new QAction(tr("Reset Code Model"), this); - Context globalContext(Core::Constants::C_GLOBAL); Command *cmd = ActionManager::registerAction( - m_resetCodeModelAction, Constants::RESET_CODEMODEL, globalContext); + m_resetCodeModelAction, Constants::RESET_CODEMODEL); connect(m_resetCodeModelAction, &QAction::triggered, m_modelManager, &ModelManager::resetCodeModel); mqmljstools->addAction(cmd); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 33c1af157d..5bfdf53e64 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -153,7 +153,6 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) d->m_profilerConnections->setModelManager(d->m_profilerModelManager); Command *command = 0; - const Context globalContext(C_GLOBAL); ActionContainer *menu = ActionManager::actionContainer(M_DEBUG_ANALYZER); ActionContainer *options = ActionManager::createMenu(M_DEBUG_ANALYZER_QML_OPTIONS); @@ -162,13 +161,13 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) options->menu()->setEnabled(true); QAction *act = d->m_loadQmlTrace = new QAction(tr("Load QML Trace"), options); - command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace", globalContext); + command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace"); connect(act, SIGNAL(triggered()), this, SLOT(showLoadDialog())); options->addAction(command); act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options); d->m_saveQmlTrace->setEnabled(false); - command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace", globalContext); + command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace"); connect(act, SIGNAL(triggered()), this, SLOT(showSaveDialog())); options->addAction(command); diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp index 82055c72ac..8bf083d2ec 100644 --- a/src/plugins/qnx/qnxplugin.cpp +++ b/src/plugins/qnx/qnxplugin.cpp @@ -148,12 +148,11 @@ void QnxPlugin::extensionsInitialized() m_attachToQnxApplication->setText(tr("Attach to remote QNX application...")); connect(m_attachToQnxApplication, SIGNAL(triggered()), debugSupport, SLOT(showProcessesDialog())); - const Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING); mstart->appendGroup(Constants::QNX_DEBUGGING_GROUP); - mstart->addSeparator(globalcontext, Constants::QNX_DEBUGGING_GROUP, &m_debugSeparator); + mstart->addSeparator(Core::Context(Core::Constants::C_GLOBAL), Constants::QNX_DEBUGGING_GROUP, &m_debugSeparator); - Core::Command *cmd = Core::ActionManager::registerAction(m_attachToQnxApplication, "Debugger.AttachToQnxApplication", globalcontext); + Core::Command *cmd = Core::ActionManager::registerAction(m_attachToQnxApplication, "Debugger.AttachToQnxApplication"); mstart->addAction(cmd, Constants::QNX_DEBUGGING_GROUP); connect(KitManager::instance(), SIGNAL(kitsChanged()), this, SLOT(updateDebuggerActions())); |