diff --git a/share/qtcreator/templates/wizards/helloworld/wizard_sample.xml b/share/qtcreator/templates/wizards/helloworld/wizard_sample.xml
index d216ea61780d3f5e4b0424acecef488937228cfd..7f343b666a47a61dce026cfc7968a42e0132b800 100644
--- a/share/qtcreator/templates/wizards/helloworld/wizard_sample.xml
+++ b/share/qtcreator/templates/wizards/helloworld/wizard_sample.xml
@@ -42,8 +42,8 @@ leave room for the Qt 4 target page.
     <displayname>Hello World</displayname>;
     <displaycategory>Custom Projects</displaycategory>
     <files>
-        <file source="main.cpp"/>
-        <file source="project.pro" target="%ProjectName%.pro"/>
+        <file source="main.cpp" openeditor="true"/>
+        <file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
     </files>
     <!-- Create a 2nd wizard page with parameters -->
     <fieldpagetitle>Hello World Parameters</fieldpagetitle>
diff --git a/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml b/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml
index c81715fc860f012db8f9babeee00e68dc2874dc8..910dce154d867bf812a1ab523fc0249a32dd7b92 100644
--- a/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml
+++ b/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml
@@ -38,8 +38,8 @@ Custom class wizard example configuration file. -->
     <displaycategory>Custom Classes</displaycategory>
     <displaycategory xml:lang="de">Benutzerdefinierte Klassen</displaycategory>
     <files>
-        <file source="listmodel.cpp" target="%ClassName:l%.%CppSourceSuffix%"/>
-        <file source="listmodel.h" target="%ClassName:l%.%CppHeaderSuffix%"/>
+        <file source="listmodel.cpp" target="%ClassName:l%.%CppSourceSuffix%" openeditor="true"/>
+        <file source="listmodel.h" target="%ClassName:l%.%CppHeaderSuffix%" openeditor="true"/>
     </files>
     <!-- Create parameter wizard page -->
     <fieldpagetitle>ListModel parameters</fieldpagetitle>
diff --git a/share/qtcreator/templates/wizards/qml-runtime/wizard.xml b/share/qtcreator/templates/wizards/qml-runtime/wizard.xml
index a7a53a5d908a9fbc4ec573fa55d338e13a290942..de785e26f614bfeb4ffece14746389fee36d0e4d 100644
--- a/share/qtcreator/templates/wizards/qml-runtime/wizard.xml
+++ b/share/qtcreator/templates/wizards/qml-runtime/wizard.xml
@@ -45,8 +45,8 @@ leave room for the Qt 4 target page.
         <file source="plugin.h" target="%ProjectName%.h"/>
         <file source="plugin.cpp" target="%ProjectName%.cpp"/>
         <file source="object.h" target="%ObjectName%.h"/>
-        <file source="object.cpp" target="%ObjectName%.cpp"/>
-        <file source="project.pro" target="%ProjectName%.pro"/>
+        <file source="object.cpp" target="%ObjectName%.cpp"  openeditor="true"/>
+        <file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
     </files>
     <!-- Create a 2nd wizard page with parameters -->
     <fieldpagetitle>QML Runtime Plug-in Parameters</fieldpagetitle>
diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp
index c136fd7172413790d3b7ae0eed38b5eed470fc4a..4c1309ddfb9b417b3b20f3b5291c2731a9eca92a 100644
--- a/src/plugins/coreplugin/basefilewizard.cpp
+++ b/src/plugins/coreplugin/basefilewizard.cpp
@@ -66,11 +66,13 @@ public:
     QByteArray contents;
     QString editorId;
     bool binary;
+    GeneratedFile::Attributes attributes;
 };
 
 GeneratedFilePrivate::GeneratedFilePrivate(const QString &p) :
     path(p),
-    binary(false)
+    binary(false),
+    attributes(0)
 {
 }
 
@@ -180,6 +182,15 @@ bool GeneratedFile::write(QString *errorMessage) const
     return true;
 }
 
+GeneratedFile::Attributes GeneratedFile::attributes() const
+{
+    return m_d->attributes;
+}
+
+void GeneratedFile::setAttributes(Attributes a)
+{
+    m_d->attributes = a;
+}
 
 // ------------ BaseFileWizardParameterData
 class BaseFileWizardParameterData : public QSharedData
@@ -584,16 +595,21 @@ void BaseFileWizard::applyExtensionPageShortTitle(Utils::Wizard *wizard, int pag
       item->setTitle(shortTitle);
 }
 
-bool BaseFileWizard::postGenerateFiles(const QWizard *w, const GeneratedFiles &l, QString *errorMessage)
+bool BaseFileWizard::postGenerateFiles(const QWizard *, const GeneratedFiles &l, QString *errorMessage)
+{
+    return BaseFileWizard::postGenerateOpenEditors(l, errorMessage);
+}
+
+bool BaseFileWizard::postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage)
 {
-    Q_UNUSED(w);
-    // File mode: open the editors in file mode and ensure editor pane
-    const Core::GeneratedFiles::const_iterator cend = l.constEnd();
     Core::EditorManager *em = Core::EditorManager::instance();
-    for (Core::GeneratedFiles::const_iterator it = l.constBegin(); it != cend; ++it) {
-        if (!em->openEditor(it->path(), it->editorId())) {
-            *errorMessage = tr("Failed to open an editor for '%1'.").arg(it->path());
-            return false;
+    foreach(const Core::GeneratedFile &file, l) {
+        if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) {
+            if (!em->openEditor(file.path(), file.editorId())) {
+                if (errorMessage)
+                    *errorMessage = tr("Failed to open an editor for '%1'.").arg(file.path());
+                return false;
+            }
         }
     }
     return true;
diff --git a/src/plugins/coreplugin/basefilewizard.h b/src/plugins/coreplugin/basefilewizard.h
index 7a8536cea88d9fe2b5cff90b79f72a9c685ee0e5..9a03410eeeb8d93cbdbe024e2f7e4c15a2712042 100644
--- a/src/plugins/coreplugin/basefilewizard.h
+++ b/src/plugins/coreplugin/basefilewizard.h
@@ -65,6 +65,9 @@ class GeneratedFilePrivate;
 class CORE_EXPORT GeneratedFile
 {
 public:
+    enum Attribute { OpenEditorAttribute = 0x01, OpenProjectAttribute = 0x02 };
+    Q_DECLARE_FLAGS(Attributes, Attribute)
+
     GeneratedFile();
     explicit GeneratedFile(const QString &path);
     GeneratedFile(const GeneratedFile &);
@@ -92,6 +95,9 @@ public:
 
     bool write(QString *errorMessage) const;
 
+    Attributes attributes() const;
+    void setAttributes(Attributes a);
+
 private:
     QSharedDataPointer<GeneratedFilePrivate> m_d;
 };
@@ -207,6 +213,10 @@ protected:
     OverwriteResult promptOverwrite(const QString &location,
                                     const QStringList &files,
                                     QString *errorMessage) const;
+
+    // Utility to open the editors for the files whose attribute is set accordingly.
+    static bool postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage = 0);
+
 private:
     BaseFileWizardPrivate *m_d;
 };
@@ -239,4 +249,6 @@ protected:
 
 } // namespace Core
 
+Q_DECLARE_OPERATORS_FOR_FLAGS(Core::GeneratedFile::Attributes)
+
 #endif // BASEFILEWIZARD_H
diff --git a/src/plugins/cppeditor/cppclasswizard.cpp b/src/plugins/cppeditor/cppclasswizard.cpp
index 4c8caeb8cafb14fe1aeeb634431d3411d03a3cfa..2333cc4daff97ffea1a4e883f81f0d7b7a73f2fc 100644
--- a/src/plugins/cppeditor/cppclasswizard.cpp
+++ b/src/plugins/cppeditor/cppclasswizard.cpp
@@ -209,7 +209,10 @@ Core::GeneratedFiles CppClassWizard::generateFiles(const QWizard *w, QString *er
         return Core::GeneratedFiles();
     }
     headerFile.setContents(header);
+    headerFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
+
     sourceFile.setContents(source);
+    sourceFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
     return Core::GeneratedFiles() << headerFile << sourceFile;
 }
 
diff --git a/src/plugins/cppeditor/cppfilewizard.cpp b/src/plugins/cppeditor/cppfilewizard.cpp
index 419771f4eb761bb29a310812a83cb91273e418db..eff7f24266113ec44307f50564250d6702643923 100644
--- a/src/plugins/cppeditor/cppfilewizard.cpp
+++ b/src/plugins/cppeditor/cppfilewizard.cpp
@@ -62,7 +62,7 @@ Core::GeneratedFiles CppFileWizard::generateFilesFromPath(const QString &path,
     Core::GeneratedFile file(fileName);
     file.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
     file.setContents(fileContents(m_type, fileName));
-
+    file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
     return Core::GeneratedFiles() << file;
 }
 
diff --git a/src/plugins/designer/cpp/formclasswizard.cpp b/src/plugins/designer/cpp/formclasswizard.cpp
index e8cc25f7fd075a8bc668c34fca7b48c387a7c677..7a174ce5bbdb4e4901b4135fd539c44d687d61dd 100644
--- a/src/plugins/designer/cpp/formclasswizard.cpp
+++ b/src/plugins/designer/cpp/formclasswizard.cpp
@@ -88,15 +88,18 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
 
     Core::GeneratedFile headerFile(headerFileName);
     headerFile.setEditorId(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
+    headerFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
 
     // Source
     Core::GeneratedFile sourceFile(sourceFileName);
     sourceFile.setEditorId(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
+    sourceFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
 
     // UI
     Core::GeneratedFile uiFile(formFileName);
     uiFile.setContents(params.uiTemplate());
     uiFile.setEditorId(QLatin1String(Constants::DESIGNER_XML_EDITOR_ID));
+    uiFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
 
     QString source, header;
     Designer::FormClassWizardGenerationParameters generationParameters;
diff --git a/src/plugins/designer/formwizard.cpp b/src/plugins/designer/formwizard.cpp
index 454883b54aba4d161a8ae4ac30dd707b29112a78..30702087c76065241c2f7254ca936f2de311b3d9 100644
--- a/src/plugins/designer/formwizard.cpp
+++ b/src/plugins/designer/formwizard.cpp
@@ -67,5 +67,6 @@ Core::GeneratedFiles FormWizard::generateFiles(const QWizard *w,
     Core::GeneratedFile file(fileName);
     file.setContents(formTemplate);
     file.setEditorId(QLatin1String(Constants::DESIGNER_XML_EDITOR_ID));
+    file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
     return Core::GeneratedFiles() << file;
 }
diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp
index 3551523e88679d1fc107d951c8e3576884988fbf..4d6b33655fea5d908843ef3d664de87d0a48a441 100644
--- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp
@@ -31,8 +31,8 @@
 
 #include <coreplugin/icore.h>
 #include <coreplugin/mimedatabase.h>
-#include <projectexplorer/projectexplorer.h>
 #include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/customwizard/customwizard.h>
 
 #include <utils/filewizardpage.h>
 
@@ -198,6 +198,7 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
 
     Core::GeneratedFile generatedCreatorFile(creatorFileName);
     generatedCreatorFile.setContents(QLatin1String("[General]\n"));
+    generatedCreatorFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
 
     Core::GeneratedFile generatedFilesFile(filesFileName);
     generatedFilesFile.setContents(sources.join(QLatin1String("\n")));
@@ -220,12 +221,5 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
 bool GenericProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
 {
     Q_UNUSED(w);
-    // Post-Generate: Open the project
-    const QString proFileName = l.back().path();
-    if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFileName)) {
-        *errorMessage = tr("The project %1 could not be opened.").arg(proFileName);
-        return false;
-    }
-    return true;
+    return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
 }
-
diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp
index ae40298001934a6a107192fa817456bbec7fcefe..829ed1e0288c209ee6241cdc9dfd57a70a81d673 100644
--- a/src/plugins/projectexplorer/customwizard/customwizard.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp
@@ -161,6 +161,12 @@ static inline bool createFile(Internal::CustomWizardFile cwFile,
     Core::GeneratedFile generatedFile;
     generatedFile.setContents(contents);
     generatedFile.setPath(targetPath);
+    Core::GeneratedFile::Attributes attributes = 0;
+    if (cwFile.openEditor)
+        attributes |= Core::GeneratedFile::OpenEditorAttribute;
+    if (cwFile.openProject)
+        attributes |= Core::GeneratedFile::OpenProjectAttribute;
+    generatedFile.setAttributes(attributes);
     files->push_back(generatedFile);
     return true;
 }
@@ -410,18 +416,26 @@ Core::GeneratedFiles CustomProjectWizard::generateFiles(const QWizard *w, QStrin
     return generateWizardFiles(targetPath, fieldReplacementMap, errorMessage);
 }
 
+bool CustomProjectWizard::postGenerateOpen(const Core::GeneratedFiles &l, QString *errorMessage)
+{
+    // Post-Generate: Open the project and the editors as desired
+    foreach(const Core::GeneratedFile &file, l) {
+        if (file.attributes() & Core::GeneratedFile::OpenProjectAttribute) {
+            if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(file.path())) {
+                if (errorMessage)
+                    *errorMessage = tr("The project %1 could not be opened.").arg(file.path());
+                return false;
+            }
+        }
+    }
+    return BaseFileWizard::postGenerateOpenEditors(l, errorMessage);
+}
+
 bool CustomProjectWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage)
 {
-    // Post-Generate: Open the project
-    const QString proFileName = l.back().path();
-    const bool opened = ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFileName);
     if (CustomWizardPrivate::verbose)
-        qDebug() << "CustomProjectWizard::postGenerateFiles: opened " << proFileName << opened;
-    if (opened) {
-        *errorMessage = tr("The project %1 could not be opened.").arg(proFileName);
-        return false;
-    }
-    return true;
+        qDebug() << "CustomProjectWizard::postGenerateFiles()";
+    return CustomProjectWizard::postGenerateOpen(l, errorMessage);
 }
 
 void CustomProjectWizard::introPageLeft(const QString &project, const QString & /* path */)
diff --git a/src/plugins/projectexplorer/customwizard/customwizard.h b/src/plugins/projectexplorer/customwizard/customwizard.h
index 522c31d580e3ccb3b3182e15955713d6e1fe1797..7816bf3aef0c415370eb98defcb4b3d7a2bc3236 100644
--- a/src/plugins/projectexplorer/customwizard/customwizard.h
+++ b/src/plugins/projectexplorer/customwizard/customwizard.h
@@ -154,6 +154,10 @@ public:
 
     virtual Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
 
+    // Utility to open the projects and editors for the files that have
+    // the respective attributes set.
+    static bool postGenerateOpen(const Core::GeneratedFiles &l, QString *errorMessage = 0);
+
 protected:
     virtual bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
 
diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp
index 982668ee68455eebcdc864f73d62637f36530b37..2f3d902c88e063eca9582114f91a2fe5dae23174 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp
@@ -68,6 +68,9 @@ static const char filesElementC[] = "files";
 static const char fileElementC[] = "file";
 static const char fileNameSourceAttributeC[] = "source";
 static const char fileNameTargetAttributeC[] = "target";
+static const char fileNameOpenEditorAttributeC[] = "openeditor";
+static const char fileNameOpenProjectAttributeC[] = "openproject";
+
 
 enum ParseState {
     ParseBeginning,
@@ -95,6 +98,11 @@ void CustomWizardField::clear()
     controlAttributes.clear();
 }
 
+CustomWizardFile::CustomWizardFile() :
+        openEditor(false), openProject(false)
+{
+}
+
 CustomWizardParameters::CustomWizardParameters() :
         firstPageId(-1)
 {
@@ -409,6 +417,8 @@ bool CustomWizardParameters::parse(QIODevice &device,
                         CustomWizardFile file;
                         file.source = attributeValue(reader, fileNameSourceAttributeC);
                         file.target = attributeValue(reader, fileNameTargetAttributeC);
+                        file.openEditor = booleanAttributeValue(reader, fileNameOpenEditorAttributeC);
+                        file.openProject = booleanAttributeValue(reader, fileNameOpenProjectAttributeC);
                         if (file.target.isEmpty())
                             file.target = file.source;
                         if (file.source.isEmpty()) {
@@ -460,7 +470,12 @@ QString CustomWizardParameters::toString() const
     QTextStream str(&rc);
     str << "Directory: " << directory << " Klass: '" << klass << "'\n";
     foreach(const CustomWizardFile &f, files) {
-        str << "  File source: " << f.source << " Target: " << f.target << '\n';
+        str << "  File source: " << f.source << " Target: " << f.target;
+        if (f.openEditor)
+            str << " [editor]";
+        if (f.openProject)
+            str << " [project]";
+        str << '\n';
     }
     foreach(const CustomWizardField &f, fields) {
         str << "  Field name: " << f.name;
diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.h b/src/plugins/projectexplorer/customwizard/customwizardparameters.h
index 63c6c0adbc153e9e40203d0a90bf691e70ab0d1e..f71de2b612bd36cafe38d7b5f2b7cad1d9225687 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardparameters.h
+++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.h
@@ -56,8 +56,12 @@ struct CustomWizardField {
 };
 
 struct CustomWizardFile {
+    CustomWizardFile();
+
     QString source;
     QString target;
+    bool openEditor;
+    bool openProject;
 };
 
 struct CustomWizardParameters
diff --git a/src/plugins/qmljseditor/qmlfilewizard.cpp b/src/plugins/qmljseditor/qmlfilewizard.cpp
index 8502ad11dc309b36917f1ca6e77cb04b045c19fc..1d09447b351a3e5c228da50123a5b6f915781bca 100644
--- a/src/plugins/qmljseditor/qmlfilewizard.cpp
+++ b/src/plugins/qmljseditor/qmlfilewizard.cpp
@@ -52,7 +52,7 @@ Core::GeneratedFiles QmlFileWizard::generateFilesFromPath(const QString &path,
     Core::GeneratedFile file(fileName);
     file.setEditorId(QLatin1String(Constants::C_QMLJSEDITOR_ID));
     file.setContents(fileContents(fileName));
-
+    file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
     return Core::GeneratedFiles() << file;
 }
 
diff --git a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
index 7bf0620a19245536dd2b2e8271cf0e123f268bf6..d52bec61b3af4428c7e6f49564731d15a5d0ac58 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
@@ -31,8 +31,7 @@
 
 #include "qmlprojectconstants.h"
 
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/customwizard/customwizard.h>
 
 #include <QtGui/QIcon>
 
@@ -120,6 +119,7 @@ Core::GeneratedFiles QmlProjectApplicationWizard::generateFiles(const QWizard *w
     }
     Core::GeneratedFile generatedMainFile(mainFileName);
     generatedMainFile.setContents(contents);
+    generatedMainFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
 
     QString projectContents;
     {
@@ -150,6 +150,7 @@ Core::GeneratedFiles QmlProjectApplicationWizard::generateFiles(const QWizard *w
     }
     Core::GeneratedFile generatedCreatorFile(creatorFileName);
     generatedCreatorFile.setContents(projectContents);
+    generatedCreatorFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
 
     Core::GeneratedFiles files;
     files.append(generatedMainFile);
@@ -158,16 +159,10 @@ Core::GeneratedFiles QmlProjectApplicationWizard::generateFiles(const QWizard *w
     return files;
 }
 
-bool QmlProjectApplicationWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
+bool QmlProjectApplicationWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage)
 {
-    Q_UNUSED(w);
-    // Post-Generate: Open the project
-    const QString proFileName = l.back().path();
-    if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFileName)) {
-        *errorMessage = tr("The project %1 could not be opened.").arg(proFileName);
-        return false;
-    }
-    return true;
+    return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
+
 }
 
 } // namespace Internal
diff --git a/src/plugins/qmlprojectmanager/qmlprojectimportwizard.cpp b/src/plugins/qmlprojectmanager/qmlprojectimportwizard.cpp
index e1527b847d5f2f95e4445a72f2c4233045234d05..b7165143d00f8bfb3363737d5da89f204a990429 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectimportwizard.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectimportwizard.cpp
@@ -33,8 +33,7 @@
 
 #include <coreplugin/icore.h>
 #include <coreplugin/mimedatabase.h>
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/customwizard/customwizard.h>
 
 #include <utils/filenamevalidatinglineedit.h>
 #include <utils/filewizardpage.h>
@@ -166,6 +165,7 @@ Core::GeneratedFiles QmlProjectImportWizard::generateFiles(const QWizard *w,
     }
     Core::GeneratedFile generatedCreatorFile(creatorFileName);
     generatedCreatorFile.setContents(projectContents);
+    generatedCreatorFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
 
     Core::GeneratedFiles files;
     files.append(generatedCreatorFile);
@@ -173,16 +173,9 @@ Core::GeneratedFiles QmlProjectImportWizard::generateFiles(const QWizard *w,
     return files;
 }
 
-bool QmlProjectImportWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
+bool QmlProjectImportWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage)
 {
-    Q_UNUSED(w);
-    // Post-Generate: Open the project
-    const QString proFileName = l.back().path();
-    if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFileName)) {
-        *errorMessage = tr("The project %1 could not be opened.").arg(proFileName);
-        return false;
-    }
-    return true;
+    return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l ,errorMessage);
 }
 
 } // namespace Internal
diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/plugingenerator.cpp b/src/plugins/qt4projectmanager/customwidgetwizard/plugingenerator.cpp
index b5f389508c4c441959721476a36887d74797f530..0da9c70f200c120423f8f1e3a442b05e407f6b34 100644
--- a/src/plugins/qt4projectmanager/customwidgetwizard/plugingenerator.cpp
+++ b/src/plugins/qt4projectmanager/customwidgetwizard/plugingenerator.cpp
@@ -93,7 +93,9 @@ QList<Core::GeneratedFile>  PluginGenerator::generatePlugin(const GenerationPara
 
     // First create the widget wrappers (plugins) and - if requested - skeletons
     // for the widgets.
-    foreach (const PluginOptions::WidgetOptions &wo, options.widgetOptions) {
+    const int widgetCount = options.widgetOptions.size();
+    for (int i = 0; i < widgetCount; i++) {
+        const PluginOptions::WidgetOptions &wo = options.widgetOptions.at(i);
         sm.clear();
         sm.insert(QLatin1String("SINGLE_INCLUDE_GUARD"), headerGuard(wo.pluginHeaderFile));
         sm.insert(QLatin1String("PLUGIN_CLASS"), wo.pluginClassName);
@@ -133,6 +135,8 @@ QList<Core::GeneratedFile>  PluginGenerator::generatePlugin(const GenerationPara
             return QList<Core::GeneratedFile>();
         Core::GeneratedFile pluginSource(baseDir + wo.pluginSourceFile);
         pluginSource.setContents(p.license + pluginSourceContents);
+        if (i == 0 && widgetCount == 1) // Open first widget unless collection
+            pluginSource.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
         rc.push_back(pluginSource);
 
         if (wo.sourceType == PluginOptions::WidgetOptions::LinkLibrary)
@@ -209,7 +213,7 @@ QList<Core::GeneratedFile>  PluginGenerator::generatePlugin(const GenerationPara
     }
 
     // Create the sources for the collection if necessary.
-    if (options.widgetOptions.count() > 1) {
+    if (widgetCount > 1) {
         sm.clear();
         sm.insert(QLatin1String("COLLECTION_INCLUDE_GUARD"), headerGuard(options.collectionHeaderFile));
         sm.insert(QLatin1String("COLLECTION_PLUGIN_CLASS"), options.collectionClassName);
@@ -238,6 +242,7 @@ QList<Core::GeneratedFile>  PluginGenerator::generatePlugin(const GenerationPara
             return QList<Core::GeneratedFile>();
         Core::GeneratedFile collectionSource(baseDir + options.collectionSourceFile);
         collectionSource.setContents(p.license + collectionSourceFileContents);
+        collectionSource.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
         rc.push_back(collectionSource);
 
         pluginHeaders += blank + options.collectionHeaderFile;
@@ -282,6 +287,7 @@ QList<Core::GeneratedFile>  PluginGenerator::generatePlugin(const GenerationPara
         return QList<Core::GeneratedFile>();
     Core::GeneratedFile proFile(baseDir + p.fileName + QLatin1String(".pro"));
     proFile.setContents(proFileContents);
+    proFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
     rc.push_back(proFile);
     return rc;
 }
diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp
index 7b79d3c8ded0af4ca5cc3daf5352f5f93c9a50ba..11f313b8292dae6e63ce1c8f491c4aad7e43de78 100644
--- a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp
@@ -87,10 +87,12 @@ Core::GeneratedFiles
     const QString sourceFileName = Core::BaseFileWizard::buildFileName(projectPath, QLatin1String(mainSourceFileC), sourceSuffix());
     Core::GeneratedFile source(sourceFileName);
     source.setContents(license + QLatin1String(mainCppC));
+    source.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
     // Create files: Profile
     const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, params.fileName, profileSuffix());
 
     Core::GeneratedFile profile(profileName);
+    profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
     QString contents;
     {
         QTextStream proStr(&contents);
diff --git a/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp b/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp
index 02ad1f3a3b8d49bfb8af9553d01f9d7e06f67581..a8c9c5c53327336a6ee9a879e40d943f6c39cc10 100644
--- a/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp
@@ -69,6 +69,7 @@ Core::GeneratedFiles
     const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, params.fileName, profileSuffix());
 
     Core::GeneratedFile profile(profileName);
+    profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
     return Core::GeneratedFiles() << profile;
 }
 
diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp
index 1ebfc8e17c3930a120e03e01ae95923298e42269..92bbb1a33834267fe34b3d460efd3f8a3a5c725f 100644
--- a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp
@@ -175,6 +175,7 @@ Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w,
         // Create files: form
         const QString formName = buildFileName(projectPath, params.formFileName, formSuffix());
         form = QSharedPointer<Core::GeneratedFile>(new Core::GeneratedFile(formName));
+        form->setAttributes(Core::GeneratedFile::OpenEditorAttribute);
         if (!parametrizeTemplate(templatePath, QLatin1String("widget.ui"), params, &contents, errorMessage))
             return Core::GeneratedFiles();
         form->setContents(contents);
@@ -185,6 +186,7 @@ Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w,
         if (!parametrizeTemplate(templatePath, formSourceTemplate, params, &contents, errorMessage))
             return Core::GeneratedFiles();
         formSource.setContents(license + contents);
+        formSource.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
         // Create files: form header
         const QString formHeaderTemplate = QLatin1String("mywidget.h");
         if (!parametrizeTemplate(templatePath, formHeaderTemplate, params, &contents, errorMessage))
@@ -194,6 +196,7 @@ Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w,
     // Create files: profile
     const QString profileName = buildFileName(projectPath, projectParams.fileName, profileSuffix());
     Core::GeneratedFile profile(profileName);
+    profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
     contents.clear();
     {
         QTextStream proStr(&contents);
diff --git a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp
index 343457fc41f1df432faaac02ad2b150308d29be7..65e115c1e1fc0ff964570b57a95ff46c299f7318 100644
--- a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp
@@ -88,6 +88,7 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w,
     // Class header + source
     const QString sourceFileName = buildFileName(projectPath, params.sourceFileName, sourceSuffix());
     Core::GeneratedFile source(sourceFileName);
+    source.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
 
     const QString headerFileFullName = buildFileName(projectPath, params.headerFileName, headerSuffix());
     const QString headerFileName = QFileInfo(headerFileFullName).fileName();
@@ -116,6 +117,7 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w,
     // Create files: profile
     const QString profileName = buildFileName(projectPath, projectParams.fileName, profileSuffix());
     Core::GeneratedFile profile(profileName);
+    profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
     QString profileContents;
     {
         QTextStream proStr(&profileContents);
diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
index f292c38fea64387d14c785cbdb72ce9ec22bfb7a..1ce7ff9a130a532817677cdf115c738c532c88b5 100644
--- a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
@@ -37,6 +37,7 @@
 #include "targetsetuppage.h"
 
 #include <coreplugin/icore.h>
+#include <coreplugin/editormanager/editormanager.h>
 #include <cpptools/cpptoolsconstants.h>
 #include <extensionsystem/pluginmanager.h>
 #include <projectexplorer/projectexplorer.h>
@@ -108,20 +109,21 @@ bool QtWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l
     return QtWizard::qt4ProjectPostGenerateFiles(w, l, errorMessage);
 }
 
-bool QtWizard::qt4ProjectPostGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
+bool QtWizard::qt4ProjectPostGenerateFiles(const QWizard *w,
+                                           const Core::GeneratedFiles &generatedFiles,
+                                           QString *errorMessage)
 {
-    const QString proFileName = l.back().path();
     const BaseQt4ProjectWizardDialog *dialog = qobject_cast<const BaseQt4ProjectWizardDialog *>(w);
 
-    // Generate user settings:
-    dialog->writeUserFile(proFileName);
+    // Generate user settings
+    foreach (const Core::GeneratedFile &file, generatedFiles)
+        if (file.attributes() & Core::GeneratedFile::OpenProjectAttribute) {
+            dialog->writeUserFile(file.path());
+            break;
+        }
 
-    // Post-Generate: Open the project
-    if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFileName)) {
-        *errorMessage = tr("The project %1 could not be opened.").arg(proFileName);
-        return false;
-    }
-    return true;
+    // Post-Generate: Open the projects/editors
+    return ProjectExplorer::CustomProjectWizard::postGenerateOpen(generatedFiles ,errorMessage);
 }
 
 QString QtWizard::templateDir()
diff --git a/src/plugins/qt4projectmanager/wizards/testwizard.cpp b/src/plugins/qt4projectmanager/wizards/testwizard.cpp
index 5954c820ac48a5bc47b0fb4230aaee5034e107ac..33223db97b737cf904135eb5cf695507639779ec 100644
--- a/src/plugins/qt4projectmanager/wizards/testwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/testwizard.cpp
@@ -162,11 +162,13 @@ Core::GeneratedFiles TestWizard::generateFiles(const QWizard *w, QString *errorM
     const QFileInfo sourceFileInfo(sourceFilePath);
 
     Core::GeneratedFile source(sourceFilePath);
+    source.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
     source.setContents(generateTestCode(testParams, sourceFileInfo.baseName()));
 
     // Create profile with define for base dir to find test data
     const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, projectParams.fileName, profileSuffix());
     Core::GeneratedFile profile(profileName);
+    profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
     QString contents;
     {
         QTextStream proStr(&contents);
diff --git a/src/plugins/resourceeditor/resourcewizard.cpp b/src/plugins/resourceeditor/resourcewizard.cpp
index ae915c84e49f64a3df64f6f32fb42f6b5e65a52a..ce454a36db6117fcdb2d289e9288227803b54734 100644
--- a/src/plugins/resourceeditor/resourcewizard.cpp
+++ b/src/plugins/resourceeditor/resourcewizard.cpp
@@ -50,5 +50,6 @@ ResourceWizard::generateFilesFromPath(const QString &path,
     Core::GeneratedFile file(fileName);
     file.setContents(QLatin1String("<RCC/>"));
     file.setEditorId(QLatin1String(Constants::RESOURCEEDITOR_ID));
+    file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
     return Core::GeneratedFiles() << file;
 }
diff --git a/src/plugins/texteditor/textfilewizard.cpp b/src/plugins/texteditor/textfilewizard.cpp
index 5c9c351baf2f21de0e989a13cf7a11919b3c34f6..f7f8875e8b9afef5ff5ec0b8787f8438cde72d6d 100644
--- a/src/plugins/texteditor/textfilewizard.cpp
+++ b/src/plugins/texteditor/textfilewizard.cpp
@@ -54,5 +54,6 @@ Core::GeneratedFiles
     const QString fileName = Core::BaseFileWizard::buildFileName(path, name, suffix);
     Core::GeneratedFile file(fileName);
     file.setEditorId(m_editorId);
+    file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
     return Core::GeneratedFiles() << file;
 }