diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp
index 772ccae5ca4871b0149f416263a31ac23d25f746..01250add012da0a73749c3f9f754ff00303de98f 100644
--- a/src/plugins/qmakeprojectmanager/profileeditor.cpp
+++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp
@@ -39,6 +39,7 @@
 #include <extensionsystem/pluginmanager.h>
 #include <qtsupport/qtsupportconstants.h>
 #include <texteditor/texteditoractionhandler.h>
+#include <utils/qtcassert.h>
 
 #include <QCoreApplication>
 #include <QFileInfo>
@@ -54,18 +55,13 @@ namespace Internal {
 
 ProFileEditor::ProFileEditor()
 {
-    setContext(Core::Context(Constants::C_PROFILEEDITOR,
-              TextEditor::Constants::C_TEXTEDITOR));
+    addContext(Constants::C_PROFILEEDITOR);
     setDuplicateSupported(true);
     setCommentStyle(Utils::CommentDefinition::HashStyle);
     setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<ProFileCompletionAssistProvider>());
-}
-
-Core::IEditor *ProFileEditor::duplicate()
-{
-    ProFileEditorWidget *ret = new ProFileEditorWidget;
-    ret->setTextDocument(editorWidget()->textDocumentPtr());
-    return ret->editor();
+    setEditorCreator([]() { return new ProFileEditor; });
+    setDocumentCreator([]() { return new ProFileDocument; });
+    setWidgetCreator([]() { return new ProFileEditorWidget; });
 }
 
 //
@@ -165,7 +161,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
 
 TextEditor::BaseTextEditor *ProFileEditorWidget::createEditor()
 {
-    return new ProFileEditor;
+    QTC_ASSERT("should not happen anymore" && false, return 0);
 }
 
 void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e)
@@ -222,9 +218,7 @@ ProFileEditorFactory::ProFileEditorFactory()
 
 Core::IEditor *ProFileEditorFactory::createEditor()
 {
-    ProFileEditorWidget *editor = new ProFileEditorWidget;
-    editor->setTextDocument(TextEditor::BaseTextDocumentPtr(new ProFileDocument));
-    return editor->editor();
+    return new ProFileEditor;
 }
 
 } // namespace Internal
diff --git a/src/plugins/qmakeprojectmanager/profileeditor.h b/src/plugins/qmakeprojectmanager/profileeditor.h
index ff9b212d403d1b8f7043a17c0c25983c10a09d58..f7ef92ba5d069ce4a99a2e3c8b63e39f70477196 100644
--- a/src/plugins/qmakeprojectmanager/profileeditor.h
+++ b/src/plugins/qmakeprojectmanager/profileeditor.h
@@ -43,8 +43,6 @@ class ProFileEditor : public TextEditor::BaseTextEditor
 
 public:
     ProFileEditor();
-
-    Core::IEditor *duplicate();
 };
 
 class ProFileEditorWidget : public TextEditor::BaseTextEditorWidget