diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp
index 2c7be1e9cf525f0854c8db9d1a4a2d3a98daa99f..c6da6362d44e25685f6ab00ef70fada45530f034 100644
--- a/src/plugins/coreplugin/coreimpl.cpp
+++ b/src/plugins/coreplugin/coreimpl.cpp
@@ -56,7 +56,6 @@ ICore* ICore::instance()
 }
 
 CoreImpl::CoreImpl(MainWindow *mainwindow)
-    : m_preferredWizardKinds(IWizard::ProjectWizard)
 {
     m_instance = this;
     m_mainwindow = mainwindow;
@@ -69,11 +68,6 @@ QStringList CoreImpl::showNewItemDialog(const QString &title,
     return m_mainwindow->showNewItemDialog(title, wizards, defaultLocation);
 }
 
-void CoreImpl::setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds)
-{
-    m_preferredWizardKinds = kinds;
-}
-
 bool CoreImpl::showOptionsDialog(const QString &group, const QString &page, QWidget *parent)
 {
     return m_mainwindow->showOptionsDialog(group, page, parent);
diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h
index 749a7962e6f6e5fd73debbdbfc9bc772799617dd..d04defd31814283e0c7476dab3ff47d02b30f58a 100644
--- a/src/plugins/coreplugin/coreimpl.h
+++ b/src/plugins/coreplugin/coreimpl.h
@@ -47,8 +47,6 @@ public:
     QStringList showNewItemDialog(const QString &title,
                                   const QList<IWizard *> &wizards,
                                   const QString &defaultLocation = QString());
-    void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds);
-    IWizard::WizardKinds newItemDialogPreferredWizardKinds() { return m_preferredWizardKinds; }
     bool showOptionsDialog(const QString &group = QString(),
                            const QString &page = QString(),
                            QWidget *parent = 0);
@@ -93,8 +91,6 @@ public:
 private:
     MainWindow *m_mainwindow;
     friend class MainWindow;
-
-    IWizard::WizardKinds m_preferredWizardKinds;
 };
 
 } // namespace Internal
diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp
index 75170a4de1398505d3d600b857e9d1f427124fdb..b8bd4a5d852740e1e09a9c6f64f36939a5091486 100644
--- a/src/plugins/coreplugin/dialogs/newdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/newdialog.cpp
@@ -152,8 +152,7 @@ using namespace Core::Internal;
 NewDialog::NewDialog(QWidget *parent) :
     QDialog(parent),
     m_ui(new Core::Internal::Ui::NewDialog),
-    m_okButton(0),
-    m_preferredWizardKinds(0)
+    m_okButton(0)
 {
     typedef QMap<QString, QStandardItem *> CategoryItemMap;
     m_ui->setupUi(this);
@@ -194,11 +193,6 @@ bool wizardLessThan(const IWizard *w1, const IWizard *w2)
     return w1->id().compare(w2->id()) < 0;
 }
 
-void NewDialog::setPreferredWizardKinds(IWizard::WizardKinds kinds)
-{
-    m_preferredWizardKinds = kinds;
-}
-
 void NewDialog::setWizards(QList<IWizard*> wizards)
 {
     typedef QMap<QString, QStandardItem *> CategoryItemMap;
@@ -243,9 +237,10 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
                 break;
             }
             kindItem->appendRow(categoryItem);
+            m_categoryItems.append(categoryItem);
             categoryItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
             categoryItem->setText(wizard->displayCategory());
-            categoryItem->setData(QVariant::fromValue(0), Qt::UserRole);
+            categoryItem->setData(wizard->category(), Qt::UserRole);
             cit = categories.insert(categoryName, categoryItem);
         }
         // add item
@@ -277,8 +272,20 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
 
 Core::IWizard *NewDialog::showDialog()
 {
-    // Select first category, first item by default
-    m_ui->templateCategoryView->setCurrentIndex(m_proxyModel->index(0,0, m_proxyModel->index(0,0)));
+    static QString lastCategory;
+    QModelIndex idx;
+
+    if (!lastCategory.isEmpty())
+        foreach(QStandardItem* item, m_categoryItems) {
+            if (item->data(Qt::UserRole) == lastCategory) {
+                idx = m_proxyModel->mapToSource(m_model->indexFromItem(item));
+        }
+    }
+    if (!idx.isValid())
+        idx = m_proxyModel->index(0,0, m_proxyModel->index(0,0));
+
+    m_ui->templateCategoryView->setCurrentIndex(idx);
+
     // We need to set ensure that the category has default focus
     m_ui->templateCategoryView->setFocus(Qt::NoFocusReason);
 
@@ -289,8 +296,15 @@ Core::IWizard *NewDialog::showDialog()
     currentItemChanged(m_ui->templatesView->rootIndex().child(0,0));
 
     updateOkButton();
-    if (exec() != Accepted)
+
+    const int retVal = exec();
+
+    idx = m_ui->templateCategoryView->currentIndex();
+    lastCategory = m_model->itemFromIndex(m_proxyModel->mapToSource(idx))->data(Qt::UserRole).toString();
+
+    if (retVal != Accepted)
         return 0;
+
     return currentWizard();
 }
 
diff --git a/src/plugins/coreplugin/dialogs/newdialog.h b/src/plugins/coreplugin/dialogs/newdialog.h
index bcfe5a7d2fde1798f4e21d5a19d89095e86ae57b..02d764bee4b04ef6bdc61d096fdd073180656e2d 100644
--- a/src/plugins/coreplugin/dialogs/newdialog.h
+++ b/src/plugins/coreplugin/dialogs/newdialog.h
@@ -34,6 +34,7 @@
 
 #include <QtGui/QDialog>
 #include <QtCore/QList>
+#include <QtCore/QModelIndex>
 
 QT_BEGIN_NAMESPACE
 class QAbstractProxyModel;
@@ -41,7 +42,6 @@ class QPushButton;
 class QStandardItem;
 class QStandardItemModel;
 class QStringList;
-class QModelIndex;
 QT_END_NAMESPACE
 
 namespace Core {
@@ -61,7 +61,6 @@ public:
     virtual ~NewDialog();
 
     void setWizards(QList<IWizard*> wizards);
-    void setPreferredWizardKinds(IWizard::WizardKinds kinds);
 
     Core::IWizard *showDialog();
 
@@ -77,8 +76,8 @@ private:
     QStandardItemModel *m_model;
     QAbstractProxyModel *m_proxyModel;
     QPushButton *m_okButton;
-    IWizard::WizardKinds m_preferredWizardKinds;
     QPixmap m_dummyIcon;
+    QList<QStandardItem*> m_categoryItems;
 };
 
 } // namespace Internal
diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp
index c1f85bc44cd639b501b80a15b2b90aeef3465d67..363d886b2caa56bfacb908c03b07caeb5abea46d 100644
--- a/src/plugins/coreplugin/icore.cpp
+++ b/src/plugins/coreplugin/icore.cpp
@@ -67,17 +67,6 @@
     \sa Core::FileManager
 */
 
-/*!
-    \fn void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds)
-    \internal
-
-    When set to true, the general "New File or Project" dialog will
-    collapse the project categories.
-    This is set by the project explorer: When projects are open, the preferred
-    thing is to create files/classes, if no projects are open, the preferred thing
-    to create are projects.
-*/
-
 /*!
     \fn bool ICore::showOptionsDialog(const QString &group = QString(),
                                const QString &page = QString())
diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h
index ccc3b3b707c27b0bbd666f13076858ec49cf5590..cae3da1b4d9b65d5397efb6bce7c94441d4d3d37 100644
--- a/src/plugins/coreplugin/icore.h
+++ b/src/plugins/coreplugin/icore.h
@@ -74,7 +74,6 @@ public:
     virtual QStringList showNewItemDialog(const QString &title,
                                           const QList<IWizard *> &wizards,
                                           const QString &defaultLocation = QString()) = 0;
-    virtual void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds) = 0;
 
     virtual bool showOptionsDialog(const QString &group = QString(),
                                    const QString &page = QString(),
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index c10f0da694e0dfedc4d361e068803b3555928212..201105098f5df04533c210028e3bff8a0f11dc33 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -775,8 +775,7 @@ void MainWindow::registerDefaultActions()
 
 void MainWindow::newFile()
 {
-    showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(),
-                      QString(), m_coreImpl->newItemDialogPreferredWizardKinds());
+    showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(), QString());
 }
 
 void MainWindow::openFile()
@@ -863,8 +862,7 @@ void MainWindow::setFocusToEditor()
 
 QStringList MainWindow::showNewItemDialog(const QString &title,
                                           const QList<IWizard *> &wizards,
-                                          const QString &defaultLocation,
-                                          IWizard::WizardKinds preferredWizardKinds)
+                                          const QString &defaultLocation)
 {
     // Scan for wizards matching the filter and pick one. Don't show
     // dialog if there is only one.
@@ -879,7 +877,6 @@ QStringList MainWindow::showNewItemDialog(const QString &title,
         NewDialog dlg(this);
         dlg.setWizards(wizards);
         dlg.setWindowTitle(title);
-        dlg.setPreferredWizardKinds(preferredWizardKinds);
         wizard = dlg.showDialog();
     }
         break;
diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h
index 2aecdefc32f3f71f4c8ced4e229a970b632a6617..60b911ba1d1e4f714eef31d3dbc5af8234b153c4 100644
--- a/src/plugins/coreplugin/mainwindow.h
+++ b/src/plugins/coreplugin/mainwindow.h
@@ -134,8 +134,7 @@ public slots:
 
     QStringList showNewItemDialog(const QString &title,
                                   const QList<IWizard *> &wizards,
-                                  const QString &defaultLocation = QString(),
-                                  IWizard::WizardKinds preferredWizardKinds = 0);
+                                  const QString &defaultLocation = QString());
 
     bool showOptionsDialog(const QString &category = QString(),
                            const QString &page = QString(),
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index f3561283b985d098f55529633d39f50b9db39ac7..9e6f01b1d22fbbff6ae798889e4f3070be4b3112 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -256,10 +256,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
             this, SIGNAL(fileListChanged()));
     connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
             this, SLOT(startupProjectChanged()));
-    connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
-            this, SLOT(updatePreferredWizardKinds()));
-    connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
-            this, SLOT(updatePreferredWizardKinds()));
     connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
             this, SLOT(updateActions()));
 
@@ -1882,17 +1878,6 @@ void ProjectExplorerPlugin::openRecentProject()
         openProject(fileName);
 }
 
-void ProjectExplorerPlugin::updatePreferredWizardKinds()
-{
-    if (d->m_session->projects().count()) {
-        Core::ICore::instance()->setNewItemDialogPreferredWizardKinds(
-                Core::IWizard::FileWizard | Core::IWizard::ClassWizard);
-    } else {
-        Core::ICore::instance()->setNewItemDialogPreferredWizardKinds(
-                Core::IWizard::ProjectWizard);
-    }
-}
-
 void ProjectExplorerPlugin::invalidateProject(Project *project)
 {
     if (debug)
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index 8ed599bf966bd2b218913bb735a97a9dba87dd3a..b25d6402a949cec48f0fd966f25c09d3efb5ad2c 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -170,7 +170,6 @@ private slots:
     void updateRecentProjectMenu();
     void openRecentProject();
     void openTerminalHere();
-    void updatePreferredWizardKinds();
 
     void invalidateProject(ProjectExplorer::Project *project);