diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp
index 66443ef1f3b44c160b03f7d1fb4b74f6d12cc320..310f99751cf867ed363da8897c92170a3e7f8e65 100644
--- a/src/plugins/debugger/breakwindow.cpp
+++ b/src/plugins/debugger/breakwindow.cpp
@@ -33,6 +33,7 @@
 #include "debuggeractions.h"
 #include "debuggercore.h"
 
+#include <coreplugin/mainwindow.h>
 #include <utils/pathchooser.h>
 #include <utils/qtcassert.h>
 #include <utils/savedaction.h>
@@ -865,7 +866,7 @@ void BreakTreeView::setBreakpointsEnabled(const BreakpointModelIds &ids, bool en
 
 void BreakTreeView::deleteAllBreakpoints()
 {
-    if (QMessageBox::warning(debuggerCore()->mainWindow(),
+    if (QMessageBox::warning(Core::ICore::mainWindow(),
            tr("Remove All Breakpoints"),
            tr("Are you sure you want to remove all breakpoints "
               "from all files in the current session?"),
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index 1b0eada5ad9a539b0cf738bd5791881bc2b8849c..52331b4e185ca39907c95d8712a9bf12551f896b 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -207,7 +207,7 @@ static QMessageBox *
 nonModalMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text)
 {
     QMessageBox *mb = new QMessageBox(icon, title, text, QMessageBox::Ok,
-                                      debuggerCore()->mainWindow());
+                                      Core::ICore::mainWindow());
     mb->setAttribute(Qt::WA_DeleteOnClose);
     mb->show();
     return mb;
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index c04890fd70c87d11b9e426e7171df4375618258f..b2e3122cce82a6b09e95a2c2ada7e779ace5a5ed 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1084,7 +1084,7 @@ public slots:
         QTC_ASSERT(act, return);
         const BreakpointModelId id = act->data().value<BreakpointModelId>();
         QTC_ASSERT(id > 0, return);
-        BreakTreeView::editBreakpoint(id, mainWindow());
+        BreakTreeView::editBreakpoint(id, ICore::mainWindow());
     }
 
     void slotRunToLine()
@@ -1575,13 +1575,13 @@ void DebuggerPluginPrivate::debugProjectBreakMain()
 void DebuggerPluginPrivate::startAndDebugApplication()
 {
     DebuggerStartParameters sp;
-    if (StartApplicationDialog::run(mainWindow(), &sp))
+    if (StartApplicationDialog::run(ICore::mainWindow(), &sp))
         DebuggerRunControlFactory::createAndScheduleRun(sp);
 }
 
 void DebuggerPluginPrivate::attachCore()
 {
-    AttachCoreDialog dlg(mainWindow());
+    AttachCoreDialog dlg(ICore::mainWindow());
 
     const QString lastExternalKit = configValue("LastExternalKit").toString();
     if (!lastExternalKit.isEmpty())
@@ -1623,7 +1623,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
     QTC_ASSERT(kit && fillParameters(&sp, kit), return);
     sp.startMode = AttachToRemoteServer;
     sp.closeMode = KillAtClose;
-    StartRemoteCdbDialog dlg(mainWindow());
+    StartRemoteCdbDialog dlg(ICore::mainWindow());
     QString previousConnection = configValue(connectionKey).toString();
     if (previousConnection.isEmpty())
         previousConnection = QLatin1String("localhost:1234");
@@ -1639,7 +1639,7 @@ void DebuggerPluginPrivate::attachToRemoteServer()
 {
     DebuggerStartParameters sp;
     sp.startMode = AttachToRemoteServer;
-    if (StartApplicationDialog::run(mainWindow(), &sp)) {
+    if (StartApplicationDialog::run(ICore::mainWindow(), &sp)) {
         sp.closeMode = KillAtClose;
         sp.serverStartScript.clear();
         DebuggerRunControlFactory::createAndScheduleRun(sp);
@@ -1661,7 +1661,7 @@ void DebuggerPluginPrivate::attachToProcess(bool startServerOnly)
     const DebuggerKitChooser::Mode mode = startServerOnly ?
         DebuggerKitChooser::RemoteDebugging : DebuggerKitChooser::LocalDebugging;
     DebuggerKitChooser *kitChooser = new DebuggerKitChooser(mode);
-    DeviceProcessesDialog *dlg = new DeviceProcessesDialog(kitChooser, mainWindow());
+    DeviceProcessesDialog *dlg = new DeviceProcessesDialog(kitChooser, ICore::mainWindow());
     dlg->addAcceptButton(ProjectExplorer::DeviceProcessesDialog::tr("&Attach to Process"));
     dlg->showAllDevices();
     if (dlg->exec() == QDialog::Rejected) {
@@ -1676,7 +1676,7 @@ void DebuggerPluginPrivate::attachToProcess(bool startServerOnly)
     QTC_ASSERT(device, return);
     DeviceProcessItem process = dlg->currentProcess();
     if (process.pid == 0) {
-        QMessageBox::warning(mainWindow(), tr("Warning"),
+        QMessageBox::warning(ICore::mainWindow(), tr("Warning"),
             tr("Cannot attach to process with PID 0"));
         return;
     }
@@ -1725,7 +1725,7 @@ void DebuggerPluginPrivate::attachExternalApplication(RunControl *rc)
 void DebuggerPluginPrivate::attachToQmlPort()
 {
     DebuggerStartParameters sp;
-    AttachToQmlPortDialog dlg(mainWindow());
+    AttachToQmlPortDialog dlg(ICore::mainWindow());
 
     const QVariant qmlServerPort = configValue("LastQmlServerPort");
     if (qmlServerPort.isValid())
@@ -1779,7 +1779,7 @@ void DebuggerPluginPrivate::attachToQmlPort()
 void DebuggerPluginPrivate::startRemoteEngine()
 {
     DebuggerStartParameters sp;
-    StartRemoteEngineDialog dlg(mainWindow());
+    StartRemoteEngineDialog dlg(ICore::mainWindow());
     if (dlg.exec() != QDialog::Accepted)
         return;
 
@@ -2400,7 +2400,7 @@ void DebuggerPluginPrivate::updateDebugWithoutDeployMenu()
 
 void DebuggerPluginPrivate::dumpLog()
 {
-    QString fileName = QFileDialog::getSaveFileName(mainWindow(),
+    QString fileName = QFileDialog::getSaveFileName(ICore::mainWindow(),
         tr("Save Debugger Log"), QDir::tempPath());
     if (fileName.isEmpty())
         return;
@@ -2412,7 +2412,7 @@ void DebuggerPluginPrivate::dumpLog()
         ts << m_logWindow->combinedContents();
         saver.setResult(&ts);
     }
-    saver.finalize(mainWindow());
+    saver.finalize(ICore::mainWindow());
 }
 
 /*! Activates the previous mode when the current mode is the debug mode. */
@@ -2666,7 +2666,7 @@ QMessageBox *showMessageBox(int icon, const QString &title,
 {
     QMessageBox *mb = new QMessageBox(QMessageBox::Icon(icon),
         title, text, QMessageBox::StandardButtons(buttons),
-        debuggerCore()->mainWindow());
+        ICore::mainWindow());
     mb->setAttribute(Qt::WA_DeleteOnClose);
     mb->show();
     return mb;
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index db0d791da8b4039f15f43ef8ee618e2c272c28a9..a301f443fe7c48cca8754b968cbb84b48a1b9a61 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -212,7 +212,7 @@ void DebuggerRunControl::start()
                 static bool checked = true;
                 if (!checked)
                     break;
-                CheckableMessageBox::information(debuggerCore()->mainWindow(),
+                CheckableMessageBox::information(Core::ICore::mainWindow(),
                                                  tr("Debugger"),
                                                  warningMessage,
                                                  tr("&Show this message again."),
diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp
index 8e01de03d3e2b1a3fac91f02c4ed8382bbd58875..3d355dcf575d7de47137a20a1ea655b734ce4f33 100644
--- a/src/plugins/debugger/gdb/classicgdbengine.cpp
+++ b/src/plugins/debugger/gdb/classicgdbengine.cpp
@@ -1256,7 +1256,7 @@ void GdbEngine::handleStackListLocalsClassic(const GdbResponse &response)
 
 static void showQtDumperLibraryWarning(const QString &details)
 {
-    QMessageBox dialog(debuggerCore()->mainWindow());
+    QMessageBox dialog(Core::ICore::mainWindow());
     QPushButton *qtPref = dialog.addButton(DebuggerCore::tr("Open Qt Options"),
         QMessageBox::ActionRole);
     QPushButton *helperOff = dialog.addButton(DebuggerCore::tr("Turn off Helper Usage"),