diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index df443e9b83cf31dac392f91e8fc3d958158fd91a..e9029f5bb826ad2cd9b7e270cb9696a6f3391503 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -232,6 +232,7 @@ enum ModelRoles
     LocalsPointerValueRole, // Pointer value (address) as quint64
     LocalsIsWatchpointAtAddressRole,
     LocalsIsWatchpointAtPointerValueRole,
+    RequestShowInEditorRole,
     RequestWatchPointRole,
     RequestToggleWatchRole,
     RequestToolTipByExpressionRole,
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index b913fd3ff9191a3e9c667ff969b7cd20f3390f93..9a062a420a15ae0b5672fd159e80db8787b2568b 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -743,6 +743,11 @@ bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int ro
             return true;
         }
 
+        case RequestShowInEditorRole: {
+            m_handler->showInEditor();
+            return true;
+        }
+
         case RequestToggleWatchRole: {
             BreakHandler *handler = engine()->breakHandler();
             const quint64 address = value.toULongLong();
@@ -1616,5 +1621,26 @@ void WatchHandler::addTypeFormats(const QByteArray &type, const QStringList &for
     m_reportedTypeFormats.insert(type, formats);
 }
 
+void WatchHandler::showInEditor()
+{
+    QString contents;
+    showInEditorHelper(&contents, m_locals->m_root, 0);
+    showInEditorHelper(&contents, m_watchers->m_root, 0);
+    plugin()->openTextEditor(tr("Locals & Watchers"), contents);
+}
+
+void WatchHandler::showInEditorHelper(QString *contents, WatchItem *item, int depth)
+{
+    const QChar tab = QLatin1Char('\t');
+    const QChar nl = QLatin1Char('\n');
+    contents->append(QString(depth, tab));
+    contents->append(item->name);
+    contents->append(tab);
+    contents->append(item->value);
+    contents->append(nl);
+    foreach (WatchItem *child, item->children)
+       showInEditorHelper(contents, child, depth + 1);
+}
+
 } // namespace Internal
 } // namespace Debugger
diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h
index cada7520f312f92c4b3c5526ef0a7285ad53a656..6ee27029c1aa628e7a811496f3b36867f43607ae 100644
--- a/src/plugins/debugger/watchhandler.h
+++ b/src/plugins/debugger/watchhandler.h
@@ -187,6 +187,8 @@ private:
     void saveTypeFormats();
     void setFormat(const QByteArray &type, int format);
     void updateWatchersWindow();
+    void showInEditor();
+    void showInEditorHelper(QString *contents, WatchItem *item, int level);
 
     bool m_inChange;
 
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index af3bf110a6de7bf9ffe71823a89dedf191a1903b..059084bbca9e98dd4c1df0ee34fcf267b8c3a9a6 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -383,6 +383,10 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
     actClearCodeModelSnapshot->setEnabled(actionsEnabled
         && theDebuggerAction(UseCodeModel)->isChecked());
     menu.addAction(actClearCodeModelSnapshot);
+    QAction *actShowInEditor
+        = new QAction(tr("Show View Contents in Editor"), &menu);
+    actShowInEditor->setEnabled(actionsEnabled);
+    menu.addAction(actShowInEditor);
     menu.addSeparator();
     menu.addAction(theDebuggerAction(UseToolTipsInLocalsView));
 
@@ -435,6 +439,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
         setModelData(LocalsTypeFormatRole, -1, mi1);
     } else if (act == clearIndividualFormatAction) {
         setModelData(LocalsIndividualFormatRole, -1, mi1);
+    } else if (act == actShowInEditor) {
+        setModelData(RequestShowInEditorRole);
     } else {
         for (int i = 0; i != typeFormatActions.size(); ++i) {
             if (act == typeFormatActions.at(i))