Commit 8a63420d authored by Eike Ziller's avatar Eike Ziller

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: default avatarDavid Schulz <david.schulz@digia.com>
parent 5b3bb398
......@@ -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);
......
......@@ -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));
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment