From b772001c82579f46b778341a3ad5e444455e7269 Mon Sep 17 00:00:00 2001
From: hjk <hjk121@nokiamail.com>
Date: Fri, 31 May 2013 19:35:37 +0200
Subject: [PATCH] EditorFactory: Replace some virtual functions with data
 members

Change-Id: I014cb57460c4e3a36bf7403960908b5ffec867ff
Reviewed-by: David Schulz <david.schulz@digia.com>
---
 .../android/androidmanifesteditorfactory.cpp  | 18 +-----
 .../android/androidmanifesteditorfactory.h    |  6 +-
 src/plugins/bineditor/bineditorplugin.cpp     | 18 +-----
 src/plugins/bineditor/bineditorplugin.h       |  4 --
 .../cmakeeditorfactory.cpp                    | 22 ++-----
 .../cmakeprojectmanager/cmakeeditorfactory.h  | 11 +---
 src/plugins/coreplugin/idocumentfactory.h     | 27 ++++++---
 src/plugins/cppeditor/cppeditorplugin.cpp     | 25 ++------
 src/plugins/cppeditor/cppeditorplugin.h       |  6 --
 src/plugins/designer/formeditorfactory.cpp    | 24 ++------
 src/plugins/designer/formeditorfactory.h      |  9 ---
 src/plugins/diffeditor/diffeditorplugin.cpp   |  1 -
 .../genericprojectfileseditor.cpp             | 23 ++------
 .../genericprojectfileseditor.h               |  5 --
 src/plugins/glsleditor/glsleditorfactory.cpp  | 34 +++--------
 src/plugins/glsleditor/glsleditorfactory.h    |  9 ---
 .../imageviewer/imageviewerfactory.cpp        | 57 +++++++------------
 src/plugins/imageviewer/imageviewerfactory.h  |  4 --
 .../projectexplorer/pluginfilefactory.cpp     | 21 ++-----
 .../projectexplorer/pluginfilefactory.h       |  5 --
 .../pythoneditor/pythoneditorfactory.cpp      | 19 +------
 .../pythoneditor/pythoneditorfactory.h        | 15 -----
 .../qmljseditor/qmljseditorfactory.cpp        | 42 +++-----------
 src/plugins/qmljseditor/qmljseditorfactory.h  |  9 ---
 .../qnx/bardescriptoreditorfactory.cpp        | 19 +------
 src/plugins/qnx/bardescriptoreditorfactory.h  | 10 +---
 .../profileeditorfactory.cpp                  | 28 ++-------
 .../qt4projectmanager/profileeditorfactory.h  | 12 +---
 .../resourceeditor/resourceeditorfactory.cpp  | 20 ++-----
 .../resourceeditor/resourceeditorfactory.h    |  6 --
 src/plugins/tasklist/taskfilefactory.cpp      | 24 ++------
 src/plugins/tasklist/taskfilefactory.h        | 14 +----
 .../texteditor/plaintexteditorfactory.cpp     | 25 ++------
 .../texteditor/plaintexteditorfactory.h       | 10 +---
 src/plugins/vcsbase/basevcseditorfactory.cpp  | 26 ++-------
 src/plugins/vcsbase/basevcseditorfactory.h    |  8 +--
 .../vcsbase/basevcssubmiteditorfactory.cpp    | 49 ++--------------
 .../vcsbase/basevcssubmiteditorfactory.h      | 12 +---
 38 files changed, 132 insertions(+), 545 deletions(-)

diff --git a/src/plugins/android/androidmanifesteditorfactory.cpp b/src/plugins/android/androidmanifesteditorfactory.cpp
index 965ca6af0d3..2e11a8924e7 100644
--- a/src/plugins/android/androidmanifesteditorfactory.cpp
+++ b/src/plugins/android/androidmanifesteditorfactory.cpp
@@ -44,21 +44,9 @@ AndroidManifestEditorFactory::AndroidManifestEditorFactory(QObject *parent)
     : Core::IEditorFactory(parent),
       m_actionHandler(new TextEditor::TextEditorActionHandler(Constants::ANDROID_MANIFEST_EDITOR_CONTEXT))
 {
-}
-
-QStringList AndroidManifestEditorFactory::mimeTypes() const
-{
-    return QStringList() << QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE);
-}
-
-Core::Id AndroidManifestEditorFactory::id() const
-{
-    return Constants::ANDROID_MANIFEST_EDITOR_ID;
-}
-
-QString AndroidManifestEditorFactory::displayName() const
-{
-    return tr("Android Manifest editor");
+    setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
+    setDisplayName(tr("Android Manifest editor"));
+    addMimeType(Constants::ANDROID_MANIFEST_MIME_TYPE);
 }
 
 Core::IEditor *AndroidManifestEditorFactory::createEditor(QWidget *parent)
diff --git a/src/plugins/android/androidmanifesteditorfactory.h b/src/plugins/android/androidmanifesteditorfactory.h
index 1c1470c1089..3a1fa07844e 100644
--- a/src/plugins/android/androidmanifesteditorfactory.h
+++ b/src/plugins/android/androidmanifesteditorfactory.h
@@ -40,14 +40,12 @@ namespace Internal {
 class AndroidManifestEditorFactory : public Core::IEditorFactory
 {
     Q_OBJECT
+
 public:
     explicit AndroidManifestEditorFactory(QObject *parent = 0);
 
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
-
     Core::IEditor *createEditor(QWidget *parent);
+
 private:
     TextEditor::TextEditorActionHandler *m_actionHandler;
 };
diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp
index dbd43cde041..b9f9c87a641 100644
--- a/src/plugins/bineditor/bineditorplugin.cpp
+++ b/src/plugins/bineditor/bineditorplugin.cpp
@@ -402,19 +402,11 @@ private:
 ///////////////////////////////// BinEditorFactory //////////////////////////////////
 
 BinEditorFactory::BinEditorFactory(BinEditorPlugin *owner) :
-    m_mimeTypes(QLatin1String(Constants::C_BINEDITOR_MIMETYPE)),
     m_owner(owner)
 {
-}
-
-Core::Id BinEditorFactory::id() const
-{
-    return Core::Id(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
-}
-
-QString BinEditorFactory::displayName() const
-{
-    return qApp->translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME);
+    setId(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
+    setDisplayName(qApp->translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME));
+    addMimeType(Constants::C_BINEDITOR_MIMETYPE);
 }
 
 Core::IEditor *BinEditorFactory::createEditor(QWidget *parent)
@@ -426,10 +418,6 @@ Core::IEditor *BinEditorFactory::createEditor(QWidget *parent)
     return editor;
 }
 
-QStringList BinEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
 
 /*!
    \class BINEditor::BinEditorWidgetFactory
diff --git a/src/plugins/bineditor/bineditorplugin.h b/src/plugins/bineditor/bineditorplugin.h
index 0adf0f62b43..46864d6bb0b 100644
--- a/src/plugins/bineditor/bineditorplugin.h
+++ b/src/plugins/bineditor/bineditorplugin.h
@@ -102,13 +102,9 @@ class BinEditorFactory : public Core::IEditorFactory
 public:
     explicit BinEditorFactory(BinEditorPlugin *owner);
 
-    QStringList mimeTypes() const;
     Core::IEditor *createEditor(QWidget *parent);
-    Core::Id id() const;
-    QString displayName() const;
 
 private:
-    const QStringList m_mimeTypes;
     BinEditorPlugin *m_owner;
 };
 
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
index 8bebdfaade1..ea14d89f9de 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
@@ -43,12 +43,15 @@ using namespace CMakeProjectManager;
 using namespace CMakeProjectManager::Internal;
 
 CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
-    : m_mimeTypes(QStringList() << QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE)),
-      m_manager(manager)
+    : m_manager(manager)
 {
     using namespace Core;
     using namespace TextEditor;
 
+    setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
+    setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME));
+    addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
+
     m_actionHandler =
             new TextEditorActionHandler(Constants::C_CMAKEEDITOR,
             TextEditorActionHandler::UnCommentSelection
@@ -67,24 +70,9 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
     contextMenu->addAction(cmd);
 }
 
-Core::Id CMakeEditorFactory::id() const
-{
-    return Core::Id(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
-}
-
-QString CMakeEditorFactory::displayName() const
-{
-    return tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME);
-}
-
 Core::IEditor *CMakeEditorFactory::createEditor(QWidget *parent)
 {
     CMakeEditorWidget *rc = new CMakeEditorWidget(parent, this, m_actionHandler);
     TextEditor::TextEditorSettings::instance()->initializeEditor(rc);
     return rc->editor();
 }
-
-QStringList CMakeEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h
index 279a99e10f4..aafa5a4875f 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h
+++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.h
@@ -34,11 +34,7 @@
 
 #include <coreplugin/editormanager/ieditorfactory.h>
 
-#include <QStringList>
-
-namespace TextEditor {
-class TextEditorActionHandler;
-}
+namespace TextEditor { class TextEditorActionHandler; }
 
 namespace CMakeProjectManager {
 namespace Internal {
@@ -49,11 +45,6 @@ class CMakeEditorFactory : public Core::IEditorFactory
 
 public:
     CMakeEditorFactory(CMakeManager *parent);
-
-    // IEditorFactory
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
     Core::IEditor *createEditor(QWidget *parent);
 
 private:
diff --git a/src/plugins/coreplugin/idocumentfactory.h b/src/plugins/coreplugin/idocumentfactory.h
index bf9bbb00556..d9cbaa1311c 100644
--- a/src/plugins/coreplugin/idocumentfactory.h
+++ b/src/plugins/coreplugin/idocumentfactory.h
@@ -30,18 +30,14 @@
 #ifndef IDOCUMENTFACTORY_H
 #define IDOCUMENTFACTORY_H
 
-#include "core_global.h"
+#include "id.h"
 
 #include <QObject>
-
-QT_BEGIN_NAMESPACE
-class QStringList;
-QT_END_NAMESPACE
+#include <QStringList>
 
 namespace Core {
 
 class IDocument;
-class Id;
 
 class CORE_EXPORT IDocumentFactory : public QObject
 {
@@ -50,10 +46,23 @@ class CORE_EXPORT IDocumentFactory : public QObject
 public:
     IDocumentFactory(QObject *parent = 0) : QObject(parent) {}
 
-    virtual QStringList mimeTypes() const = 0;
-    virtual Id id() const = 0;
-    virtual QString displayName() const = 0;
     virtual IDocument *open(const QString &fileName) = 0;
+
+    Id id() const { return m_id; }
+    QStringList mimeTypes() const { return m_mimeTypes; }
+    QString displayName() const { return m_displayName; }
+
+protected:
+    void setId(Id id) { m_id = id; }
+    void setDisplayName(const QString &displayName) { m_displayName = displayName; }
+    void setMimeTypes(const QStringList &mimeTypes) { m_mimeTypes = mimeTypes; }
+    void addMimeType(const char *mimeType) { m_mimeTypes.append(QLatin1String(mimeType)); }
+    void addMimeType(const QString &mimeType) { m_mimeTypes.append(mimeType); }
+
+private:
+    Id m_id;
+    QStringList m_mimeTypes;
+    QString m_displayName;
 };
 
 } // namespace Core
diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp
index 3dd822b5f7b..8df51752aaf 100644
--- a/src/plugins/cppeditor/cppeditorplugin.cpp
+++ b/src/plugins/cppeditor/cppeditorplugin.cpp
@@ -68,10 +68,12 @@ enum { QUICKFIX_INTERVAL = 20 };
 CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
     m_owner(owner)
 {
-    m_mimeTypes << QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)
-            << QLatin1String(CppEditor::Constants::C_HEADER_MIMETYPE)
-            << QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)
-            << QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE);
+    setId(CppEditor::Constants::CPPEDITOR_ID);
+    setDisplayName(qApp->translate("OpenWith::Editors", CppEditor::Constants::CPPEDITOR_DISPLAY_NAME));
+    addMimeType(CppEditor::Constants::C_SOURCE_MIMETYPE);
+    addMimeType(CppEditor::Constants::C_HEADER_MIMETYPE);
+    addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
+    addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
 
     if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
         Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
@@ -85,16 +87,6 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
     }
 }
 
-Core::Id CppEditorFactory::id() const
-{
-    return Core::Id(CppEditor::Constants::CPPEDITOR_ID);
-}
-
-QString CppEditorFactory::displayName() const
-{
-    return qApp->translate("OpenWith::Editors", CppEditor::Constants::CPPEDITOR_DISPLAY_NAME);
-}
-
 Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
 {
     CPPEditorWidget *editor = new CPPEditorWidget(parent);
@@ -103,11 +95,6 @@ Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
     return editor->editor();
 }
 
-QStringList CppEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
 ///////////////////////////////// CppEditorPlugin //////////////////////////////////
 
 CppEditorPlugin *CppEditorPlugin::m_instance = 0;
diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h
index 356677038a9..0fc9054fed3 100644
--- a/src/plugins/cppeditor/cppeditorplugin.h
+++ b/src/plugins/cppeditor/cppeditorplugin.h
@@ -35,7 +35,6 @@
 #include <extensionsystem/iplugin.h>
 
 #include <QtPlugin>
-#include <QStringList>
 #include <QAction>
 
 namespace TextEditor {
@@ -286,15 +285,10 @@ class CppEditorFactory : public Core::IEditorFactory
 public:
     CppEditorFactory(CppEditorPlugin *owner);
 
-    // IEditorFactory
-    QStringList mimeTypes() const;
     Core::IEditor *createEditor(QWidget *parent);
-    Core::Id id() const;
-    QString displayName() const;
 
 private:
     CppEditorPlugin *m_owner;
-    QStringList m_mimeTypes;
 };
 
 } // namespace Internal
diff --git a/src/plugins/designer/formeditorfactory.cpp b/src/plugins/designer/formeditorfactory.cpp
index 6425eb33a16..9aa570f61b5 100644
--- a/src/plugins/designer/formeditorfactory.cpp
+++ b/src/plugins/designer/formeditorfactory.cpp
@@ -48,24 +48,17 @@ namespace Designer {
 namespace Internal {
 
 FormEditorFactory::FormEditorFactory()
-  : Core::IEditorFactory(Core::ICore::instance()),
-    m_mimeTypes(QLatin1String(FORM_MIMETYPE))
+  : Core::IEditorFactory(Core::ICore::instance())
 {
+    setId(K_DESIGNER_XML_EDITOR_ID);
+    setDisplayName(qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME));
+    addMimeType(FORM_MIMETYPE);
+
     Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
     iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/formeditor/images/qt_ui.png")),
                                                QLatin1String("ui"));
 }
 
-Core::Id FormEditorFactory::id() const
-{
-    return Core::Id(K_DESIGNER_XML_EDITOR_ID);
-}
-
-QString FormEditorFactory::displayName() const
-{
-    return qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME);
-}
-
 Core::IEditor *FormEditorFactory::createEditor(QWidget *parent)
 {
     const EditorData data = FormEditorW::instance()->createEditor(parent);
@@ -78,11 +71,6 @@ Core::IEditor *FormEditorFactory::createEditor(QWidget *parent)
     return data.formWindowEditor;
 }
 
-QStringList FormEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
 void FormEditorFactory::designerModeClicked()
 {
     Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
@@ -90,5 +78,3 @@ void FormEditorFactory::designerModeClicked()
 
 } // namespace Internal
 } // namespace Designer
-
-
diff --git a/src/plugins/designer/formeditorfactory.h b/src/plugins/designer/formeditorfactory.h
index d1183fbfc58..a17446d18b6 100644
--- a/src/plugins/designer/formeditorfactory.h
+++ b/src/plugins/designer/formeditorfactory.h
@@ -32,8 +32,6 @@
 
 #include <coreplugin/editormanager/ieditorfactory.h>
 
-#include <QStringList>
-
 namespace Designer {
 namespace Internal {
 
@@ -44,17 +42,10 @@ class FormEditorFactory : public Core::IEditorFactory
 public:
     FormEditorFactory();
 
-    // IEditorFactory
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
     Core::IEditor *createEditor(QWidget *parent);
 
 private slots:
     void designerModeClicked();
-
-private:
-    const QStringList m_mimeTypes;
 };
 
 } // namespace Internal
diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp
index 191c6a88c16..6bbf6cfbefe 100644
--- a/src/plugins/diffeditor/diffeditorplugin.cpp
+++ b/src/plugins/diffeditor/diffeditorplugin.cpp
@@ -45,7 +45,6 @@
 #include <coreplugin/editormanager/editormanager.h>
 
 namespace DiffEditor {
-
 namespace Internal {
 
 DiffEditorPlugin::DiffEditorPlugin()
diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
index ef62b1e3b50..739dd18bd22 100644
--- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp
@@ -54,9 +54,11 @@ ProjectFilesFactory::ProjectFilesFactory(Manager *manager, TextEditorActionHandl
     : Core::IEditorFactory(manager),
       m_actionHandler(handler)
 {
-    m_mimeTypes.append(QLatin1String(Constants::FILES_MIMETYPE));
-    m_mimeTypes.append(QLatin1String(Constants::INCLUDES_MIMETYPE));
-    m_mimeTypes.append(QLatin1String(Constants::CONFIG_MIMETYPE));
+    setId(Constants::FILES_EDITOR_ID);
+    setDisplayName(QCoreApplication::translate("OpenWith::Editors", ".files Editor"));
+    addMimeType(Constants::FILES_MIMETYPE);
+    addMimeType(Constants::INCLUDES_MIMETYPE);
+    addMimeType(Constants::CONFIG_MIMETYPE);
 }
 
 Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent)
@@ -66,21 +68,6 @@ Core::IEditor *ProjectFilesFactory::createEditor(QWidget *parent)
     return ed->editor();
 }
 
-QStringList ProjectFilesFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
-Core::Id ProjectFilesFactory::id() const
-{
-    return Core::Id(Constants::FILES_EDITOR_ID);
-}
-
-QString ProjectFilesFactory::displayName() const
-{
-    return  QCoreApplication::translate("OpenWith::Editors", ".files Editor");
-}
-
 ////////////////////////////////////////////////////////////////////////////////////////
 //
 // ProjectFilesEditable
diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.h b/src/plugins/genericprojectmanager/genericprojectfileseditor.h
index e5fedd2b16a..75014f8060d 100644
--- a/src/plugins/genericprojectmanager/genericprojectfileseditor.h
+++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.h
@@ -56,13 +56,8 @@ public:
 
     Core::IEditor *createEditor(QWidget *parent);
 
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
-
 private:
     TextEditor::TextEditorActionHandler *m_actionHandler;
-    QStringList m_mimeTypes;
 };
 
 class ProjectFilesEditor : public TextEditor::BaseTextEditor
diff --git a/src/plugins/glsleditor/glsleditorfactory.cpp b/src/plugins/glsleditor/glsleditorfactory.cpp
index 09db817a9d5..5426911ebe6 100644
--- a/src/plugins/glsleditor/glsleditorfactory.cpp
+++ b/src/plugins/glsleditor/glsleditorfactory.cpp
@@ -37,14 +37,9 @@
 #include <extensionsystem/pluginspec.h>
 
 #include <coreplugin/icore.h>
-#include <coreplugin/editormanager/editormanager.h>
 
 #include <QCoreApplication>
-#include <QFileInfo>
-#include <QDebug>
 #include <QSettings>
-#include <QMessageBox>
-#include <QPushButton>
 
 using namespace GLSLEditor::Internal;
 using namespace GLSLEditor::Constants;
@@ -52,23 +47,13 @@ using namespace GLSLEditor::Constants;
 GLSLEditorFactory::GLSLEditorFactory(QObject *parent)
   : Core::IEditorFactory(parent)
 {
-    m_mimeTypes
-            << QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE)
-            << QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_VERT)
-            << QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG)
-            << QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES)
-            << QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES)
-            ;
-}
-
-Core::Id GLSLEditorFactory::id() const
-{
-    return Core::Id(C_GLSLEDITOR_ID);
-}
-
-QString GLSLEditorFactory::displayName() const
-{
-    return qApp->translate("OpenWith::Editors", C_GLSLEDITOR_DISPLAY_NAME);
+    setId(C_GLSLEDITOR_ID);
+    setDisplayName(qApp->translate("OpenWith::Editors", C_GLSLEDITOR_DISPLAY_NAME));
+    addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE);
+    addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT);
+    addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG);
+    addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES);
+    addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES);
 }
 
 Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)
@@ -78,11 +63,6 @@ Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)
     return rc->editor();
 }
 
-QStringList GLSLEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
 void GLSLEditorFactory::updateEditorInfoBar(Core::IEditor *)
 {
 }
diff --git a/src/plugins/glsleditor/glsleditorfactory.h b/src/plugins/glsleditor/glsleditorfactory.h
index 34b68a3c9e6..0932b3f556e 100644
--- a/src/plugins/glsleditor/glsleditorfactory.h
+++ b/src/plugins/glsleditor/glsleditorfactory.h
@@ -32,8 +32,6 @@
 
 #include <coreplugin/editormanager/ieditorfactory.h>
 
-#include <QStringList>
-
 namespace GLSLEditor {
 namespace Internal {
 
@@ -44,17 +42,10 @@ class GLSLEditorFactory : public Core::IEditorFactory
 public:
     GLSLEditorFactory(QObject *parent);
 
-    // IEditorFactory
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
     Core::IEditor *createEditor(QWidget *parent);
 
 private slots:
     void updateEditorInfoBar(Core::IEditor *editor);
-
-private:
-    QStringList m_mimeTypes;
 };
 
 } // namespace Internal
diff --git a/src/plugins/imageviewer/imageviewerfactory.cpp b/src/plugins/imageviewer/imageviewerfactory.cpp
index d925ea6cc94..b77c468c1a6 100644
--- a/src/plugins/imageviewer/imageviewerfactory.cpp
+++ b/src/plugins/imageviewer/imageviewerfactory.cpp
@@ -43,7 +43,6 @@ namespace Internal {
 
 struct ImageViewerFactoryPrivate
 {
-    QStringList mimeTypes;
     QPointer<ImageViewerActionHandler> actionHandler;
 };
 
@@ -51,30 +50,33 @@ ImageViewerFactory::ImageViewerFactory(QObject *parent) :
     Core::IEditorFactory(parent),
     d(new ImageViewerFactoryPrivate)
 {
+    setId(Constants::IMAGEVIEWER_ID);
+    setDisplayName(qApp->translate("OpenWith::Editors", Constants::IMAGEVIEWER_DISPLAY_NAME));
+
     d->actionHandler = new ImageViewerActionHandler(this);
 
-    QMap<QByteArray, QString> possibleMimeTypes;
-    possibleMimeTypes.insert("bmp", QLatin1String("image/bmp"));
-    possibleMimeTypes.insert("gif", QLatin1String("image/gif"));
-    possibleMimeTypes.insert("ico", QLatin1String("image/x-icon"));
-    possibleMimeTypes.insert("jpeg", QLatin1String("image/jpeg"));
-    possibleMimeTypes.insert("jpg", QLatin1String("image/jpeg"));
-    possibleMimeTypes.insert("mng", QLatin1String("video/x-mng"));
-    possibleMimeTypes.insert("pbm", QLatin1String("image/x-portable-bitmap"));
-    possibleMimeTypes.insert("pgm", QLatin1String("image/x-portable-graymap"));
-    possibleMimeTypes.insert("png", QLatin1String("image/png"));
-    possibleMimeTypes.insert("ppm", QLatin1String("image/x-portable-pixmap"));
-    possibleMimeTypes.insert("svg", QLatin1String("image/svg+xml"));
-    possibleMimeTypes.insert("tif", QLatin1String("image/tiff"));
-    possibleMimeTypes.insert("tiff", QLatin1String("image/tiff"));
-    possibleMimeTypes.insert("xbm", QLatin1String("image/xbm"));
-    possibleMimeTypes.insert("xpm", QLatin1String("image/xpm"));
+    QMap<QByteArray, const char *> possibleMimeTypes;
+    possibleMimeTypes.insert("bmp", "image/bmp");
+    possibleMimeTypes.insert("gif", "image/gif");
+    possibleMimeTypes.insert("ico", "image/x-icon");
+    possibleMimeTypes.insert("jpeg","image/jpeg");
+    possibleMimeTypes.insert("jpg", "image/jpeg");
+    possibleMimeTypes.insert("mng", "video/x-mng");
+    possibleMimeTypes.insert("pbm", "image/x-portable-bitmap");
+    possibleMimeTypes.insert("pgm", "image/x-portable-graymap");
+    possibleMimeTypes.insert("png", "image/png");
+    possibleMimeTypes.insert("ppm", "image/x-portable-pixmap");
+    possibleMimeTypes.insert("svg", "image/svg+xml");
+    possibleMimeTypes.insert("tif", "image/tiff");
+    possibleMimeTypes.insert("tiff","image/tiff");
+    possibleMimeTypes.insert("xbm", "image/xbm");
+    possibleMimeTypes.insert("xpm", "image/xpm");
 
     QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
     foreach (const QByteArray &format, supportedFormats) {
-        const QString &value = possibleMimeTypes.value(format);
-        if (!value.isEmpty())
-            d->mimeTypes.append(value);
+        const char *value = possibleMimeTypes.value(format);
+        if (value)
+            addMimeType(value);
     }
 }
 
@@ -88,21 +90,6 @@ Core::IEditor *ImageViewerFactory::createEditor(QWidget *parent)
     return new ImageViewer(parent);
 }
 
-QStringList ImageViewerFactory::mimeTypes() const
-{
-    return d->mimeTypes;
-}
-
-Core::Id ImageViewerFactory::id() const
-{
-    return Core::Id(Constants::IMAGEVIEWER_ID);
-}
-
-QString ImageViewerFactory::displayName() const
-{
-    return qApp->translate("OpenWith::Editors", Constants::IMAGEVIEWER_DISPLAY_NAME);
-}
-
 void ImageViewerFactory::extensionsInitialized()
 {
     d->actionHandler->createActions();
diff --git a/src/plugins/imageviewer/imageviewerfactory.h b/src/plugins/imageviewer/imageviewerfactory.h
index 77d372a265d..a4200013ca5 100644
--- a/src/plugins/imageviewer/imageviewerfactory.h
+++ b/src/plugins/imageviewer/imageviewerfactory.h
@@ -47,10 +47,6 @@ public:
 
     Core::IEditor *createEditor(QWidget *parent);
 
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
-
     void extensionsInitialized();
 
 private:
diff --git a/src/plugins/projectexplorer/pluginfilefactory.cpp b/src/plugins/projectexplorer/pluginfilefactory.cpp
index 64353d644c4..12721374433 100644
--- a/src/plugins/projectexplorer/pluginfilefactory.cpp
+++ b/src/plugins/projectexplorer/pluginfilefactory.cpp
@@ -49,24 +49,11 @@ using namespace ProjectExplorer::Internal;
 */
 
 ProjectFileFactory::ProjectFileFactory(IProjectManager *manager)
-  : m_mimeTypes(manager->mimeType()),
-    m_manager(manager)
+    : m_manager(manager)
 {
-}
-
-QStringList ProjectFileFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
-Core::Id ProjectFileFactory::id() const
-{
-    return Core::Id(Constants::FILE_FACTORY_ID);
-}
-
-QString ProjectFileFactory::displayName() const
-{
-    return tr("Project File Factory", "ProjectExplorer::ProjectFileFactory display name.");
+    setId(Constants::FILE_FACTORY_ID);
+    setDisplayName(tr("Project File Factory", "ProjectExplorer::ProjectFileFactory display name."));
+    addMimeType(manager->mimeType());
 }
 
 Core::IDocument *ProjectFileFactory::open(const QString &fileName)
diff --git a/src/plugins/projectexplorer/pluginfilefactory.h b/src/plugins/projectexplorer/pluginfilefactory.h
index 68cb962b4c1..61dbbfb87e1 100644
--- a/src/plugins/projectexplorer/pluginfilefactory.h
+++ b/src/plugins/projectexplorer/pluginfilefactory.h
@@ -48,16 +48,11 @@ class ProjectFileFactory : public Core::IDocumentFactory
     explicit ProjectFileFactory(ProjectExplorer::IProjectManager *manager);
 
 public:
-    virtual QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
-
     Core::IDocument *open(const QString &fileName);
 
     static QList<ProjectFileFactory*> createFactories(QString *filterString);
 
 private:
-    const QStringList m_mimeTypes;
     ProjectExplorer::IProjectManager *m_manager;
 };
 
diff --git a/src/plugins/pythoneditor/pythoneditorfactory.cpp b/src/plugins/pythoneditor/pythoneditorfactory.cpp
index 5dc783f6ae9..e0b36e18993 100644
--- a/src/plugins/pythoneditor/pythoneditorfactory.cpp
+++ b/src/plugins/pythoneditor/pythoneditorfactory.cpp
@@ -43,17 +43,9 @@ namespace PythonEditor {
 EditorFactory::EditorFactory(QObject *parent)
     : Core::IEditorFactory(parent)
 {
-    m_mimeTypes << QLatin1String(Constants::C_PY_MIMETYPE);
-}
-
-Core::Id EditorFactory::id() const
-{
-    return Constants::C_PYTHONEDITOR_ID;
-}
-
-QString EditorFactory::displayName() const
-{
-    return tr(Constants::C_EDITOR_DISPLAY_NAME);
+    setId(Constants::C_PYTHONEDITOR_ID);
+    setDisplayName(tr(Constants::C_EDITOR_DISPLAY_NAME));
+    addMimeType(QLatin1String(Constants::C_PY_MIMETYPE));
 }
 
 Core::IEditor *EditorFactory::createEditor(QWidget *parent)
@@ -64,9 +56,4 @@ Core::IEditor *EditorFactory::createEditor(QWidget *parent)
     return widget->editor();
 }
 
-QStringList EditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
 } // namespace PythonEditor
diff --git a/src/plugins/pythoneditor/pythoneditorfactory.h b/src/plugins/pythoneditor/pythoneditorfactory.h
index 5879e6fe391..33400212127 100644
--- a/src/plugins/pythoneditor/pythoneditorfactory.h
+++ b/src/plugins/pythoneditor/pythoneditorfactory.h
@@ -32,7 +32,6 @@
 
 #include "pythoneditor_global.h"
 #include <coreplugin/editormanager/ieditorfactory.h>
-#include <QStringList>
 
 namespace PythonEditor {
 
@@ -43,24 +42,10 @@ class PYEDITOR_EXPORT EditorFactory : public Core::IEditorFactory
 public:
     EditorFactory(QObject *parent);
 
-    /**
-      Returns MIME types handled by editor
-      */
-    QStringList mimeTypes() const;
-
-    /**
-      Unique editor class identifier, see Constants::C_PYEDITOR_ID
-      */
-    Core::Id id() const;
-    QString displayName() const;
-
     /**
       Creates and initializes new editor widget
       */
     Core::IEditor *createEditor(QWidget *parent);
-
-private:
-    QStringList m_mimeTypes;
 };
 
 } // namespace PythonEditor
diff --git a/src/plugins/qmljseditor/qmljseditorfactory.cpp b/src/plugins/qmljseditor/qmljseditorfactory.cpp
index 56f80661707..4a2efa60538 100644
--- a/src/plugins/qmljseditor/qmljseditorfactory.cpp
+++ b/src/plugins/qmljseditor/qmljseditorfactory.cpp
@@ -35,19 +35,7 @@
 
 #include <qmljstools/qmljstoolsconstants.h>
 
-#include <extensionsystem/pluginmanager.h>
-#include <extensionsystem/pluginspec.h>
-
-#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
-#include <coreplugin/editormanager/editormanager.h>
-
 #include <QCoreApplication>
-#include <QFileInfo>
-#include <QDebug>
-#include <QSettings>
-#include <QMessageBox>
-#include <QPushButton>
 
 namespace QmlJSEditor {
 namespace Internal {
@@ -55,24 +43,15 @@ namespace Internal {
 QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
   : Core::IEditorFactory(parent)
 {
-    m_mimeTypes
-            << QLatin1String(QmlJSTools::Constants::QML_MIMETYPE)
-            << QLatin1String(QmlJSTools::Constants::QMLPROJECT_MIMETYPE)
-            << QLatin1String(QmlJSTools::Constants::QBS_MIMETYPE)
-            << QLatin1String(QmlJSTools::Constants::QMLTYPES_MIMETYPE)
-            << QLatin1String(QmlJSTools::Constants::JS_MIMETYPE)
-            << QLatin1String(QmlJSTools::Constants::JSON_MIMETYPE)
-            ;
-}
-
-Core::Id QmlJSEditorFactory::id() const
-{
-    return Core::Id(Constants::C_QMLJSEDITOR_ID);
-}
+    setId(Constants::C_QMLJSEDITOR_ID);
+    setDisplayName(qApp->translate("OpenWith::Editors", Constants::C_QMLJSEDITOR_DISPLAY_NAME));
 
-QString QmlJSEditorFactory::displayName() const
-{
-    return qApp->translate("OpenWith::Editors", Constants::C_QMLJSEDITOR_DISPLAY_NAME);
+    addMimeType(QmlJSTools::Constants::QML_MIMETYPE);
+    addMimeType(QmlJSTools::Constants::QMLPROJECT_MIMETYPE);
+    addMimeType(QmlJSTools::Constants::QBS_MIMETYPE);
+    addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE);
+    addMimeType(QmlJSTools::Constants::JS_MIMETYPE);
+    addMimeType(QmlJSTools::Constants::JSON_MIMETYPE);
 }
 
 Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
@@ -82,10 +61,5 @@ Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
     return rc->editor();
 }
 
-QStringList QmlJSEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
 } // namespace Internal
 } // namespace QmlJSEditor
diff --git a/src/plugins/qmljseditor/qmljseditorfactory.h b/src/plugins/qmljseditor/qmljseditorfactory.h
index ed91e33cd27..79d4b3cada4 100644
--- a/src/plugins/qmljseditor/qmljseditorfactory.h
+++ b/src/plugins/qmljseditor/qmljseditorfactory.h
@@ -32,8 +32,6 @@
 
 #include <coreplugin/editormanager/ieditorfactory.h>
 
-#include <QStringList>
-
 namespace QmlJSEditor {
 namespace Internal {
 
@@ -44,14 +42,7 @@ class QmlJSEditorFactory : public Core::IEditorFactory
 public:
     QmlJSEditorFactory(QObject *parent);
 
-    // IEditorFactory
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
     Core::IEditor *createEditor(QWidget *parent);
-
-private:
-    QStringList m_mimeTypes;
 };
 
 } // namespace Internal
diff --git a/src/plugins/qnx/bardescriptoreditorfactory.cpp b/src/plugins/qnx/bardescriptoreditorfactory.cpp
index ac300d3710c..5a2806039d3 100644
--- a/src/plugins/qnx/bardescriptoreditorfactory.cpp
+++ b/src/plugins/qnx/bardescriptoreditorfactory.cpp
@@ -42,23 +42,10 @@ using namespace Qnx::Internal;
 
 BarDescriptorEditorFactory::BarDescriptorEditorFactory(QObject *parent)
     : Core::IEditorFactory(parent)
-    , m_mimeTypes(QStringList() << QLatin1String(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE))
 {
-}
-
-QStringList BarDescriptorEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
-Core::Id BarDescriptorEditorFactory::id() const
-{
-    return Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID;
-}
-
-QString BarDescriptorEditorFactory::displayName() const
-{
-    return tr("Bar descriptor editor");
+    setId(Constants::QNX_BAR_DESCRIPTOR_EDITOR_ID);
+    setDisplayName(tr("Bar descriptor editor"));
+    addMimeType(Constants::QNX_BAR_DESCRIPTOR_MIME_TYPE);
 }
 
 Core::IEditor *BarDescriptorEditorFactory::createEditor(QWidget *parent)
diff --git a/src/plugins/qnx/bardescriptoreditorfactory.h b/src/plugins/qnx/bardescriptoreditorfactory.h
index 36bade0089b..9a7ddfa687a 100644
--- a/src/plugins/qnx/bardescriptoreditorfactory.h
+++ b/src/plugins/qnx/bardescriptoreditorfactory.h
@@ -34,25 +34,17 @@
 
 #include <coreplugin/editormanager/ieditorfactory.h>
 
-#include <QtCore/QStringList>
-
 namespace Qnx {
 namespace Internal {
 
 class BarDescriptorEditorFactory : public Core::IEditorFactory
 {
     Q_OBJECT
+
 public:
     explicit BarDescriptorEditorFactory(QObject *parent = 0);
 
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
-
     Core::IEditor *createEditor(QWidget *parent);
-
-private:
-    QStringList m_mimeTypes;
 };
 
 } // namespace Internal
diff --git a/src/plugins/qt4projectmanager/profileeditorfactory.cpp b/src/plugins/qt4projectmanager/profileeditorfactory.cpp
index bb2c8323d1b..a7d0ca61b09 100644
--- a/src/plugins/qt4projectmanager/profileeditorfactory.cpp
+++ b/src/plugins/qt4projectmanager/profileeditorfactory.cpp
@@ -43,12 +43,15 @@ using namespace Qt4ProjectManager;
 using namespace Qt4ProjectManager::Internal;
 
 ProFileEditorFactory::ProFileEditorFactory(Qt4Manager *manager, TextEditor::TextEditorActionHandler *handler) :
-    m_mimeTypes(QStringList() << QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE)
-                << QLatin1String(Qt4ProjectManager::Constants::PROINCLUDEFILE_MIMETYPE)
-                << QLatin1String(Qt4ProjectManager::Constants::PROFEATUREFILE_MIMETYPE)),
     m_manager(manager),
     m_actionHandler(handler)
 {
+    setId(Qt4ProjectManager::Constants::PROFILE_EDITOR_ID);
+    setDisplayName(qApp->translate("OpenWith::Editors", Qt4ProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME));
+    addMimeType(Qt4ProjectManager::Constants::PROFILE_MIMETYPE);
+    addMimeType(Qt4ProjectManager::Constants::PROINCLUDEFILE_MIMETYPE);
+    addMimeType(Qt4ProjectManager::Constants::PROFEATUREFILE_MIMETYPE);
+
     Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
     iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(QtSupport::Constants::ICON_QT_PROJECT)),
                                         QLatin1String("pro"));
@@ -58,28 +61,9 @@ ProFileEditorFactory::ProFileEditorFactory(Qt4Manager *manager, TextEditor::Text
                                         QLatin1String("prf"));
 }
 
-ProFileEditorFactory::~ProFileEditorFactory()
-{
-}
-
-Core::Id ProFileEditorFactory::id() const
-{
-    return Core::Id(Qt4ProjectManager::Constants::PROFILE_EDITOR_ID);
-}
-
-QString ProFileEditorFactory::displayName() const
-{
-    return qApp->translate("OpenWith::Editors", Qt4ProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME);
-}
-
 Core::IEditor *ProFileEditorFactory::createEditor(QWidget *parent)
 {
     ProFileEditorWidget *editor = new ProFileEditorWidget(parent, this, m_actionHandler);
     TextEditor::TextEditorSettings::instance()->initializeEditor(editor);
     return editor->editor();
 }
-
-QStringList ProFileEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
diff --git a/src/plugins/qt4projectmanager/profileeditorfactory.h b/src/plugins/qt4projectmanager/profileeditorfactory.h
index 2ad656320dd..41c5e8c477f 100644
--- a/src/plugins/qt4projectmanager/profileeditorfactory.h
+++ b/src/plugins/qt4projectmanager/profileeditorfactory.h
@@ -32,11 +32,7 @@
 
 #include <coreplugin/editormanager/ieditorfactory.h>
 
-#include <QStringList>
-
-namespace TextEditor {
-class TextEditorActionHandler;
-}
+namespace TextEditor { class TextEditorActionHandler; }
 
 namespace Qt4ProjectManager {
 
@@ -50,18 +46,12 @@ class ProFileEditorFactory : public Core::IEditorFactory
 
 public:
     ProFileEditorFactory(Qt4Manager *parent, TextEditor::TextEditorActionHandler *handler);
-    ~ProFileEditorFactory();
 
-    // IEditorFactory
-    QStringList mimeTypes() const;
-    Core::Id id() const;
-    QString displayName() const;
     Core::IEditor *createEditor(QWidget *parent);
 
     Qt4Manager *qt4ProjectManager() const { return m_manager; }
 
 private:
-    const QStringList m_mimeTypes;
     Qt4Manager *m_manager;
     TextEditor::TextEditorActionHandler *m_actionHandler;
 };
diff --git a/src/plugins/resourceeditor/resourceeditorfactory.cpp b/src/plugins/resourceeditor/resourceeditorfactory.cpp
index 7adc6de66ce..120c342800c 100644
--- a/src/plugins/resourceeditor/resourceeditorfactory.cpp
+++ b/src/plugins/resourceeditor/resourceeditorfactory.cpp
@@ -44,31 +44,19 @@ using namespace ResourceEditor::Constants;
 
 ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin) :
     Core::IEditorFactory(plugin),
-    m_mimeTypes(QStringList(QLatin1String(C_RESOURCE_MIMETYPE))),
     m_plugin(plugin)
 {
+    setId(RESOURCEEDITOR_ID);
+    setMimeTypes(QStringList(QLatin1String(C_RESOURCE_MIMETYPE)));
+    setDisplayName(qApp->translate("OpenWith::Editors", C_RESOURCEEDITOR_DISPLAY_NAME));
+
     Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
     iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/resourceeditor/images/qt_qrc.png")),
                                                QLatin1String("qrc"));
 }
 
-Core::Id ResourceEditorFactory::id() const
-{
-    return Core::Id(RESOURCEEDITOR_ID);
-}
-
-QString ResourceEditorFactory::displayName() const
-{
-    return qApp->translate("OpenWith::Editors", C_RESOURCEEDITOR_DISPLAY_NAME);
-}
-
 Core::IEditor *ResourceEditorFactory::createEditor(QWidget *parent)
 {
     Core::Context context(ResourceEditor::Constants::C_RESOURCEEDITOR);
     return new ResourceEditorW(context, m_plugin, parent);
 }
-
-QStringList ResourceEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
diff --git a/src/plugins/resourceeditor/resourceeditorfactory.h b/src/plugins/resourceeditor/resourceeditorfactory.h
index e1f84e437a1..f0878be78f0 100644
--- a/src/plugins/resourceeditor/resourceeditorfactory.h
+++ b/src/plugins/resourceeditor/resourceeditorfactory.h
@@ -47,15 +47,9 @@ class ResourceEditorFactory : public Core::IEditorFactory
 public:
     explicit ResourceEditorFactory(ResourceEditorPlugin *plugin);
 
-    virtual QStringList mimeTypes() const;
-
-    // IEditorFactory
-    Core::Id id() const;
-    QString displayName() const;
     Core::IEditor *createEditor(QWidget *parent);
 
 private:
-    const QStringList m_mimeTypes;
     ResourceEditorPlugin *m_plugin;
 };
 
diff --git a/src/plugins/tasklist/taskfilefactory.cpp b/src/plugins/tasklist/taskfilefactory.cpp
index 7fc761f0401..19c67ada1e6 100644
--- a/src/plugins/tasklist/taskfilefactory.cpp
+++ b/src/plugins/tasklist/taskfilefactory.cpp
@@ -33,7 +33,6 @@
 
 #include <projectexplorer/projectexplorer.h>
 #include <coreplugin/icore.h>
-#include <coreplugin/id.h>
 #include <coreplugin/documentmanager.h>
 
 #include <QMessageBox>
@@ -45,26 +44,11 @@ using namespace TaskList::Internal;
 // --------------------------------------------------------------------------
 
 TaskFileFactory::TaskFileFactory(QObject * parent) :
-    Core::IDocumentFactory(parent),
-    m_mimeTypes(QStringList() << QLatin1String("text/x-tasklist"))
-{ }
-
-TaskFileFactory::~TaskFileFactory()
-{ }
-
-QStringList TaskFileFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
-
-Core::Id TaskFileFactory::id() const
-{
-    return Core::Id("ProjectExplorer.TaskFileFactory");
-}
-
-QString TaskFileFactory::displayName() const
+    Core::IDocumentFactory(parent)
 {
-    return tr("Task file reader");
+    setId("ProjectExplorer.TaskFileFactory");
+    setDisplayName(tr("Task file reader"));
+    addMimeType(QLatin1String("text/x-tasklist"));
 }
 
 Core::IDocument *TaskFileFactory::open(const QString &fileName)
diff --git a/src/plugins/tasklist/taskfilefactory.h b/src/plugins/tasklist/taskfilefactory.h
index 3a28ecb986c..9dc7bbec159 100644
--- a/src/plugins/tasklist/taskfilefactory.h
+++ b/src/plugins/tasklist/taskfilefactory.h
@@ -33,11 +33,7 @@
 #include <coreplugin/idocumentfactory.h>
 #include <coreplugin/idocument.h>
 
-#include <QStringList>
-
-namespace ProjectExplorer {
-class Project;
-} // namespace ProjectExplorer
+namespace ProjectExplorer { class Project; }
 
 namespace TaskList {
 namespace Internal {
@@ -45,14 +41,9 @@ namespace Internal {
 class TaskFileFactory : public Core::IDocumentFactory
 {
     Q_OBJECT
+
 public:
     TaskFileFactory(QObject *parent = 0);
-    ~TaskFileFactory();
-
-    QStringList mimeTypes() const;
-
-    Core::Id id() const;
-    QString displayName() const;
 
     Core::IDocument *open(const QString &fileName);
     Core::IDocument *open(ProjectExplorer::Project *context, const QString &fileName);
@@ -60,7 +51,6 @@ public:
     void closeAllFiles();
 
 private:
-    QStringList m_mimeTypes;
     QList<Core::IDocument *> m_openFiles;
 };
 
diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp
index d58827e3670..c31d411e582 100644
--- a/src/plugins/texteditor/plaintexteditorfactory.cpp
+++ b/src/plugins/texteditor/plaintexteditorfactory.cpp
@@ -46,12 +46,15 @@ using namespace TextEditor::Internal;
 PlainTextEditorFactory::PlainTextEditorFactory(QObject *parent)
   : Core::IEditorFactory(parent)
 {
+    setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
+    setDisplayName(qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME));
+    addMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
+
     m_actionHandler = new TextEditorActionHandler(
         TextEditor::Constants::C_TEXTEDITOR,
         TextEditorActionHandler::Format |
         TextEditorActionHandler::UnCommentSelection |
         TextEditorActionHandler::UnCollapseAll);
-    m_mimeTypes << QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT);
 }
 
 PlainTextEditorFactory::~PlainTextEditorFactory()
@@ -59,16 +62,6 @@ PlainTextEditorFactory::~PlainTextEditorFactory()
     delete m_actionHandler;
 }
 
-Core::Id PlainTextEditorFactory::id() const
-{
-    return Core::Id(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
-}
-
-QString PlainTextEditorFactory::displayName() const
-{
-    return qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME);
-}
-
 Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent)
 {
     PlainTextEditorWidget *rc = new PlainTextEditorWidget(parent);
@@ -106,13 +99,3 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
         }
     }
 }
-
-void PlainTextEditorFactory::addMimeType(const QString &type)
-{
-    m_mimeTypes.append(type);
-}
-
-QStringList PlainTextEditorFactory::mimeTypes() const
-{
-    return m_mimeTypes;
-}
diff --git a/src/plugins/texteditor/plaintexteditorfactory.h b/src/plugins/texteditor/plaintexteditorfactory.h
index 712c6701ff7..facf43fa9b7 100644
--- a/src/plugins/texteditor/plaintexteditorfactory.h
+++ b/src/plugins/texteditor/plaintexteditorfactory.h
@@ -44,22 +44,16 @@ class PlainTextEditorFactory : public Core::IEditorFactory
 
 public:
     PlainTextEditorFactory(QObject *parent = 0);
-    virtual ~PlainTextEditorFactory();
+    ~PlainTextEditorFactory();
 
-    void addMimeType(const QString &type);
-    virtual QStringList mimeTypes() const;
-    //Core::IEditorFactory
-    Core::Id id() const;
-    QString displayName() const;
+    using Core::IEditorFactory::addMimeType;
     Core::IEditor *createEditor(QWidget *parent);
-
     TextEditor::TextEditorActionHandler *actionHandler() const { return m_actionHandler; }
 
 private slots:
     void updateEditorInfoBar(Core::IEditor *editor);
 
 private:
-    QStringList m_mimeTypes;
     TextEditor::TextEditorActionHandler *m_actionHandler;
 };
 
diff --git a/src/plugins/vcsbase/basevcseditorfactory.cpp b/src/plugins/vcsbase/basevcseditorfactory.cpp
index 0d2780bf45d..924fa3c1d4e 100644
--- a/src/plugins/vcsbase/basevcseditorfactory.cpp
+++ b/src/plugins/vcsbase/basevcseditorfactory.cpp
@@ -54,16 +54,11 @@ public:
     BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t);
 
     const VcsBaseEditorParameters *m_type;
-    const Core::Id m_id;
-    QString m_displayName;
-    const QStringList m_mimeTypes;
     TextEditor::TextEditorActionHandler *m_editorHandler;
 };
 
 BaseVcsEditorFactoryPrivate::BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t) :
     m_type(t),
-    m_id(t->id),
-    m_mimeTypes(QStringList(QLatin1String(t->mimeType))),
     m_editorHandler(new TextEditor::TextEditorActionHandler(t->context))
 {
 }
@@ -73,7 +68,9 @@ BaseVcsEditorFactoryPrivate::BaseVcsEditorFactoryPrivate(const VcsBaseEditorPara
 BaseVcsEditorFactory::BaseVcsEditorFactory(const VcsBaseEditorParameters *t)
   : d(new Internal::BaseVcsEditorFactoryPrivate(t))
 {
-    d->m_displayName = QCoreApplication::translate("VCS", t->displayName);
+    setId(t->id);
+    setDisplayName(QCoreApplication::translate("VCS", t->displayName));
+    addMimeType(t->mimeType);
 }
 
 BaseVcsEditorFactory::~BaseVcsEditorFactory()
@@ -81,26 +78,11 @@ BaseVcsEditorFactory::~BaseVcsEditorFactory()
     delete d;
 }
 
-QStringList BaseVcsEditorFactory::mimeTypes() const
-{
-    return d->m_mimeTypes;
-}
-
-Core::Id BaseVcsEditorFactory::id() const
-{
-    return d->m_id;
-}
-
-QString BaseVcsEditorFactory::displayName() const
-{
-    return d->m_displayName;
-}
-
 Core::IEditor *BaseVcsEditorFactory::createEditor(QWidget *parent)
 {
     VcsBaseEditorWidget *vcsEditor = createVcsBaseEditor(d->m_type, parent);
 
-    vcsEditor ->setMimeType(d->m_mimeTypes.front());
+    vcsEditor->setMimeType(mimeTypes().front());
     d->m_editorHandler->setupActions(vcsEditor);
 
     // Wire font settings and set initial values
diff --git a/src/plugins/vcsbase/basevcseditorfactory.h b/src/plugins/vcsbase/basevcseditorfactory.h
index 1f0d4402009..727ac353cae 100644
--- a/src/plugins/vcsbase/basevcseditorfactory.h
+++ b/src/plugins/vcsbase/basevcseditorfactory.h
@@ -35,8 +35,6 @@
 
 #include <coreplugin/editormanager/ieditorfactory.h>
 
-QT_FORWARD_DECLARE_CLASS(QStringList)
-
 namespace VcsBase {
 namespace Internal {
 class BaseVcsEditorFactoryPrivate;
@@ -45,15 +43,11 @@ class BaseVcsEditorFactoryPrivate;
 class VCSBASE_EXPORT BaseVcsEditorFactory : public Core::IEditorFactory
 {
     Q_OBJECT
+
 public:
     explicit BaseVcsEditorFactory(const VcsBaseEditorParameters *type);
     ~BaseVcsEditorFactory();
 
-    QStringList mimeTypes() const;
-    // IEditorFactory
-
-    Core::Id id() const;
-    QString displayName() const;
     Core::IEditor *createEditor(QWidget *parent);
 
 private:
diff --git a/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp b/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp
index d17ba6a582b..8ceed8177e1 100644
--- a/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp
+++ b/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp
@@ -32,58 +32,21 @@
 
 namespace VcsBase {
 
-namespace Internal {
-
-class BaseVcsSubmitEditorFactoryPrivate
-{
-public:
-    BaseVcsSubmitEditorFactoryPrivate(const VcsBaseSubmitEditorParameters *parameters);
-
-    const VcsBaseSubmitEditorParameters *m_parameters;
-    const Core::Id m_id;
-    const QString m_displayName;
-    const QStringList m_mimeTypes;
-};
-
-BaseVcsSubmitEditorFactoryPrivate::BaseVcsSubmitEditorFactoryPrivate(const VcsBaseSubmitEditorParameters *parameters) :
-    m_parameters(parameters),
-    m_id(parameters->id),
-    m_displayName(QLatin1String(parameters->displayName)),
-    m_mimeTypes(QLatin1String(parameters->mimeType))
-{
-}
-
-} // namespace Internal
-
-BaseVcsSubmitEditorFactory::BaseVcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters) :
-    d(new Internal::BaseVcsSubmitEditorFactoryPrivate(parameters))
+BaseVcsSubmitEditorFactory::BaseVcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters)
+    : m_parameters(parameters)
 {
+    setId(parameters->id);
+    setDisplayName(QLatin1String(parameters->displayName));
+    addMimeType(parameters->mimeType);
 }
 
 BaseVcsSubmitEditorFactory::~BaseVcsSubmitEditorFactory()
 {
-    delete d;
 }
 
 Core::IEditor *BaseVcsSubmitEditorFactory::createEditor(QWidget *parent)
 {
-    return createBaseSubmitEditor(d->m_parameters, parent);
-}
-
-Core::Id BaseVcsSubmitEditorFactory::id() const
-{
-    return d->m_id;
-}
-
-QString BaseVcsSubmitEditorFactory::displayName() const
-{
-    return d->m_displayName;
-}
-
-
-QStringList BaseVcsSubmitEditorFactory::mimeTypes() const
-{
-    return d->m_mimeTypes;
+    return createBaseSubmitEditor(m_parameters, parent);
 }
 
 } // namespace VcsBase
diff --git a/src/plugins/vcsbase/basevcssubmiteditorfactory.h b/src/plugins/vcsbase/basevcssubmiteditorfactory.h
index 7943df52e08..95280ca34b9 100644
--- a/src/plugins/vcsbase/basevcssubmiteditorfactory.h
+++ b/src/plugins/vcsbase/basevcssubmiteditorfactory.h
@@ -39,10 +39,6 @@ namespace VcsBase {
 class VcsBaseSubmitEditor;
 class VcsBaseSubmitEditorParameters;
 
-namespace Internal {
-class BaseVcsSubmitEditorFactoryPrivate;
-} // namespace Internal
-
 // Parametrizable base class for editor factories creating instances of
 // VcsBaseSubmitEditor subclasses.
 class VCSBASE_EXPORT BaseVcsSubmitEditorFactory : public Core::IEditorFactory
@@ -51,21 +47,17 @@ class VCSBASE_EXPORT BaseVcsSubmitEditorFactory : public Core::IEditorFactory
 
 protected:
     explicit BaseVcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters);
-
-public:
     ~BaseVcsSubmitEditorFactory();
 
+public:
     Core::IEditor *createEditor(QWidget *parent);
-    Core::Id id() const;
-    QString displayName() const;
-    QStringList mimeTypes() const;
 
 private:
     virtual VcsBaseSubmitEditor
         *createBaseSubmitEditor(const VcsBaseSubmitEditorParameters *parameters,
                                 QWidget *parent) = 0;
 
-    Internal::BaseVcsSubmitEditorFactoryPrivate *const d;
+    const VcsBaseSubmitEditorParameters *const m_parameters; // Not owned.
 };
 
 // Utility template to create an editor that has a constructor taking the
-- 
GitLab