summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/bazaar/bazaarplugin.cpp10
-rw-r--r--src/plugins/bazaar/bazaarplugin.h2
-rw-r--r--src/plugins/bazaar/constants.h1
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp42
-rw-r--r--src/plugins/coreplugin/actionmanager/actioncontainer.cpp12
-rw-r--r--src/plugins/coreplugin/actionmanager/actioncontainer.h1
-rw-r--r--src/plugins/coreplugin/actionmanager/actioncontainer_p.h1
-rw-r--r--src/plugins/cvs/cvsplugin.cpp57
-rw-r--r--src/plugins/git/gitconstants.h1
-rw-r--r--src/plugins/git/gitplugin.cpp162
-rw-r--r--src/plugins/git/gitplugin.h1
-rw-r--r--src/plugins/mercurial/constants.h1
-rw-r--r--src/plugins/mercurial/mercurialplugin.cpp12
-rw-r--r--src/plugins/mercurial/mercurialplugin.h2
-rw-r--r--src/plugins/perforce/perforceplugin.cpp108
-rw-r--r--src/plugins/perforce/perforceplugin.h1
-rw-r--r--src/plugins/subversion/subversionplugin.cpp50
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.cpp6
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.h3
19 files changed, 234 insertions, 239 deletions
diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp
index 95d624247c..f6d537b3e6 100644
--- a/src/plugins/bazaar/bazaarplugin.cpp
+++ b/src/plugins/bazaar/bazaarplugin.cpp
@@ -162,8 +162,10 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
+ Context context(Constants::BAZAAR_CONTEXT);
+
m_client = new BazaarClient(&m_bazaarSettings);
- initializeVcs(new BazaarControl(m_client));
+ initializeVcs(new BazaarControl(m_client), context);
addAutoReleasedObject(new OptionsPage);
m_bazaarSettings.readSettings(ICore::settings());
@@ -193,7 +195,7 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
m_commandLocator = new CommandLocator("Bazaar", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
- createMenu();
+ createMenu(context);
createSubmitEditorActions();
@@ -226,10 +228,8 @@ void BazaarPlugin::setSettings(const BazaarSettings &settings)
}
}
-void BazaarPlugin::createMenu()
+void BazaarPlugin::createMenu(const Context &context)
{
- Context context(Core::Constants::C_GLOBAL);
-
// Create menu item for Bazaar
m_bazaarContainer = ActionManager::createMenu("Bazaar.BazaarMenu");
QMenu *menu = m_bazaarContainer->menu();
diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h
index 906842119f..133a5cdc25 100644
--- a/src/plugins/bazaar/bazaarplugin.h
+++ b/src/plugins/bazaar/bazaarplugin.h
@@ -109,7 +109,7 @@ protected:
private:
// Functions
- void createMenu();
+ void createMenu(const Core::Context &context);
void createSubmitEditorActions();
void createFileActions(const Core::Context &context);
void createDirectoryActions(const Core::Context &context);
diff --git a/src/plugins/bazaar/constants.h b/src/plugins/bazaar/constants.h
index f4d5c6918b..38ec34e916 100644
--- a/src/plugins/bazaar/constants.h
+++ b/src/plugins/bazaar/constants.h
@@ -36,6 +36,7 @@ namespace Constants {
const char BAZAAR[] = "bazaar";
const char BAZAARREPO[] = ".bzr";
const char BAZAARDEFAULT[] = "bzr";
+const char BAZAAR_CONTEXT[] = "Bazaar Context";
// Changeset identifiers
const char CHANGESET_ID[] = "^("
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index 67fd8ef7a6..c77a3aa458 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -111,6 +111,7 @@ using namespace Utils;
namespace ClearCase {
namespace Internal {
+static const char CLEARCASE_CONTEXT[] = "ClearCase Context";
static const char CMD_ID_CLEARCASE_MENU[] = "ClearCase.Menu";
static const char CMD_ID_CHECKOUT[] = "ClearCase.CheckOut";
static const char CMD_ID_CHECKIN[] = "ClearCase.CheckInCurrent";
@@ -437,7 +438,9 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
using namespace Constants;
using namespace Core::Constants;
- initializeVcs(new ClearCaseControl(this));
+ Context context(CLEARCASE_CONTEXT);
+
+ initializeVcs(new ClearCaseControl(this), context);
m_clearcasePluginInstance = this;
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(closing()));
@@ -478,12 +481,11 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
clearcaseMenu->menu()->setTitle(tr("C&learCase"));
toolsContainer->addMenu(clearcaseMenu);
m_menuAction = clearcaseMenu->menu()->menuAction();
- Context globalcontext(C_GLOBAL);
Command *command;
m_checkOutAction = new ParameterAction(tr("Check Out..."), tr("Check &Out \"%1\"..."), ParameterAction::AlwaysEnabled, this);
command = ActionManager::registerAction(m_checkOutAction, CMD_ID_CHECKOUT,
- globalcontext);
+ context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+O") : tr("Alt+L,Alt+O")));
connect(m_checkOutAction, SIGNAL(triggered()), this, SLOT(checkOutCurrentFile()));
@@ -491,7 +493,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
m_commandLocator->appendCommand(command);
m_checkInCurrentAction = new ParameterAction(tr("Check &In..."), tr("Check &In \"%1\"..."), ParameterAction::AlwaysEnabled, this);
- command = ActionManager::registerAction(m_checkInCurrentAction, CMD_ID_CHECKIN, globalcontext);
+ command = ActionManager::registerAction(m_checkInCurrentAction, CMD_ID_CHECKIN, context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+I") : tr("Alt+L,Alt+I")));
connect(m_checkInCurrentAction, SIGNAL(triggered()), this, SLOT(startCheckInCurrentFile()));
@@ -499,7 +501,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
m_commandLocator->appendCommand(command);
m_undoCheckOutAction = new ParameterAction(tr("Undo Check Out"), tr("&Undo Check Out \"%1\""), ParameterAction::AlwaysEnabled, this);
- command = ActionManager::registerAction(m_undoCheckOutAction, CMD_ID_UNDOCHECKOUT, globalcontext);
+ command = ActionManager::registerAction(m_undoCheckOutAction, CMD_ID_UNDOCHECKOUT, context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+U") : tr("Alt+L,Alt+U")));
connect(m_undoCheckOutAction, SIGNAL(triggered()), this, SLOT(undoCheckOutCurrent()));
@@ -507,18 +509,18 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
m_commandLocator->appendCommand(command);
m_undoHijackAction = new ParameterAction(tr("Undo Hijack"), tr("Undo Hi&jack \"%1\""), ParameterAction::AlwaysEnabled, this);
- command = ActionManager::registerAction(m_undoHijackAction, CMD_ID_UNDOHIJACK, globalcontext);
+ command = ActionManager::registerAction(m_undoHijackAction, CMD_ID_UNDOHIJACK, context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+R") : tr("Alt+L,Alt+R")));
connect(m_undoHijackAction, SIGNAL(triggered()), this, SLOT(undoHijackCurrent()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
- clearcaseMenu->addSeparator(globalcontext);
+ clearcaseMenu->addSeparator(context);
m_diffCurrentAction = new ParameterAction(tr("Diff Current File"), tr("&Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_diffCurrentAction,
- CMD_ID_DIFF_CURRENT, globalcontext);
+ CMD_ID_DIFF_CURRENT, context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+D") : tr("Alt+L,Alt+D")));
connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
@@ -527,7 +529,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
m_historyCurrentAction = new ParameterAction(tr("History Current File"), tr("&History \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_historyCurrentAction,
- CMD_ID_HISTORY_CURRENT, globalcontext);
+ CMD_ID_HISTORY_CURRENT, context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+H") : tr("Alt+L,Alt+H")));
connect(m_historyCurrentAction, SIGNAL(triggered()), this,
@@ -537,7 +539,7 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
m_annotateCurrentAction = new ParameterAction(tr("Annotate Current File"), tr("&Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_annotateCurrentAction,
- CMD_ID_ANNOTATE, globalcontext);
+ CMD_ID_ANNOTATE, context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+A") : tr("Alt+L,Alt+A")));
connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
@@ -546,52 +548,52 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
m_commandLocator->appendCommand(command);
m_addFileAction = new ParameterAction(tr("Add File..."), tr("Add File \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_addFileAction, CMD_ID_ADD_FILE, globalcontext);
+ command = ActionManager::registerAction(m_addFileAction, CMD_ID_ADD_FILE, context);
command->setAttribute(Command::CA_UpdateText);
connect(m_addFileAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
clearcaseMenu->addAction(command);
- clearcaseMenu->addSeparator(globalcontext);
+ clearcaseMenu->addSeparator(context);
m_diffActivityAction = new QAction(tr("Diff A&ctivity..."), this);
m_diffActivityAction->setEnabled(false);
- command = ActionManager::registerAction(m_diffActivityAction, CMD_ID_DIFF_ACTIVITY, globalcontext);
+ command = ActionManager::registerAction(m_diffActivityAction, CMD_ID_DIFF_ACTIVITY, context);
connect(m_diffActivityAction, SIGNAL(triggered()), this, SLOT(diffActivity()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_checkInActivityAction = new ParameterAction(tr("Ch&eck In Activity"), tr("Chec&k In Activity \"%1\"..."), ParameterAction::EnabledWithParameter, this);
m_checkInActivityAction->setEnabled(false);
- command = ActionManager::registerAction(m_checkInActivityAction, CMD_ID_CHECKIN_ACTIVITY, globalcontext);
+ command = ActionManager::registerAction(m_checkInActivityAction, CMD_ID_CHECKIN_ACTIVITY, context);
connect(m_checkInActivityAction, SIGNAL(triggered()), this, SLOT(startCheckInActivity()));
command->setAttribute(Command::CA_UpdateText);
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
- clearcaseMenu->addSeparator(globalcontext);
+ clearcaseMenu->addSeparator(context);
m_updateIndexAction = new QAction(tr("Update Index"), this);
- command = ActionManager::registerAction(m_updateIndexAction, CMD_ID_UPDATEINDEX, globalcontext);
+ command = ActionManager::registerAction(m_updateIndexAction, CMD_ID_UPDATEINDEX, context);
connect(m_updateIndexAction, SIGNAL(triggered()), this, SLOT(updateIndex()));
clearcaseMenu->addAction(command);
m_updateViewAction = new ParameterAction(tr("Update View"), tr("U&pdate View \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_updateViewAction, CMD_ID_UPDATE_VIEW, globalcontext);
+ command = ActionManager::registerAction(m_updateViewAction, CMD_ID_UPDATE_VIEW, context);
connect(m_updateViewAction, SIGNAL(triggered()), this, SLOT(updateView()));
command->setAttribute(Command::CA_UpdateText);
clearcaseMenu->addAction(command);
- clearcaseMenu->addSeparator(globalcontext);
+ clearcaseMenu->addSeparator(context);
m_checkInAllAction = new QAction(tr("Check In All &Files..."), this);
- command = ActionManager::registerAction(m_checkInAllAction, CMD_ID_CHECKIN_ALL, globalcontext);
+ command = ActionManager::registerAction(m_checkInAllAction, CMD_ID_CHECKIN_ALL, context);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+F") : tr("Alt+L,Alt+F")));
connect(m_checkInAllAction, SIGNAL(triggered()), this, SLOT(startCheckInAll()));
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_statusAction = new QAction(tr("View &Status"), this);
- command = ActionManager::registerAction(m_statusAction, CMD_ID_STATUS, globalcontext);
+ command = ActionManager::registerAction(m_statusAction, CMD_ID_STATUS, context);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+L,Meta+S") : tr("Alt+L,Alt+S")));
connect(m_statusAction, SIGNAL(triggered()), this, SLOT(viewStatus()));
clearcaseMenu->addAction(command);
diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
index 893e217937..6cf8ba718e 100644
--- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
+++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp
@@ -307,18 +307,6 @@ Command *ActionContainerPrivate::addSeparator(const Context &context, Id group,
return cmd;
}
-void ActionContainerPrivate::setEnabled(bool enabled)
-{
- foreach (const Group &group, m_groups) {
- foreach (QObject *item, group.items) {
- if (Command *command = qobject_cast<Command *>(item))
- command->action()->setEnabled(enabled);
- else if (ActionContainer *container = qobject_cast<ActionContainer *>(item))
- container->setEnabled(enabled);
- }
- }
-}
-
void ActionContainerPrivate::clear()
{
QMutableListIterator<Group> it(m_groups);
diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.h b/src/plugins/coreplugin/actionmanager/actioncontainer.h
index 4f03da9617..4c3c9d9cff 100644
--- a/src/plugins/coreplugin/actionmanager/actioncontainer.h
+++ b/src/plugins/coreplugin/actionmanager/actioncontainer.h
@@ -72,7 +72,6 @@ public:
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 void setEnabled(bool enabled) = 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/actioncontainer_p.h b/src/plugins/coreplugin/actionmanager/actioncontainer_p.h
index 5d7d7de6fe..4434c0b65b 100644
--- a/src/plugins/coreplugin/actionmanager/actioncontainer_p.h
+++ b/src/plugins/coreplugin/actionmanager/actioncontainer_p.h
@@ -64,7 +64,6 @@ public:
void addMenu(ActionContainer *menu, Id group = Id());
void addMenu(ActionContainer *before, ActionContainer *menu, Id group = Id());
Command *addSeparator(const Context &context, Id group = Id(), QAction **outSeparator = 0);
- void setEnabled(bool enabled);
virtual void clear();
Id id() const;
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 1e51bd750b..1484a75981 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -95,6 +95,7 @@ static inline QString msgLogParsingFailed()
return CvsPlugin::tr("Parsing of the log output failed");
}
+const char CVS_CONTEXT[] = "CVS Context";
const char CMD_ID_CVS_MENU[] = "CVS.Menu";
const char CMD_ID_ADD[] = "CVS.Add";
const char CMD_ID_DELETE_FILE[] = "CVS.Delete";
@@ -228,7 +229,9 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
using namespace Constants;
using namespace Core::Constants;
- initializeVcs(new CvsControl(this));
+ Context context(CVS_CONTEXT);
+
+ initializeVcs(new CvsControl(this), context);
m_cvsPluginInstance = this;
@@ -271,13 +274,11 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
toolsContainer->addMenu(cvsMenu);
m_menuAction = cvsMenu->menu()->menuAction();
- Context globalcontext(C_GLOBAL);
-
Command *command;
m_diffCurrentAction = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_diffCurrentAction,
- CMD_ID_DIFF_CURRENT, globalcontext);
+ CMD_ID_DIFF_CURRENT, context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+D") : tr("Alt+C,Alt+D")));
connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
@@ -286,7 +287,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_filelogCurrentAction = new ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_filelogCurrentAction,
- CMD_ID_FILELOG_CURRENT, globalcontext);
+ CMD_ID_FILELOG_CURRENT, context);
command->setAttribute(Command::CA_UpdateText);
connect(m_filelogCurrentAction, SIGNAL(triggered()), this,
SLOT(filelogCurrentFile()));
@@ -295,18 +296,18 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_annotateCurrentAction = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_annotateCurrentAction,
- CMD_ID_ANNOTATE_CURRENT, globalcontext);
+ CMD_ID_ANNOTATE_CURRENT, context);
command->setAttribute(Command::CA_UpdateText);
connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
SLOT(annotateCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- cvsMenu->addSeparator(globalcontext);
+ cvsMenu->addSeparator(context);
m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_addAction, CMD_ID_ADD,
- globalcontext);
+ context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+A") : tr("Alt+C,Alt+A")));
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
@@ -315,7 +316,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commitCurrentAction = new ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_commitCurrentAction,
- CMD_ID_COMMIT_CURRENT, globalcontext);
+ CMD_ID_COMMIT_CURRENT, context);
command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+C") : tr("Alt+C,Alt+C")));
connect(m_commitCurrentAction, SIGNAL(triggered()), this, SLOT(startCommitCurrentFile()));
@@ -324,7 +325,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
- globalcontext);
+ context);
command->setAttribute(Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
cvsMenu->addAction(command);
@@ -332,39 +333,39 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_revertAction = new ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_revertAction, CMD_ID_REVERT,
- globalcontext);
+ context);
command->setAttribute(Command::CA_UpdateText);
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- cvsMenu->addSeparator(globalcontext);
+ cvsMenu->addSeparator(context);
m_editCurrentAction = new ParameterAction(tr("Edit"), tr("Edit \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, globalcontext);
+ command = ActionManager::registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, context);
command->setAttribute(Command::CA_UpdateText);
connect(m_editCurrentAction, SIGNAL(triggered()), this, SLOT(editCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_uneditCurrentAction = new ParameterAction(tr("Unedit"), tr("Unedit \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, globalcontext);
+ command = ActionManager::registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, context);
command->setAttribute(Command::CA_UpdateText);
connect(m_uneditCurrentAction, SIGNAL(triggered()), this, SLOT(uneditCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_uneditRepositoryAction = new QAction(tr("Unedit Repository"), this);
- command = ActionManager::registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, globalcontext);
+ command = ActionManager::registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, context);
connect(m_uneditRepositoryAction, SIGNAL(triggered()), this, SLOT(uneditCurrentRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- cvsMenu->addSeparator(globalcontext);
+ cvsMenu->addSeparator(context);
m_diffProjectAction = new ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
- globalcontext);
+ context);
command->setAttribute(Command::CA_UpdateText);
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject()));
cvsMenu->addAction(command);
@@ -372,69 +373,69 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_statusProjectAction = new ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS,
- globalcontext);
+ context);
command->setAttribute(Command::CA_UpdateText);
connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
+ command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, context);
command->setAttribute(Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_updateProjectAction = new ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext);
+ command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, context);
command->setAttribute(Command::CA_UpdateText);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_commitProjectAction = new ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, globalcontext);
+ command = ActionManager::registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, context);
command->setAttribute(Command::CA_UpdateText);
connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(commitProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
- cvsMenu->addSeparator(globalcontext);
+ cvsMenu->addSeparator(context);
m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
- command = ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext);
+ command = ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, context);
connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
- command = ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext);
+ command = ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, context);
connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_logRepositoryAction = new QAction(tr("Repository Log"), this);
- command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
+ command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, context);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_updateRepositoryAction = new QAction(tr("Update Repository"), this);
- command = ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext);
+ command = ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, context);
connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_commitAllAction = new QAction(tr("Commit All Files"), this);
command = ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
- globalcontext);
+ context);
connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
command = ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
- globalcontext);
+ context);
connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
diff --git a/src/plugins/git/gitconstants.h b/src/plugins/git/gitconstants.h
index e831858394..ccb2827709 100644
--- a/src/plugins/git/gitconstants.h
+++ b/src/plugins/git/gitconstants.h
@@ -47,6 +47,7 @@ const char GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git
const char GIT_REBASE_EDITOR_ID[] = "Git Rebase Editor";
const char GIT_REBASE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Rebase Editor");
+const char GIT_CONTEXT[] = "Git Context";
const char GITSUBMITEDITOR_ID[] = "Git Submit Editor";
const char GITSUBMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Submit Editor");
const char SUBMIT_CURRENT[] = "Git.SubmitCurrentLog";
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 52270ad0e7..547132b1c5 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -132,7 +132,6 @@ static GitPlugin *m_instance = 0;
GitPlugin::GitPlugin() :
m_commandLocator(0),
- m_gitContainer(0),
m_submitCurrentAction(0),
m_diffSelectedFilesAction(0),
m_undoAction(0),
@@ -271,13 +270,15 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
+ Context context(Constants::GIT_CONTEXT);
+
m_settings.readSettings(ICore::settings());
m_gitClient = new GitClient(&m_settings);
- initializeVcs(new GitVersionControl(m_gitClient));
+ initializeVcs(new GitVersionControl(m_gitClient), context);
- // Create the globalcontext list to register actions accordingly
+ // Create the contexts to register actions accordingly
Context globalcontext(Core::Constants::C_GLOBAL);
// Create the settings Page
@@ -309,44 +310,44 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
//register actions
ActionContainer *toolsContainer = ActionManager::actionContainer(Core::Constants::M_TOOLS);
- m_gitContainer = ActionManager::createMenu("Git");
- m_gitContainer->menu()->setTitle(tr("&Git"));
- toolsContainer->addMenu(m_gitContainer);
- m_menuAction = m_gitContainer->menu()->menuAction();
+ Core::ActionContainer *gitContainer = ActionManager::createMenu("Git");
+ gitContainer->menu()->setTitle(tr("&Git"));
+ toolsContainer->addMenu(gitContainer);
+ m_menuAction = gitContainer->menu()->menuAction();
/* "Current File" menu */
ActionContainer *currentFileMenu = ActionManager::createMenu("Git.CurrentFileMenu");
currentFileMenu->menu()->setTitle(tr("Current &File"));
- m_gitContainer->addMenu(currentFileMenu);
+ gitContainer->addMenu(currentFileMenu);
createFileAction(currentFileMenu, tr("Diff Current File"), tr("Diff of \"%1\""),
- "Git.Diff", globalcontext, true, SLOT(diffCurrentFile()),
+ "Git.Diff", context, true, SLOT(diffCurrentFile()),
QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+D") : tr("Alt+G,Alt+D")));
createFileAction(currentFileMenu, tr("Log Current File"), tr("Log of \"%1\""),
- "Git.Log", globalcontext, true, SLOT(logFile()),
+ "Git.Log", context, true, SLOT(logFile()),
QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+L") : tr("Alt+G,Alt+L")));
createFileAction(currentFileMenu, tr("Blame Current File"), tr("Blame for \"%1\""),
- "Git.Blame", globalcontext, true, SLOT(blameFile()),
+ "Git.Blame", context, true, SLOT(blameFile()),
QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+B") : tr("Alt+G,Alt+B")));
- currentFileMenu->addSeparator(globalcontext);
+ currentFileMenu->addSeparator(context);
createFileAction(currentFileMenu, tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"),
- "Git.Stage", globalcontext, true, SLOT(stageFile()),
+ "Git.Stage", context, true, SLOT(stageFile()),
QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+A") : tr("Alt+G,Alt+A")));
createFileAction(currentFileMenu, tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"),
- "Git.Unstage", globalcontext, true, SLOT(unstageFile()));
+ "Git.Unstage", context, true, SLOT(unstageFile()));
createFileAction(currentFileMenu, tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
- "Git.UndoUnstaged", globalcontext,
+ "Git.UndoUnstaged", context,
true, SLOT(undoUnstagedFileChanges()));
createFileAction(currentFileMenu, tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
- "Git.Undo", globalcontext,
+ "Git.Undo", context,
true, SLOT(undoFileChanges()),
QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+U") : tr("Alt+G,Alt+U")));
@@ -354,118 +355,118 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
/* "Current Project" menu */
ActionContainer *currentProjectMenu = ActionManager::createMenu("Git.CurrentProjectMenu");
currentProjectMenu->menu()->setTitle(tr("Current &Project"));
- m_gitContainer->addMenu(currentProjectMenu);
+ gitContainer->addMenu(currentProjectMenu);
createProjectAction(currentProjectMenu, tr("Diff Current Project"), tr("Diff Project \"%1\""),
- "Git.DiffProject", globalcontext, true, SLOT(diffCurrentProject()),
+ "Git.DiffProject", context, true, SLOT(diffCurrentProject()),
QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+Shift+D") : tr("Alt+G,Alt+Shift+D")));
createProjectAction(currentProjectMenu, tr("Log Project"), tr("Log Project \"%1\""),
- "Git.LogProject", globalcontext, true, SLOT(logProject()),
+ "Git.LogProject", context, true, SLOT(logProject()),
QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+K") : tr("Alt+G,Alt+K")));
createProjectAction(currentProjectMenu, tr("Clean Project..."), tr("Clean Project \"%1\"..."),
- "Git.CleanProject", globalcontext, true, SLOT(cleanProject()));
+ "Git.CleanProject", context, true, SLOT(cleanProject()));
/* "Local Repository" menu */
ActionContainer *localRepositoryMenu = ActionManager::createMenu("Git.LocalRepositoryMenu");
localRepositoryMenu->menu()->setTitle(tr("&Local Repository"));
- m_gitContainer->addMenu(localRepositoryMenu);
+ gitContainer->addMenu(localRepositoryMenu);
createRepositoryAction(localRepositoryMenu, tr("Diff"), "Git.DiffRepository",
- globalcontext, true, SLOT(diffRepository()));
+ context, true, SLOT(diffRepository()));
createRepositoryAction(localRepositoryMenu, tr("Log"), "Git.LogRepository",
- globalcontext, true,
+ context, true,
SLOT(logRepository()));
createRepositoryAction(localRepositoryMenu, tr("Reflog"), "Git.ReflogRepository",
- globalcontext, true,
+ context, true,
SLOT(reflogRepository()));
createRepositoryAction(localRepositoryMenu, tr("Clean..."), "Git.CleanRepository",
- globalcontext, true, SLOT(cleanRepository()));
+ context, true, SLOT(cleanRepository()));
createRepositoryAction(localRepositoryMenu, tr("Status"), "Git.StatusRepository",
- globalcontext, true, &GitClient::status);
+ context, true, &GitClient::status);
// --------------
- localRepositoryMenu->addSeparator(globalcontext);
+ localRepositoryMenu->addSeparator(context);
createRepositoryAction(localRepositoryMenu, tr("Commit..."), "Git.Commit",
- globalcontext, true, SLOT(startCommit()),
+ context, true, SLOT(startCommit()),
QKeySequence(UseMacShortcuts ? tr("Meta+G,Meta+C") : tr("Alt+G,Alt+C")));
createRepositoryAction(localRepositoryMenu,
tr("Amend Last Commit..."), "Git.AmendCommit",
- globalcontext, true, SLOT(startAmendCommit()));
+ context, true, SLOT(startAmendCommit()));
m_fixupCommitAction =
createRepositoryAction(localRepositoryMenu,
tr("Fixup Previous Commit..."), "Git.FixupCommit",
- globalcontext, true, SLOT(startFixupCommit()));
+ context, true, SLOT(startFixupCommit()));
// --------------
- localRepositoryMenu->addSeparator(globalcontext);
+ localRepositoryMenu->addSeparator(context);
createRepositoryAction(localRepositoryMenu,
tr("Reset..."), "Git.Reset",
- globalcontext, true, SLOT(resetRepository()));
+ context, true, SLOT(resetRepository()));
m_interactiveRebaseAction =
createRepositoryAction(localRepositoryMenu,
tr("Interactive Rebase..."), "Git.InteractiveRebase",
- globalcontext, true, SLOT(startRebase()));
+ context, true, SLOT(startRebase()));
m_submoduleUpdateAction =
createRepositoryAction(localRepositoryMenu,
tr("Update Submodules"), "Git.SubmoduleUpdate",
- globalcontext, true, SLOT(updateSubmodules()));
+ context, true, SLOT(updateSubmodules()));
m_abortMergeAction =
createRepositoryAction(localRepositoryMenu,
tr("Abort Merge"), "Git.MergeAbort",
- globalcontext, true, SLOT(continueOrAbortCommand()));
+ context, true, SLOT(continueOrAbortCommand()));
m_abortRebaseAction =
createRepositoryAction(localRepositoryMenu,
tr("Abort Rebase"), "Git.RebaseAbort",
- globalcontext, true, SLOT(continueOrAbortCommand()));
+ context, true, SLOT(continueOrAbortCommand()));
m_abortCherryPickAction =
createRepositoryAction(localRepositoryMenu,
tr("Abort Cherry Pick"), "Git.CherryPickAbort",
- globalcontext, true, SLOT(continueOrAbortCommand()));
+ context, true, SLOT(continueOrAbortCommand()));
m_abortRevertAction =
createRepositoryAction(localRepositoryMenu,
tr("Abort Revert"), "Git.RevertAbort",
- globalcontext, true, SLOT(continueOrAbortCommand()));
+ context, true, SLOT(continueOrAbortCommand()));
m_continueRebaseAction =
createRepositoryAction(localRepositoryMenu,
tr("Continue Rebase"), "Git.RebaseContinue",
- globalcontext, true, SLOT(continueOrAbortCommand()));
+ context, true, SLOT(continueOrAbortCommand()));
m_continueCherryPickAction =
createRepositoryAction(localRepositoryMenu,
tr("Continue Cherry Pick"), "Git.CherryPickContinue",
- globalcontext, true, SLOT(continueOrAbortCommand()));
+ context, true, SLOT(continueOrAbortCommand()));
m_continueRevertAction =
createRepositoryAction(localRepositoryMenu,
tr("Continue Revert"), "Git.RevertContinue",
- globalcontext, true, SLOT(continueOrAbortCommand()));
+ context, true, SLOT(continueOrAbortCommand()));
// --------------
- localRepositoryMenu->addSeparator(globalcontext);
+ localRepositoryMenu->addSeparator(context);
createRepositoryAction(localRepositoryMenu,
tr("Branches..."), "Git.BranchList",
- globalcontext, true, SLOT(branchList()));
+ context, true, SLOT(branchList()));
// --------------
- localRepositoryMenu->addSeparator(globalcontext);
+ localRepositoryMenu->addSeparator(context);
// "Patch" menu
ActionContainer *patchMenu = ActionManager::createMenu("Git.PatchMenu");
@@ -477,14 +478,14 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
createParameterAction(patchMenu,
tr("Apply from Editor"), tr("Apply \"%1\""),
"Git.ApplyCurrentFilePatch",
- globalcontext, true);
+ context, true);
connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this,
SLOT(applyCurrentFilePatch()));
createRepositoryAction(patchMenu,
tr("Apply from File..."), "Git.ApplyPatch",
- globalcontext, true, SLOT(promptApplyPatch()));
+ context, true, SLOT(promptApplyPatch()));
// "Stash" menu
ActionContainer *stashMenu = ActionManager::createMenu("Git.StashMenu");
@@ -493,22 +494,22 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
createRepositoryAction(stashMenu,
tr("Stashes..."), "Git.StashList",
- globalcontext, false, SLOT(stashList()));
+ context, false, SLOT(stashList()));
- stashMenu->addSeparator(globalcontext);
+ stashMenu->addSeparator(context);
QAction *action = createRepositoryAction(stashMenu, tr("Stash"), "Git.Stash",
- globalcontext, true, SLOT(stash()));
+ context, true, SLOT(stash()));
action->setToolTip(tr("Saves the current state of your work and resets the repository."));
action = createRepositoryAction(stashMenu, tr("Take Snapshot..."), "Git.StashSnapshot",
- globalcontext, true, SLOT(stashSnapshot()));
+ context, true, SLOT(stashSnapshot()));
action->setToolTip(tr("Saves the current state of your work."));
- stashMenu->addSeparator(globalcontext);
+ stashMenu->addSeparator(context);
action = createRepositoryAction(stashMenu, tr("Stash Pop"), "Git.StashPop",
- globalcontext, true, &GitClient::stashPop);
+ context, true, &GitClient::stashPop);
action->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
@@ -519,19 +520,19 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
/* "Remote Repository" menu */
ActionContainer *remoteRepositoryMenu = ActionManager::createMenu("Git.RemoteRepositoryMenu");
remoteRepositoryMenu->menu()->setTitle(tr("&Remote Repository"));
- m_gitContainer->addMenu(remoteRepositoryMenu);
+ gitContainer->addMenu(remoteRepositoryMenu);
createRepositoryAction(remoteRepositoryMenu, tr("Fetch"), "Git.Fetch",
- globalcontext, true, SLOT(fetch()));
+ context, true, SLOT(fetch()));
createRepositoryAction(remoteRepositoryMenu, tr("Pull"), "Git.Pull",
- globalcontext, true, SLOT(pull()));
+ context, true, SLOT(pull()));
createRepositoryAction(remoteRepositoryMenu, tr("Push"), "Git.Push",
- globalcontext, true, SLOT(push()));
+ context, true, SLOT(push()));
// --------------
- remoteRepositoryMenu->addSeparator(globalcontext);
+ remoteRepositoryMenu->addSeparator(context);
// "Subversion" menu
ActionContainer *subversionMenu = ActionManager::createMenu("Git.Subversion");
@@ -540,18 +541,18 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
createRepositoryAction(subversionMenu,
tr("Log"), "Git.Subversion.Log",
- globalcontext, false, &GitClient::subversionLog);
+ context, false, &GitClient::subversionLog);
createRepositoryAction(subversionMenu,
tr("Fetch"), "Git.Subversion.Fetch",
- globalcontext, false, &GitClient::synchronousSubversionFetch);
+ context, false, &GitClient::synchronousSubversionFetch);
// --------------
- remoteRepositoryMenu->addSeparator(globalcontext);
+ remoteRepositoryMenu->addSeparator(context);
createRepositoryAction(remoteRepositoryMenu,
tr("Manage Remotes..."), "Git.RemoteList",
- globalcontext, false, SLOT(remoteList()));
+ context, false, SLOT(remoteList()));
/* \"Remote Repository" menu */
@@ -559,22 +560,22 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
/* Actions only in locator */
createRepositoryAction(0, tr("Show..."), "Git.Show",
- globalcontext, true, SLOT(startChangeRelatedAction()));
+ context, true, SLOT(startChangeRelatedAction()));
createRepositoryAction(0, tr("Revert..."), "Git.Revert",
- globalcontext, true, SLOT(startChangeRelatedAction()));
+ context, true, SLOT(startChangeRelatedAction()));
createRepositoryAction(0, tr("Cherry Pick..."), "Git.CherryPick",
- globalcontext, true, SLOT(startChangeRelatedAction()));
+ context, true, SLOT(startChangeRelatedAction()));
createRepositoryAction(0, tr("Checkout..."), "Git.Checkout",
- globalcontext, true, SLOT(startChangeRelatedAction()));
+ context, true, SLOT(startChangeRelatedAction()));
createRepositoryAction(0, tr("Rebase..."), "Git.Rebase",
- globalcontext, true, SLOT(branchList()));
+ context, true, SLOT(branchList()));
createRepositoryAction(0, tr("Merge..."), "Git.Merge",
- globalcontext, true, SLOT(branchList()));
+ context, true, SLOT(branchList()));
/* \Actions only in locator */
@@ -583,50 +584,50 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
/* "Git Tools" menu */
ActionContainer *gitToolsMenu = ActionManager::createMenu("Git.GitToolsMenu");
gitToolsMenu->menu()->setTitle(tr("Git &Tools"));
- m_gitContainer->addMenu(gitToolsMenu);
+ gitContainer->addMenu(gitToolsMenu);
createRepositoryAction(gitToolsMenu,
tr("Gitk"), "Git.LaunchGitK",
- globalcontext, true, &GitClient::launchGitK);
+ context, true, &GitClient::launchGitK);
createFileAction(gitToolsMenu, tr("Gitk Current File"), tr("Gitk of \"%1\""),
- "Git.GitkFile", globalcontext, true, SLOT(gitkForCurrentFile()));
+ "Git.GitkFile", context, true, SLOT(gitkForCurrentFile()));
createFileAction(gitToolsMenu, tr("Gitk for folder of Current File"), tr("Gitk for folder of \"%1\""),
- "Git.GitkFolder", globalcontext, true, SLOT(gitkForCurrentFolder()));
+ "Git.GitkFolder", context, true, SLOT(gitkForCurrentFolder()));
// --------------
- gitToolsMenu->addSeparator(globalcontext);
+ gitToolsMenu->addSeparator(context);
createRepositoryAction(gitToolsMenu, tr("Git Gui"), "Git.GitGui",
- globalcontext, true, SLOT(gitGui()));
+ context, true, SLOT(gitGui()));
// --------------
- gitToolsMenu->addSeparator(globalcontext);
+ gitToolsMenu->addSeparator(context);
m_repositoryBrowserAction =
createRepositoryAction(gitToolsMenu,
tr("Repository Browser"), "Git.LaunchRepositoryBrowser",
- globalcontext, true, &GitClient::launchRepositoryBrowser);
+ context, true, &GitClient::launchRepositoryBrowser);
m_mergeToolAction =
createRepositoryAction(gitToolsMenu,
tr("Merge Tool"), "Git.MergeTool",
- globalcontext, true, SLOT(startMergeTool()));
+ context, true, SLOT(startMergeTool()));
/* \"Git Tools" menu */
// --------------
- m_gitContainer->addSeparator(globalcontext);
+ gitContainer->addSeparator(context);
- createRepositoryAction(m_gitContainer, tr("Actions on Commits..."), "Git.ChangeActions",
- globalcontext, false, SLOT(startChangeRelatedAction()));
+ createRepositoryAction(gitContainer, tr("Actions on Commits..."), "Git.ChangeActions",
+ context, false, SLOT(startChangeRelatedAction()));
m_createRepositryAction = new QAction(tr("Create Repository..."), this);
Core::Command *createRepositoryCommand = ActionManager::registerAction(
m_createRepositryAction, "Git.CreateRepository", globalcontext);
connect(m_createRepositryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
- m_gitContainer->addAction(createRepositoryCommand);
+ gitContainer->addAction(createRepositoryCommand);
// Submit editor
Context submitContext(Constants::GITSUBMITEDITOR_ID);
@@ -1326,7 +1327,6 @@ void GitPlugin::updateActions(VcsBasePlugin::ActionState as)
m_remoteDialog->refresh(currentState().topLevel(), false);
m_commandLocator->setEnabled(repositoryEnabled);
- m_gitContainer->setEnabled(repositoryEnabled);
m_createRepositryAction->setEnabled(true);
if (!enableMenuAction(as, m_menuAction))
return;
diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h
index e10e2e5c85..ba0cc266d3 100644
--- a/src/plugins/git/gitplugin.h
+++ b/src/plugins/git/gitplugin.h
@@ -199,7 +199,6 @@ private:
void updateVersionWarning();
Core::CommandLocator *m_commandLocator;
- Core::ActionContainer *m_gitContainer;
QAction *m_submitCurrentAction;
QAction *m_diffSelectedFilesAction;
diff --git a/src/plugins/mercurial/constants.h b/src/plugins/mercurial/constants.h
index 80d1deefe3..fbc682725f 100644
--- a/src/plugins/mercurial/constants.h
+++ b/src/plugins/mercurial/constants.h
@@ -37,6 +37,7 @@ namespace Constants {
enum { debug = 0 };
const char MERCURIALREPO[] = ".hg";
const char MERCURIALDEFAULT[] = "hg";
+const char MERCURIAL_CONTEXT[] = "Mercurial Context";
// Changeset identifiers
const char CHANGESETID12[] = " ([a-f0-9]{12,12}) "; //match 12 hex chars and capture
diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp
index 863232c2b6..5b57e492c3 100644
--- a/src/plugins/mercurial/mercurialplugin.cpp
+++ b/src/plugins/mercurial/mercurialplugin.cpp
@@ -133,8 +133,10 @@ MercurialPlugin::~MercurialPlugin()
bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * /*errorMessage */)
{
+ Core::Context context(Constants::MERCURIAL_CONTEXT);
+
m_client = new MercurialClient(&mercurialSettings);
- initializeVcs(new MercurialControl(m_client));
+ initializeVcs(new MercurialControl(m_client), context);
optionsPage = new OptionsPage();
addAutoReleasedObject(optionsPage);
@@ -166,7 +168,7 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
m_commandLocator = new Core::CommandLocator("Mercurial", prefix, prefix);
addAutoReleasedObject(m_commandLocator);
- createMenu();
+ createMenu(context);
createSubmitEditorActions();
@@ -186,10 +188,8 @@ void MercurialPlugin::setSettings(const MercurialSettings &settings)
}
}
-void MercurialPlugin::createMenu()
+void MercurialPlugin::createMenu(const Core::Context &context)
{
- Core::Context context(Core::Constants::C_GLOBAL);
-
// Create menu item for Mercurial
m_mercurialContainer = Core::ActionManager::createMenu("Mercurial.MercurialMenu");
QMenu *menu = m_mercurialContainer->menu();
@@ -659,13 +659,11 @@ void MercurialPlugin::createRepositoryManagementActions(const Core::Context &con
void MercurialPlugin::updateActions(VcsBasePlugin::ActionState as)
{
if (!enableMenuAction(as, m_menuAction)) {
- m_mercurialContainer->setEnabled(false);
m_commandLocator->setEnabled(false);
return;
}
const QString filename = currentState().currentFileName();
const bool repoEnabled = currentState().hasTopLevel();
- m_mercurialContainer->setEnabled(repoEnabled);
m_commandLocator->setEnabled(repoEnabled);
annotateFile->setParameter(filename);
diff --git a/src/plugins/mercurial/mercurialplugin.h b/src/plugins/mercurial/mercurialplugin.h
index 5fc4edf017..2716186b9e 100644
--- a/src/plugins/mercurial/mercurialplugin.h
+++ b/src/plugins/mercurial/mercurialplugin.h
@@ -129,7 +129,7 @@ protected:
bool submitEditorAboutToClose();
private:
- void createMenu();
+ void createMenu(const Core::Context &context);
void createSubmitEditorActions();
void createFileActions(const Core::Context &context);
void createDirectoryActions(const Core::Context &context);
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index c20856c332..5525e95db3 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -83,6 +83,7 @@ const char SUBMIT_CURRENT[] = "Perforce.SubmitCurrentLog";
const char DIFF_SELECTED[] = "Perforce.DiffSelectedFilesInLog";
const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.p4.submit";
+const char PERFORCE_CONTEXT[] = "Perforce Context";
const char PERFORCE_SUBMIT_EDITOR_ID[] = "Perforce.SubmitEditor";
const char PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Perforce.SubmitEditor");
@@ -182,7 +183,6 @@ PerforcePlugin *PerforcePlugin::m_instance = NULL;
PerforcePlugin::PerforcePlugin() :
m_commandLocator(0),
- m_perforceContainer(0),
m_editAction(0),
m_addAction(0),
m_deleteAction(0),
@@ -221,7 +221,9 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage)
{
- initializeVcs(new PerforceVersionControl(this));
+ Context context(PERFORCE_CONTEXT);
+
+ initializeVcs(new PerforceVersionControl(this), context);
if (!MimeDatabase::addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage))
return false;
@@ -247,177 +249,176 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
- m_perforceContainer = ActionManager::createMenu(CMD_ID_PERFORCE_MENU);
- m_perforceContainer->menu()->setTitle(tr("&Perforce"));
- mtools->addMenu(m_perforceContainer);
- m_menuAction = m_perforceContainer->menu()->menuAction();
+ Core::ActionContainer *perforceContainer = ActionManager::createMenu(CMD_ID_PERFORCE_MENU);
+ perforceContainer->menu()->setTitle(tr("&Perforce"));
+ mtools->addMenu(perforceContainer);
+ m_menuAction = perforceContainer->menu()->menuAction();
- Context globalcontext(Core::Constants::C_GLOBAL);
Context perforcesubmitcontext(PERFORCE_SUBMIT_EDITOR_ID);
Core::Command *command;
m_diffFileAction = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, globalcontext);
+ command = ActionManager::registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Diff Current File"));
connect(m_diffFileAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_annotateCurrentAction = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext);
+ command = ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Annotate Current File"));
connect(m_annotateCurrentAction, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_filelogCurrentAction = new ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext);
+ command = ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+F") : tr("Alt+P,Alt+F")));
command->setDescription(tr("Filelog Current File"));
connect(m_filelogCurrentAction, SIGNAL(triggered()), this, SLOT(filelogCurrentFile()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_perforceContainer->addSeparator(globalcontext);
+ perforceContainer->addSeparator(context);
m_editAction = new ParameterAction(tr("Edit"), tr("Edit \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_editAction, CMD_ID_EDIT, globalcontext);
+ command = ActionManager::registerAction(m_editAction, CMD_ID_EDIT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+E") : tr("Alt+P,Alt+E")));
command->setDescription(tr("Edit File"));
connect(m_editAction, SIGNAL(triggered()), this, SLOT(openCurrentFile()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_addAction, CMD_ID_ADD, globalcontext);
+ command = ActionManager::registerAction(m_addAction, CMD_ID_ADD, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+A") : tr("Alt+P,Alt+A")));
command->setDescription(tr("Add File"));
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext);
+ command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Delete File"));
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_revertFileAction = new ParameterAction(tr("Revert"), tr("Revert \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_revertFileAction, CMD_ID_REVERT, globalcontext);
+ command = ActionManager::registerAction(m_revertFileAction, CMD_ID_REVERT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+R") : tr("Alt+P,Alt+R")));
command->setDescription(tr("Revert File"));
connect(m_revertFileAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_perforceContainer->addSeparator(globalcontext);
+ perforceContainer->addSeparator(context);
const QString diffProjectDefaultText = tr("Diff Current Project/Session");
m_diffProjectAction = new ParameterAction(diffProjectDefaultText, tr("Diff Project \"%1\""), ParameterAction::AlwaysEnabled, this);
- command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext);
+ command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+D") : tr("Alt+P,Alt+D")));
command->setDescription(diffProjectDefaultText);
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffCurrentProject()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
+ command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_submitProjectAction = new ParameterAction(tr("Submit Project"), tr("Submit Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_submitProjectAction, CMD_ID_SUBMIT, globalcontext);
+ command = ActionManager::registerAction(m_submitProjectAction, CMD_ID_SUBMIT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+S") : tr("Alt+P,Alt+S")));
connect(m_submitProjectAction, SIGNAL(triggered()), this, SLOT(startSubmitProject()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
const QString updateProjectDefaultText = tr("Update Current Project");
m_updateProjectAction = new ParameterAction(updateProjectDefaultText, tr("Update Project \"%1\""), ParameterAction::AlwaysEnabled, this);
- command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, globalcontext);
+ command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, context);
command->setDescription(updateProjectDefaultText);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateCurrentProject()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_revertUnchangedAction = new ParameterAction(tr("Revert Unchanged"), tr("Revert Unchanged Files of Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, globalcontext);
+ command = ActionManager::registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertUnchangedAction, SIGNAL(triggered()), this, SLOT(revertUnchangedCurrentProject()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_revertProjectAction = new ParameterAction(tr("Revert Project"), tr("Revert Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, globalcontext);
+ command = ActionManager::registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertProjectAction, SIGNAL(triggered()), this, SLOT(revertCurrentProject()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_perforceContainer->addSeparator(globalcontext);
+ perforceContainer->addSeparator(context);
m_diffAllAction = new QAction(tr("Diff Opened Files"), this);
- command = ActionManager::registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, globalcontext);
+ command = ActionManager::registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, context);
connect(m_diffAllAction, SIGNAL(triggered()), this, SLOT(diffAllOpened()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_openedAction = new QAction(tr("Opened"), this);
- command = ActionManager::registerAction(m_openedAction, CMD_ID_OPENED, globalcontext);
+ command = ActionManager::registerAction(m_openedAction, CMD_ID_OPENED, context);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+P,Meta+O") : tr("Alt+P,Alt+O")));
connect(m_openedAction, SIGNAL(triggered()), this, SLOT(printOpenedFileList()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_logRepositoryAction = new QAction(tr("Repository Log"), this);
- command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
+ command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, context);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_pendingAction = new QAction(tr("Pending Changes..."), this);
- command = ActionManager::registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, globalcontext);
+ command = ActionManager::registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, context);
connect(m_pendingAction, SIGNAL(triggered()), this, SLOT(printPendingChanges()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_updateAllAction = new QAction(tr("Update All"), this);
- command = ActionManager::registerAction(m_updateAllAction, CMD_ID_UPDATEALL, globalcontext);
+ command = ActionManager::registerAction(m_updateAllAction, CMD_ID_UPDATEALL, context);
connect(m_updateAllAction, SIGNAL(triggered()), this, SLOT(updateAll()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_commandLocator->appendCommand(command);
- m_perforceContainer->addSeparator(globalcontext);
+ perforceContainer->addSeparator(context);
m_describeAction = new QAction(tr("Describe..."), this);
- command = ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext);
+ command = ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, context);
connect(m_describeAction, SIGNAL(triggered()), this, SLOT(describeChange()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_annotateAction = new QAction(tr("Annotate..."), this);
- command = ActionManager::registerAction(m_annotateAction, CMD_ID_ANNOTATE, globalcontext);
+ command = ActionManager::registerAction(m_annotateAction, CMD_ID_ANNOTATE, context);
connect(m_annotateAction, SIGNAL(triggered()), this, SLOT(annotate()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_filelogAction = new QAction(tr("Filelog..."), this);
- command = ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, globalcontext);
+ command = ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, context);
connect(m_filelogAction, SIGNAL(triggered()), this, SLOT(filelog()));
- m_perforceContainer->addAction(command);
+ perforceContainer->addAction(command);
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Submit"), this);
command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, perforcesubmitcontext);
@@ -796,7 +797,6 @@ void PerforcePlugin::updateActions(VcsBasePlugin::ActionState as)
{
const bool menuActionEnabled = enableMenuAction(as, m_menuAction);
const bool enableActions = currentState().hasTopLevel() && menuActionEnabled;
- m_perforceContainer->setEnabled(enableActions);
m_commandLocator->setEnabled(enableActions);
if (!menuActionEnabled)
return;
diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h
index 37291f310e..6bd8f65cd5 100644
--- a/src/plugins/perforce/perforceplugin.h
+++ b/src/plugins/perforce/perforceplugin.h
@@ -207,7 +207,6 @@ private:
static PerforceVersionControl *perforceVersionControl();
Core::CommandLocator *m_commandLocator;
- Core::ActionContainer *m_perforceContainer;
Utils::ParameterAction *m_editAction;
Utils::ParameterAction *m_addAction;
Utils::ParameterAction *m_deleteAction;
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 98e750af1a..2f2b0b30ff 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -92,6 +92,7 @@ using namespace VcsBase;
namespace Subversion {
namespace Internal {
+const char SUBVERSION_CONTEXT[] = "Subversion Context";
const char CMD_ID_SUBVERSION_MENU[] = "Subversion.Menu";
const char CMD_ID_ADD[] = "Subversion.Add";
const char CMD_ID_DELETE_FILE[] = "Subversion.Delete";
@@ -246,7 +247,9 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
using namespace Constants;
using namespace Core::Constants;
- initializeVcs(new SubversionControl(this));
+ Context context(SUBVERSION_CONTEXT);
+
+ initializeVcs(new SubversionControl(this), context);
m_subversionPluginInstance = this;
@@ -288,12 +291,11 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
subversionMenu->menu()->setTitle(tr("&Subversion"));
toolsContainer->addMenu(subversionMenu);
m_menuAction = subversionMenu->menu()->menuAction();
- Context globalcontext(C_GLOBAL);
Core::Command *command;
m_diffCurrentAction = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_diffCurrentAction,
- CMD_ID_DIFF_CURRENT, globalcontext);
+ CMD_ID_DIFF_CURRENT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+S,Meta+D") : tr("Alt+S,Alt+D")));
connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
@@ -302,7 +304,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_filelogCurrentAction = new ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_filelogCurrentAction,
- CMD_ID_FILELOG_CURRENT, globalcontext);
+ CMD_ID_FILELOG_CURRENT, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_filelogCurrentAction, SIGNAL(triggered()), this,
SLOT(filelogCurrentFile()));
@@ -311,18 +313,18 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_annotateCurrentAction = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_annotateCurrentAction,
- CMD_ID_ANNOTATE_CURRENT, globalcontext);
+ CMD_ID_ANNOTATE_CURRENT, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
SLOT(annotateCurrentFile()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
- subversionMenu->addSeparator(globalcontext);
+ subversionMenu->addSeparator(context);
m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_addAction, CMD_ID_ADD,
- globalcontext);
+ context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+S,Meta+A") : tr("Alt+S,Alt+A")));
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
@@ -331,7 +333,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commitCurrentAction = new ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_commitCurrentAction,
- CMD_ID_COMMIT_CURRENT, globalcontext);
+ CMD_ID_COMMIT_CURRENT, context);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+S,Meta+C") : tr("Alt+S,Alt+C")));
connect(m_commitCurrentAction, SIGNAL(triggered()), this, SLOT(startCommitCurrentFile()));
@@ -340,7 +342,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
- globalcontext);
+ context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
subversionMenu->addAction(command);
@@ -348,17 +350,17 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_revertAction = new ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_revertAction, CMD_ID_REVERT,
- globalcontext);
+ context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
- subversionMenu->addSeparator(globalcontext);
+ subversionMenu->addSeparator(context);
m_diffProjectAction = new ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
- globalcontext);
+ context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject()));
subversionMenu->addAction(command);
@@ -366,74 +368,74 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_statusProjectAction = new ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), ParameterAction::EnabledWithParameter, this);
command = ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS,
- globalcontext);
+ context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_logProjectAction = new ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
+ command = ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_updateProjectAction = new ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext);
+ command = ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, context);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject()));
command->setAttribute(Core::Command::CA_UpdateText);
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_commitProjectAction = new ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), ParameterAction::EnabledWithParameter, this);
- command = ActionManager::registerAction(m_commitProjectAction, CMD_ID_COMMIT_PROJECT, globalcontext);
+ command = ActionManager::registerAction(m_commitProjectAction, CMD_ID_COMMIT_PROJECT, context);
connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(startCommitProject()));
command->setAttribute(Core::Command::CA_UpdateText);
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
- subversionMenu->addSeparator(globalcontext);
+ subversionMenu->addSeparator(context);
m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
- command = ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext);
+ command = ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, context);
connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
- command = ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext);
+ command = ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, context);
connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_logRepositoryAction = new QAction(tr("Log Repository"), this);
- command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
+ command = ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, context);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_updateRepositoryAction = new QAction(tr("Update Repository"), this);
- command = ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext);
+ command = ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, context);
connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_commitAllAction = new QAction(tr("Commit All Files"), this);
command = ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
- globalcontext);
+ context);
connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_describeAction = new QAction(tr("Describe..."), this);
- command = ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext);
+ command = ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, context);
connect(m_describeAction, SIGNAL(triggered()), this, SLOT(slotDescribe()));
subversionMenu->addAction(command);
m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
command = ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
- globalcontext);
+ context);
connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll()));
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp
index 2dcae7c161..6a2662873a 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.cpp
+++ b/src/plugins/vcsbase/vcsbaseplugin.cpp
@@ -529,6 +529,7 @@ public:
QPointer<VcsBaseSubmitEditor> m_submitEditor;
Core::IVersionControl *m_versionControl;
+ Core::Context m_context;
VcsBasePluginState m_state;
int m_actionState;
@@ -558,9 +559,10 @@ VcsBasePlugin::~VcsBasePlugin()
delete d;
}
-void VcsBasePlugin::initializeVcs(Core::IVersionControl *vc)
+void VcsBasePlugin::initializeVcs(Core::IVersionControl *vc, const Core::Context &context)
{
d->m_versionControl = vc;
+ d->m_context = context;
addAutoReleasedObject(vc);
Internal::VcsPlugin *plugin = Internal::VcsPlugin::instance();
@@ -609,6 +611,7 @@ void VcsBasePlugin::slotStateChanged(const VcsBase::Internal::State &newInternal
if (!d->m_state.equals(newInternalState)) {
d->m_state.setState(newInternalState);
updateActions(VcsEnabled);
+ Core::ICore::addAdditionalContext(d->m_context);
}
} else {
// Some other VCS plugin or state changed: Reset us to empty state.
@@ -619,6 +622,7 @@ void VcsBasePlugin::slotStateChanged(const VcsBase::Internal::State &newInternal
d->m_state = emptyState;
updateActions(newActionState);
}
+ Core::ICore::removeAdditionalContext(d->m_context);
}
}
diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h
index ecc32534b7..789a953250 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.h
+++ b/src/plugins/vcsbase/vcsbaseplugin.h
@@ -48,6 +48,7 @@ QT_END_NAMESPACE
namespace Utils { struct SynchronousProcessResponse; }
namespace Core {
+class Context;
class IVersionControl;
class Id;
class IDocument;
@@ -131,7 +132,7 @@ class VCSBASE_EXPORT VcsBasePlugin : public ExtensionSystem::IPlugin
protected:
explicit VcsBasePlugin();
- void initializeVcs(Core::IVersionControl *vc);
+ void initializeVcs(Core::IVersionControl *vc, const Core::Context &context);
virtual void extensionsInitialized();
public: