Fix that editor actions were enabled when help window is active

The editor manager actions should not be enabled just because the main
window is in edit/debug/analyze mode. Instead the corresponding mode
must have focus.
Otherwise they will be enabled even if extra windows that do not have
editors (like the extra help window, which is e.g. used for
the example documentation) are active.

Change-Id: Id1bf3cc4d1a761ef7ea8a275701f78626ff44533
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
Eike Ziller
2014-07-01 13:20:53 +02:00
parent 5b3bb398ba
commit 8a63420d03
3 changed files with 18 additions and 5 deletions

View File

@@ -98,7 +98,7 @@ public:
AnalyzerMode(QObject *parent = 0)
: IMode(parent)
{
setContext(Context(C_EDITORMANAGER, C_ANALYZEMODE, C_NAVIGATION_PANE));
setContext(Context(C_ANALYZEMODE, C_NAVIGATION_PANE));
setDisplayName(tr("Analyze"));
setIcon(QIcon(QLatin1String(":/images/analyzer_mode.png")));
setPriority(P_MODE_ANALYZE);
@@ -279,6 +279,10 @@ void AnalyzerManagerPrivate::delayedInit()
splitter->addWidget(mainWindowSplitter);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
Core::IContext *modeContextObject = new Core::IContext(this);
modeContextObject->setContext(Core::Context(Core::Constants::C_EDITORMANAGER));
modeContextObject->setWidget(splitter);
Core::ICore::addContextObject(modeContextObject);
m_mode->setWidget(splitter);
AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode);

View File

@@ -27,12 +27,13 @@
**
****************************************************************************/
#include "editmode.h"
#include "coreconstants.h"
#include "editmode.h"
#include "icore.h"
#include "modemanager.h"
#include "minisplitter.h"
#include "outputpane.h"
#include "navigationwidget.h"
#include "outputpane.h"
#include "rightpane.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
@@ -85,9 +86,13 @@ EditMode::EditMode() :
this, SLOT(grabEditorManager(Core::IMode*)));
m_splitter->setFocusProxy(EditorManager::instance());
IContext *modeContextObject = new IContext(this);
modeContextObject->setContext(Context(Constants::C_EDITORMANAGER));
modeContextObject->setWidget(m_splitter);
ICore::addContextObject(modeContextObject);
setWidget(m_splitter);
setContext(Context(Constants::C_EDIT_MODE,
Constants::C_EDITORMANAGER,
Constants::C_NAVIGATION_PANE));
}

View File

@@ -511,7 +511,7 @@ public:
DebugMode()
{
setObjectName(QLatin1String("DebugMode"));
setContext(Context(CC::C_EDITORMANAGER, C_DEBUGMODE, CC::C_NAVIGATION_PANE));
setContext(Context(C_DEBUGMODE, CC::C_NAVIGATION_PANE));
setDisplayName(DebuggerPlugin::tr("Debug"));
setIcon(QIcon(QLatin1String(":/debugger/images/mode_debug.png")));
setPriority(85);
@@ -3272,6 +3272,10 @@ void DebuggerPluginPrivate::extensionsInitialized()
// Debug mode setup
DebugMode *debugMode = new DebugMode;
QWidget *widget = m_mainWindow->createContents(debugMode);
Core::IContext *modeContextObject = new Core::IContext(this);
modeContextObject->setContext(Core::Context(CC::C_EDITORMANAGER));
modeContextObject->setWidget(widget);
Core::ICore::addContextObject(modeContextObject);
widget->setFocusProxy(EditorManager::instance());
debugMode->setWidget(widget);