diff --git a/src/plugins/debugger/commonoptionspage.ui b/src/plugins/debugger/commonoptionspage.ui
index 8cbfecf9e2b6a90825db064d973b24da8047117b..d0e0ed5afe968698a714797f09cdfd01e6c6f763 100644
--- a/src/plugins/debugger/commonoptionspage.ui
+++ b/src/plugins/debugger/commonoptionspage.ui
@@ -2,11 +2,38 @@
 <ui version="4.0">
  <class>CommonOptionsPage</class>
  <widget class="QWidget" name="CommonOptionsPage">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>338</width>
+    <height>357</height>
+   </rect>
+  </property>
   <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Language</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0">
+       <widget class="QCheckBox" name="checkBoxChangeLanguageAutomatically">
+        <property name="toolTip">
+         <string>Changes the debugger language according to the currently opened file.</string>
+        </property>
+        <property name="text">
+         <string>Change debugger language automatically</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
    <item>
     <widget class="QGroupBox" name="groupBox">
      <property name="title">
-      <string>User interface</string>
+      <string>C++</string>
      </property>
      <layout class="QFormLayout" name="formLayout">
       <item row="0" column="0" colspan="2">
diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp
index a382ae42e35ceb76edb193d8a4771ddffd47db39..3ffbb3c2c97e48074ef4aa8cc435097bd9600382 100644
--- a/src/plugins/debugger/debuggeractions.cpp
+++ b/src/plugins/debugger/debuggeractions.cpp
@@ -442,6 +442,14 @@ DebuggerSettings *DebuggerSettings::instance()
     item->setDefaultValue(20);
     instance->insertItem(GdbWatchdogTimeout, item);
 
+    // Language switching
+    item = new Utils::SavedAction(instance);
+    item->setSettingsKey(debugModeGroup, QLatin1String("ChangeLanguageAutomatically"));
+    item->setText(tr("Change debugger language automatically"));
+    item->setToolTip(tr("Changes the debugger language according to the currently opened file."));
+    item->setCheckable(true);
+    item->setDefaultValue(true);
+    instance->insertItem(SwitchLanguageAutomatically, item);
 
     return instance;
 }
diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h
index c85336f1ba05125eab2f84b1e8a56c956cc719ac..368ff1b7b085290f0e4d362386f365484d536c85 100644
--- a/src/plugins/debugger/debuggeractions.h
+++ b/src/plugins/debugger/debuggeractions.h
@@ -136,7 +136,10 @@ enum DebuggerActionCode
     SelectedPluginBreakpointsPattern,
     UsePreciseBreakpoints,
     BreakOnThrow,
-    BreakOnCatch
+    BreakOnCatch,
+
+    // UI/Language switching
+    SwitchLanguageAutomatically
 };
 
 // singleton access
diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp
index cd251d612ce2a6580d066fae27b18d60566ed447..399c65e0c60680d45c4e6f91e07cef033f4c52da 100644
--- a/src/plugins/debugger/debuggermanager.cpp
+++ b/src/plugins/debugger/debuggermanager.cpp
@@ -466,10 +466,6 @@ void DebuggerManager::init()
     connect(this, SIGNAL(emitShowOutput(int, QString)),
             d->m_outputWindow, SLOT(showOutput(int, QString)), Qt::QueuedConnection);
 
-    // UI Switcher
-    connect(DebuggerUISwitcher::instance(), SIGNAL(languageChanged(QString)),
-            this, SLOT(languageChanged(QString)));
-
     // Tooltip
     //QTreeView *tooltipView = qobject_cast<QTreeView *>(d->m_tooltipWindow);
     //tooltipView->setModel(d->m_watchHandler->model(TooltipsWatch));
@@ -1929,14 +1925,6 @@ void DebuggerManager::fontSettingsChanged(const TextEditor::FontSettings &settin
     changeFontSize(d->m_threadsWindow, size);
 }
 
-// only update necessary menu items on language change
-void DebuggerManager::languageChanged(const QString &debuggerLanguage)
-{
-    const bool debuggerIsCPP = (debuggerLanguage == Constants::LANG_CPP);
-    d->m_actions.reverseDirectionAction->setEnabled(debuggerIsCPP);
-    theDebuggerAction(OperateByInstruction)->setEnabled(debuggerIsCPP);
-}
-
 //////////////////////////////////////////////////////////////////////
 //
 // AbstractDebuggerEngine
diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h
index aa1c80ae6daafb3abb9f7d260dfd4af5d6fe00a2..13e9f4f08c1eb5bf88dac417ed666d78249709f9 100644
--- a/src/plugins/debugger/debuggermanager.h
+++ b/src/plugins/debugger/debuggermanager.h
@@ -280,7 +280,6 @@ public slots: // FIXME
     void reloadFullStack();
     void operateByInstructionTriggered();
     void startFailed();
-    void languageChanged(const QString &debuggerLanguage);
 
 private:
     Internal::ModulesHandler *modulesHandler() const;
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index a2f98fc7a0c1d7e309726a1fd8d7f32fb0aa7308..30e814e21b3494cf45bf88281d4bd9cb41474e46 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -359,6 +359,9 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
     m_ui.setupUi(w);
     m_group.clear();
 
+    m_group.insert(theDebuggerAction(SwitchLanguageAutomatically),
+        m_ui.checkBoxChangeLanguageAutomatically);
+
     m_group.insert(theDebuggerAction(ListSourceFiles),
         m_ui.checkBoxListSourceFiles);
     m_group.insert(theDebuggerAction(UseAlternatingRowColors),
@@ -388,7 +391,9 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
     m_group.insert(theDebuggerAction(BreakOnCatch), 0);
 
     if (m_searchKeywords.isEmpty()) {
-        QTextStream(&m_searchKeywords) << ' ' << m_ui.checkBoxListSourceFiles->text()
+        QTextStream(&m_searchKeywords) << ' '
+                << m_ui.checkBoxChangeLanguageAutomatically->text()
+                << m_ui.checkBoxListSourceFiles->text()
                 << ' ' << m_ui.checkBoxUseMessageBoxForSignals->text()
                 << ' ' << m_ui.checkBoxUseAlternatingRowColors->text()
                 << ' ' << m_ui.checkBoxUseToolTipsInMainEditor->text()
@@ -796,76 +801,89 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
     QAction *sep = new QAction(this);
     sep->setSeparator(true);
     cmd = am->registerAction(sep, _("Debugger.Sep.Step"), globalcontext);
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
 
     cmd = am->registerAction(actions.nextAction,
         Constants::NEXT, debuggercontext);
     cmd->setDefaultKeySequence(QKeySequence(Constants::NEXT_KEY));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
 
     cmd = am->registerAction(actions.stepAction,
         Constants::STEP, debuggercontext);
     cmd->setDefaultKeySequence(QKeySequence(Constants::STEP_KEY));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.stepOutAction,
         Constants::STEPOUT, debuggercontext);
     cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.runToLineAction1,
         Constants::RUN_TO_LINE1, debuggercontext);
     cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.runToFunctionAction,
         Constants::RUN_TO_FUNCTION, debuggercontext);
     cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.jumpToLineAction1,
         Constants::JUMP_TO_LINE1, debuggercontext);
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.returnFromFunctionAction,
         Constants::RETURN_FROM_FUNCTION, debuggercontext);
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.reverseDirectionAction,
         Constants::REVERSE, debuggercontext);
     cmd->setDefaultKeySequence(QKeySequence(Constants::REVERSE_KEY));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     sep = new QAction(this);
     sep->setSeparator(true);
     cmd = am->registerAction(sep, _("Debugger.Sep.Break"), globalcontext);
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.snapshotAction,
         Constants::SNAPSHOT, debuggercontext);
     cmd->setDefaultKeySequence(QKeySequence(Constants::SNAPSHOT_KEY));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(theDebuggerAction(OperateByInstruction),
         Constants::OPERATE_BY_INSTRUCTION, debuggercontext);
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.breakAction,
         Constants::TOGGLE_BREAK, cppeditorcontext);
     cmd->setDefaultKeySequence(QKeySequence(Constants::TOGGLE_BREAK_KEY));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
     //mcppcontext->addAction(cmd);
 
     sep = new QAction(this);
     sep->setSeparator(true);
     cmd = am->registerAction(sep, _("Debugger.Sep.Watch"), globalcontext);
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     cmd = am->registerAction(actions.watchAction1,
         Constants::ADD_TO_WATCH1, cppeditorcontext);
     cmd->action()->setEnabled(true);
     //cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W")));
-    m_uiSwitcher->addMenuAction(cmd);
+    m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
+
 
     // Editor context menu
     ActionContainer *editorContextMenu =
@@ -979,6 +997,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
     connect(theDebuggerAction(EnableReverseDebugging), SIGNAL(valueChanged(QVariant)),
         this, SLOT(enableReverseDebuggingTriggered(QVariant)));
 
+    // UI Switcher
+    connect(DebuggerUISwitcher::instance(), SIGNAL(languageChanged(QString)),
+           this, SLOT(languageChanged(QString)));
+
     return true;
 }
 
@@ -1217,6 +1239,20 @@ void DebuggerPlugin::handleStateChanged(int state)
     m_detachAction->setEnabled(detachable);
 }
 
+void DebuggerPlugin::languageChanged(const QString &language)
+{
+    if (!m_manager)
+        return;
+
+    const bool debuggerIsCPP = (language == Constants::LANG_CPP);
+
+    m_startExternalAction->setVisible(debuggerIsCPP);
+    m_attachExternalAction->setVisible(debuggerIsCPP);
+    m_attachCoreAction->setVisible(debuggerIsCPP);
+    m_startRemoteAction->setVisible(debuggerIsCPP);
+    m_detachAction->setVisible(debuggerIsCPP);
+}
+
 void DebuggerPlugin::writeSettings() const
 {
     QSettings *s = settings();
@@ -1242,9 +1278,8 @@ void DebuggerPlugin::onModeChanged(IMode *mode)
     if (editorManager->currentEditor()) {
         editorManager->currentEditor()->widget()->setFocus();
 
-        if (editorManager->currentEditor()->id() == CppEditor::Constants::C_CPPEDITOR) {
+        if (editorManager->currentEditor()->id() == CppEditor::Constants::C_CPPEDITOR)
             m_uiSwitcher->setActiveLanguage(LANG_CPP);
-        }
 
     }
 }
diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h
index 9fade014919a1c2ba39cf0e757810745dcdc5036..9894f25e966f28e969c7ebef1b366a172f4217a2 100644
--- a/src/plugins/debugger/debuggerplugin.h
+++ b/src/plugins/debugger/debuggerplugin.h
@@ -119,6 +119,7 @@ private slots:
     void attachCmdLine();
 
     void enableReverseDebuggingTriggered(const QVariant &value);
+    void languageChanged(const QString &debuggerLanguage);
 
 private:
     void readSettings();
diff --git a/src/plugins/debugger/debuggeruiswitcher.cpp b/src/plugins/debugger/debuggeruiswitcher.cpp
index e7557736f170ead1384da7163c51c986dd2d5f42..2c59f5f37589425b95fed787cc2b03519cc1aca8 100644
--- a/src/plugins/debugger/debuggeruiswitcher.cpp
+++ b/src/plugins/debugger/debuggeruiswitcher.cpp
@@ -2,7 +2,12 @@
 #include "debuggermainwindow.h"
 
 #include <debugger/debuggerconstants.h>
+#include <utils/savedaction.h>
 #include <utils/styledbar.h>
+
+#include <debugger/debuggerconstants.h>
+#include <debugger/debuggeractions.h>
+
 #include <coreplugin/modemanager.h>
 #include <coreplugin/basemode.h>
 #include <coreplugin/uniqueidmanager.h>
@@ -115,11 +120,13 @@ DebuggerUISwitcher::~DebuggerUISwitcher()
 void DebuggerUISwitcher::addMenuAction(Core::Command *command, const QString &group)
 {
     d->m_debugMenu->addAction(command, group);
+    m_menuCommands.insert(m_languages.indexOf(langName), command);
 }
 
 void DebuggerUISwitcher::setActiveLanguage(const QString &langName)
 {
-    changeDebuggerUI(langName);
+    if (theDebuggerAction(SwitchLanguageAutomatically)->isChecked())
+        changeDebuggerUI(langName);
 }
 
 int DebuggerUISwitcher::activeLanguageId() const
@@ -263,6 +270,14 @@ void DebuggerUISwitcher::changeDebuggerUI(const QString &langName)
             }
         }
         d->m_languageMenu->menu()->setTitle(tr("Language") + " (" + langName + ")");
+        QHashIterator<int, Core::Command *> iter(m_menuCommands);
+        while (iter.hasNext()) {
+            iter.next();
+            bool active = (iter.key() == langId);
+            iter.value()->action()->setVisible(active);
+        }
+
+
         emit languageChanged(langName);
     }
 
diff --git a/src/plugins/debugger/debuggeruiswitcher.h b/src/plugins/debugger/debuggeruiswitcher.h
index 9ee3c32bf201f1558ed645eb03decbde3e800df8..cb1a14a53e3fd720d6b178c5e0f1bf5e7def7cfc 100644
--- a/src/plugins/debugger/debuggeruiswitcher.h
+++ b/src/plugins/debugger/debuggeruiswitcher.h
@@ -6,6 +6,7 @@
 #include <QtCore/QObject>
 
 QT_FORWARD_DECLARE_CLASS(QDockWidget);
+#include <QtCore/QMultiHash>
 
 namespace Core {
     class ActionContainer;
@@ -16,8 +17,10 @@ namespace Core {
 
 namespace Utils {
 class FancyMainWindow;
+    class SavedAction;
 }
 
+
 namespace Debugger {
 struct DebuggerUISwitcherPrivate;
 
@@ -42,9 +45,11 @@ public:
     void setToolbar(const QString &langName, QWidget *widget);
 
     // menu actions are registered with this function
-    void addMenuAction(Core::Command *command,
-                            const QString &group = QString());
+    void addMenuAction(Core::Command *command, const QString &langName,
+                       const QString &group = QString());
 
+    // Changes the active language UI to the one specified by langName.
+    // Does nothing if automatic switching is toggled off from settings.
     void setActiveLanguage(const QString &langName);
     int activeLanguageId() const;
 
@@ -84,6 +89,8 @@ private:
     QWidget *createMainWindow(Core::BaseMode *mode);
 
     DebuggerUISwitcherPrivate *d;
+    QMultiHash< int, Core::Command *> m_menuCommands;
+    Utils::SavedAction *m_changeLanguageAction;
 };
 
 }