diff --git a/src/plugins/projectexplorer/applicationrunconfiguration.cpp b/src/plugins/projectexplorer/applicationrunconfiguration.cpp
index 3ef50e961e6036d7770a31741cef4a0bf5bb75b3..c1963bc065398bc233b57be9f0c8bd128398040e 100644
--- a/src/plugins/projectexplorer/applicationrunconfiguration.cpp
+++ b/src/plugins/projectexplorer/applicationrunconfiguration.cpp
@@ -29,16 +29,7 @@
 
 #include "applicationrunconfiguration.h"
 
-#include "environment.h"
-
-#include <projectexplorer/projectexplorerconstants.h>
-#include <utils/qtcassert.h>
-
-#include <QtCore/QDir>
-#include <QtGui/QLabel>
-
-using namespace ProjectExplorer;
-using namespace ProjectExplorer::Internal;
+namespace ProjectExplorer {
 
 /// LocalApplicationRunConfiguration
 
@@ -56,102 +47,5 @@ LocalApplicationRunConfiguration::~LocalApplicationRunConfiguration()
 {
 }
 
-/// LocalApplicationRunControlFactory
-
-LocalApplicationRunControlFactory::LocalApplicationRunControlFactory()
-{
-}
-
-LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
-{
-}
-
-bool LocalApplicationRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const
-{
-    return (mode == ProjectExplorer::Constants::RUNMODE)
-            && (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration) != 0);
-}
-
-QString LocalApplicationRunControlFactory::displayName() const
-{
-    return tr("Run");
-}
-
-RunControl *LocalApplicationRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
-{
-    QTC_ASSERT(canRun(runConfiguration, mode), return 0);
-    return new LocalApplicationRunControl(qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration), mode);
-}
-
-QWidget *LocalApplicationRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
-{
-    Q_UNUSED(runConfiguration)
-    return new QLabel("TODO add Configuration widget");
-}
-
-// ApplicationRunControl
-
-LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, QString mode)
-    : RunControl(rc, mode)
-{
-    Utils::Environment env = rc->environment();
-    QString dir = rc->workingDirectory();
-    m_applicationLauncher.setEnvironment(env.toStringList());
-    m_applicationLauncher.setWorkingDirectory(dir);
-
-    m_executable = rc->executable();
-    m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode());
-    m_commandLineArguments = rc->commandLineArguments();
-
-    connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
-            this, SLOT(slotAppendMessage(QString,bool)));
-    connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
-            this, SLOT(slotAddToOutputWindow(QString, bool)));
-    connect(&m_applicationLauncher, SIGNAL(processExited(int)),
-            this, SLOT(processExited(int)));
-    connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
-            this, SLOT(bringApplicationToForeground(qint64)));
-}
-
-LocalApplicationRunControl::~LocalApplicationRunControl()
-{
-}
-
-void LocalApplicationRunControl::start()
-{
-    m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
-    emit started();
-
-    emit appendMessage(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)), false);
-}
-
-LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop()
-{
-    m_applicationLauncher.stop();
-    return StoppedSynchronously;
-}
-
-bool LocalApplicationRunControl::isRunning() const
-{
-    return m_applicationLauncher.isRunning();
-}
-
-void LocalApplicationRunControl::slotAppendMessage(const QString &err,
-                                                   bool isError)
-{
-    emit appendMessage(this, err, isError);
-    emit finished();
-}
-
-void LocalApplicationRunControl::slotAddToOutputWindow(const QString &line,
-                                                       bool isError)
-{
-    emit addToOutputWindowInline(this, line, isError);
-}
-
-void LocalApplicationRunControl::processExited(int exitCode)
-{
-    emit appendMessage(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode), false);
-    emit finished();
-}
+} // namespace ProjectExplorer
 
diff --git a/src/plugins/projectexplorer/applicationrunconfiguration.h b/src/plugins/projectexplorer/applicationrunconfiguration.h
index ca84cce27dd6bc1c1a7fb85fbfd071376b86a4c6..2e1229a7a961191979eb0e7992191ab4ac720b9c 100644
--- a/src/plugins/projectexplorer/applicationrunconfiguration.h
+++ b/src/plugins/projectexplorer/applicationrunconfiguration.h
@@ -61,45 +61,10 @@ public:
     virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const = 0;
 
 protected:
-    LocalApplicationRunConfiguration(Target *target, const QString &id);
-    LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc);
+    explicit LocalApplicationRunConfiguration(Target *target, const QString &id);
+    explicit LocalApplicationRunConfiguration(Target *target, LocalApplicationRunConfiguration *rc);
 };
 
-namespace Internal {
-
-class LocalApplicationRunControlFactory : public IRunControlFactory
-{
-    Q_OBJECT
-public:
-    LocalApplicationRunControlFactory ();
-    virtual ~LocalApplicationRunControlFactory();
-    virtual bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
-    virtual QString displayName() const;
-    virtual RunControl* create(RunConfiguration *runConfiguration, const QString &mode);
-    virtual QWidget *createConfigurationWidget(RunConfiguration  *runConfiguration);
-};
-
-class LocalApplicationRunControl : public RunControl
-{
-    Q_OBJECT
-public:
-    LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, QString mode);
-    virtual ~LocalApplicationRunControl();
-    virtual void start();
-    virtual StopResult stop();
-    virtual bool isRunning() const;
-private slots:
-    void processExited(int exitCode);
-    void slotAddToOutputWindow(const QString &line, bool isError);
-    void slotAppendMessage(const QString &err, bool isError);
-private:
-    ProjectExplorer::ApplicationLauncher m_applicationLauncher;
-    QString m_executable;
-    QStringList m_commandLineArguments;
-    ProjectExplorer::ApplicationLauncher::Mode m_runMode;
-};
-
-} // namespace Internal
 } // namespace ProjectExplorer
 
 #endif // APPLICATIONRUNCONFIGURATION_H
diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h
index ac6ed8fccc01a166d64e434be4e7317003b11b25..9efdf2f38d653fef59bfbc140fe0fb880a9e0a5f 100644
--- a/src/plugins/projectexplorer/buildconfiguration.h
+++ b/src/plugins/projectexplorer/buildconfiguration.h
@@ -31,15 +31,14 @@
 #define BUILDCONFIGURATION_H
 
 #include "projectexplorer_export.h"
+#include "projectconfiguration.h"
 
 #include <utils/environment.h>
 
 #include <QtCore/QString>
 #include <QtCore/QStringList>
-#include <QtCore/QList>
-#include <QtCore/QObject>
 
-#include "projectconfiguration.h"
+
 
 namespace ProjectExplorer {
 
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h
index 9b560bb1c36e467a4d48ff142bacad25b9cc9bab..b7506af8a4ae096c2c05b4552c864458d196dd0b 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h
@@ -33,6 +33,7 @@
 #include "iprojectproperties.h"
 
 #include <QtGui/QWidget>
+#include <QtGui/QIcon>
 
 QT_BEGIN_NAMESPACE
 class QComboBox;
diff --git a/src/plugins/projectexplorer/customexecutableconfigurationwidget.cpp b/src/plugins/projectexplorer/customexecutableconfigurationwidget.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2d1b3399a81d2909028decfeb2ce73906df0e99f
--- /dev/null
+++ b/src/plugins/projectexplorer/customexecutableconfigurationwidget.cpp
@@ -0,0 +1,265 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "customexecutableconfigurationwidget.h"
+#include "customexecutablerunconfiguration.h"
+#include "target.h"
+#include "project.h"
+#include "environmenteditmodel.h"
+
+#include <utils/detailswidget.h>
+#include <utils/environment.h>
+#include <utils/pathchooser.h>
+#include <utils/debuggerlanguagechooser.h>
+
+#include <QtGui/QCheckBox>
+#include <QtGui/QComboBox>
+#include <QtGui/QFormLayout>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QLabel>
+#include <QtGui/QLineEdit>
+
+namespace ProjectExplorer {
+namespace Internal {
+
+class CustomDirectoryPathChooser : public Utils::PathChooser
+{
+public:
+    CustomDirectoryPathChooser(QWidget *parent)
+        : Utils::PathChooser(parent)
+    {
+    }
+    virtual bool validatePath(const QString &path, QString *errorMessage = 0)
+    {
+        Q_UNUSED(path)
+        Q_UNUSED(errorMessage)
+        return true;
+    }
+};
+
+CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc)
+    : m_ignoreChange(false), m_runConfiguration(rc)
+{
+    QFormLayout *layout = new QFormLayout;
+    layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
+    layout->setMargin(0);
+
+    m_executableChooser = new Utils::PathChooser(this);
+    m_executableChooser->setEnvironment(rc->environment());
+    m_executableChooser->setExpectedKind(Utils::PathChooser::Command);
+    layout->addRow(tr("Executable:"), m_executableChooser);
+
+    m_commandLineArgumentsLineEdit = new QLineEdit(this);
+    m_commandLineArgumentsLineEdit->setMinimumWidth(200); // this shouldn't be fixed here...
+    layout->addRow(tr("Arguments:"), m_commandLineArgumentsLineEdit);
+
+    m_workingDirectory = new CustomDirectoryPathChooser(this);
+    m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
+    m_workingDirectory->setBaseDirectory(rc->target()->project()->projectDirectory());
+    m_workingDirectory->setEnvironment(rc->environment());
+    layout->addRow(tr("Working directory:"), m_workingDirectory);
+
+    m_useTerminalCheck = new QCheckBox(tr("Run in &Terminal"), this);
+    layout->addRow(QString(), m_useTerminalCheck);
+
+    QWidget *debuggerLabelWidget = new QWidget(this);
+    QVBoxLayout *debuggerLabelLayout = new QVBoxLayout(debuggerLabelWidget);
+    debuggerLabelLayout->setMargin(0);
+    debuggerLabelLayout->setSpacing(0);
+    debuggerLabelWidget->setLayout(debuggerLabelLayout);
+    QLabel *debuggerLabel = new QLabel(tr("Debugger:"), this);
+    debuggerLabelLayout->addWidget(debuggerLabel);
+    debuggerLabelLayout->addStretch(10);
+
+    m_debuggerLanguageChooser = new Utils::DebuggerLanguageChooser(this);
+    layout->addRow(debuggerLabelWidget, m_debuggerLanguageChooser);
+
+    m_debuggerLanguageChooser->setCppChecked(m_runConfiguration->useCppDebugger());
+    m_debuggerLanguageChooser->setQmlChecked(m_runConfiguration->useQmlDebugger());
+    m_debuggerLanguageChooser->setQmlDebugServerPort(m_runConfiguration->qmlDebugServerPort());
+
+    QVBoxLayout *vbox = new QVBoxLayout(this);
+    vbox->setMargin(0);
+
+    m_detailsContainer = new Utils::DetailsWidget(this);
+    m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
+    vbox->addWidget(m_detailsContainer);
+
+    QWidget *detailsWidget = new QWidget(m_detailsContainer);
+    m_detailsContainer->setWidget(detailsWidget);
+    detailsWidget->setLayout(layout);
+
+    QLabel *environmentLabel = new QLabel(this);
+    environmentLabel->setText(tr("Run Environment"));
+    QFont f = environmentLabel->font();
+    f.setBold(true);
+    f.setPointSizeF(f.pointSizeF() *1.2);
+    environmentLabel->setFont(f);
+    vbox->addWidget(environmentLabel);
+
+    QWidget *baseEnvironmentWidget = new QWidget;
+    QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
+    baseEnvironmentLayout->setMargin(0);
+    QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
+    baseEnvironmentLayout->addWidget(label);
+    m_baseEnvironmentComboBox = new QComboBox(this);
+    m_baseEnvironmentComboBox->addItems(QStringList()
+                                        << tr("Clean Environment")
+                                        << tr("System Environment")
+                                        << tr("Build Environment"));
+    m_baseEnvironmentComboBox->setCurrentIndex(rc->baseEnvironmentBase());
+    connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
+            this, SLOT(baseEnvironmentSelected(int)));
+    baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
+    baseEnvironmentLayout->addStretch(10);
+
+    m_environmentWidget = new EnvironmentWidget(this, baseEnvironmentWidget);
+    m_environmentWidget->setBaseEnvironment(rc->baseEnvironment());
+    m_environmentWidget->setBaseEnvironmentText(rc->baseEnvironmentText());
+    m_environmentWidget->setUserChanges(rc->userEnvironmentChanges());
+    vbox->addWidget(m_environmentWidget);
+
+    changed();
+
+    connect(m_executableChooser, SIGNAL(changed(QString)),
+            this, SLOT(executableEdited()));
+    connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
+            this, SLOT(argumentsEdited(const QString&)));
+    connect(m_workingDirectory, SIGNAL(changed(QString)),
+            this, SLOT(workingDirectoryEdited()));
+    connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
+            this, SLOT(termToggled(bool)));
+
+    connect(m_debuggerLanguageChooser, SIGNAL(cppLanguageToggled(bool)),
+            this, SLOT(useCppDebuggerToggled(bool)));
+    connect(m_debuggerLanguageChooser, SIGNAL(qmlLanguageToggled(bool)),
+            this, SLOT(useQmlDebuggerToggled(bool)));
+    connect(m_debuggerLanguageChooser, SIGNAL(qmlDebugServerPortChanged(uint)),
+            this, SLOT(qmlDebugServerPortChanged(uint)));
+
+    connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
+
+    connect(m_environmentWidget, SIGNAL(userChangesChanged()),
+            this, SLOT(userChangesChanged()));
+
+    connect(m_runConfiguration, SIGNAL(baseEnvironmentChanged()),
+            this, SLOT(baseEnvironmentChanged()));
+    connect(m_runConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
+            this, SLOT(userEnvironmentChangesChanged()));
+}
+
+void CustomExecutableConfigurationWidget::userChangesChanged()
+{
+    m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
+}
+
+void CustomExecutableConfigurationWidget::baseEnvironmentSelected(int index)
+{
+    m_ignoreChange = true;
+    m_runConfiguration->setBaseEnvironmentBase(CustomExecutableRunConfiguration::BaseEnvironmentBase(index));
+
+    m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
+    m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
+    m_ignoreChange = false;
+}
+
+void CustomExecutableConfigurationWidget::useCppDebuggerToggled(bool toggled)
+{
+    m_runConfiguration->setUseCppDebugger(toggled);
+}
+
+void CustomExecutableConfigurationWidget::useQmlDebuggerToggled(bool toggled)
+{
+    m_runConfiguration->setUseQmlDebugger(toggled);
+}
+
+void CustomExecutableConfigurationWidget::qmlDebugServerPortChanged(uint port)
+{
+    m_runConfiguration->setQmlDebugServerPort(port);
+}
+
+void CustomExecutableConfigurationWidget::baseEnvironmentChanged()
+{
+    if (m_ignoreChange)
+        return;
+
+    int index = CustomExecutableRunConfiguration::BaseEnvironmentBase(
+            m_runConfiguration->baseEnvironmentBase());
+    m_baseEnvironmentComboBox->setCurrentIndex(index);
+    m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
+    m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
+}
+
+void CustomExecutableConfigurationWidget::userEnvironmentChangesChanged()
+{
+    m_environmentWidget->setUserChanges(m_runConfiguration->userEnvironmentChanges());
+}
+
+
+void CustomExecutableConfigurationWidget::executableEdited()
+{
+    m_ignoreChange = true;
+    m_runConfiguration->setExecutable(m_executableChooser->rawPath());
+    m_ignoreChange = false;
+}
+void CustomExecutableConfigurationWidget::argumentsEdited(const QString &arguments)
+{
+    m_ignoreChange = true;
+    m_runConfiguration->setBaseCommandLineArguments(arguments);
+    m_ignoreChange = false;
+}
+void CustomExecutableConfigurationWidget::workingDirectoryEdited()
+{
+    m_ignoreChange = true;
+    m_runConfiguration->setBaseWorkingDirectory(m_workingDirectory->rawPath());
+    m_ignoreChange = false;
+}
+
+void CustomExecutableConfigurationWidget::termToggled(bool on)
+{
+    m_ignoreChange = true;
+    m_runConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console
+                                      : LocalApplicationRunConfiguration::Gui);
+    m_ignoreChange = false;
+}
+
+void CustomExecutableConfigurationWidget::changed()
+{
+    // We triggered the change, don't update us
+    if (m_ignoreChange)
+        return;
+
+    m_executableChooser->setPath(m_runConfiguration->rawExecutable());
+    m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->baseCommandLineArguments()));
+    m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
+    m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console);
+}
+
+} // namespace Internal
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/customexecutableconfigurationwidget.h b/src/plugins/projectexplorer/customexecutableconfigurationwidget.h
new file mode 100644
index 0000000000000000000000000000000000000000..2a510d03786c04ceb0b92fde3d4dbe783db8cb99
--- /dev/null
+++ b/src/plugins/projectexplorer/customexecutableconfigurationwidget.h
@@ -0,0 +1,95 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef CUSTOMEXECUTABLECONFIGURATIONWIDGET_H
+#define CUSTOMEXECUTABLECONFIGURATIONWIDGET_H
+
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QLineEdit;
+class QComboBox;
+class QLabel;
+class QAbstractButton;
+QT_END_NAMESPACE
+
+namespace Utils {
+class DetailsWidget;
+class PathChooser;
+class DebuggerLanguageChooser;
+}
+
+namespace ProjectExplorer {
+class CustomExecutableRunConfiguration;
+class EnvironmentWidget;
+
+namespace Internal {
+
+class CustomExecutableConfigurationWidget : public QWidget
+{
+    Q_OBJECT
+
+public:
+    CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc);
+
+private slots:
+    void changed();
+
+    void executableEdited();
+    void argumentsEdited(const QString &arguments);
+    void workingDirectoryEdited();
+    void termToggled(bool);
+
+    void userChangesChanged();
+    void baseEnvironmentChanged();
+    void userEnvironmentChangesChanged();
+    void baseEnvironmentSelected(int index);
+    void useCppDebuggerToggled(bool toggled);
+    void useQmlDebuggerToggled(bool toggled);
+    void qmlDebugServerPortChanged(uint port);
+
+private:
+    bool m_ignoreChange;
+    CustomExecutableRunConfiguration *m_runConfiguration;
+    Utils::PathChooser *m_executableChooser;
+    QLineEdit *m_userName;
+    QLineEdit *m_commandLineArgumentsLineEdit;
+    Utils::PathChooser *m_workingDirectory;
+    QCheckBox *m_useTerminalCheck;
+    ProjectExplorer::EnvironmentWidget *m_environmentWidget;
+    QComboBox *m_baseEnvironmentComboBox;
+    Utils::DetailsWidget *m_detailsContainer;
+    Utils::DebuggerLanguageChooser *m_debuggerLanguageChooser;
+};
+
+} // namespace Internal
+} // namespace ProjectExplorer
+
+#endif // CUSTOMEXECUTABLECONFIGURATIONWIDGET_H
diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp
index c9a968f08a5e53c789c88c41279eed08c014714e..aba161bd73e2460729cc2a723dac99df6d9714fc 100644
--- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp
+++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp
@@ -28,28 +28,20 @@
 **************************************************************************/
 
 #include "customexecutablerunconfiguration.h"
+#include "customexecutableconfigurationwidget.h"
 
 #include <coreplugin/icore.h>
 #include <projectexplorer/buildconfiguration.h>
-#include <projectexplorer/environmenteditmodel.h>
 #include <projectexplorer/debugginghelper.h>
 #include <projectexplorer/target.h>
-#include <projectexplorer/project.h>
-#include <utils/detailswidget.h>
-#include <utils/environment.h>
-#include <utils/pathchooser.h>
-#include <utils/debuggerlanguagechooser.h>
 
-#include <QtCore/QDir>
-#include <QtGui/QCheckBox>
-#include <QtGui/QComboBox>
 #include <QtGui/QDialog>
 #include <QtGui/QDialogButtonBox>
-#include <QtGui/QFormLayout>
-#include <QtGui/QHBoxLayout>
 #include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
 #include <QtGui/QMainWindow>
+#include <QtGui/QVBoxLayout>
+
+#include <QtCore/QDir>
 
 using namespace ProjectExplorer;
 using namespace ProjectExplorer::Internal;
@@ -67,219 +59,6 @@ const char * const BASE_ENVIRONMENT_BASE_KEY("ProjectExplorer.CustomExecutableRu
 const char * const DEFAULT_WORKING_DIR("$BUILDDIR");
 }
 
-class CustomDirectoryPathChooser : public Utils::PathChooser
-{
-public:
-    CustomDirectoryPathChooser(QWidget *parent)
-        : Utils::PathChooser(parent)
-    {
-    }
-    virtual bool validatePath(const QString &path, QString *errorMessage = 0)
-    {
-        Q_UNUSED(path)
-        Q_UNUSED(errorMessage)
-        return true;
-    }
-};
-
-CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc)
-    : m_ignoreChange(false), m_runConfiguration(rc)
-{
-    QFormLayout *layout = new QFormLayout;
-    layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
-    layout->setMargin(0);
-
-    m_executableChooser = new Utils::PathChooser(this);
-    m_executableChooser->setEnvironment(rc->environment());
-    m_executableChooser->setExpectedKind(Utils::PathChooser::Command);
-    layout->addRow(tr("Executable:"), m_executableChooser);
-
-    m_commandLineArgumentsLineEdit = new QLineEdit(this);
-    m_commandLineArgumentsLineEdit->setMinimumWidth(200); // this shouldn't be fixed here...
-    layout->addRow(tr("Arguments:"), m_commandLineArgumentsLineEdit);
-
-    m_workingDirectory = new CustomDirectoryPathChooser(this);
-    m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
-    m_workingDirectory->setBaseDirectory(rc->target()->project()->projectDirectory());
-    m_workingDirectory->setEnvironment(rc->environment());
-    layout->addRow(tr("Working directory:"), m_workingDirectory);
-
-    m_useTerminalCheck = new QCheckBox(tr("Run in &Terminal"), this);
-    layout->addRow(QString(), m_useTerminalCheck);
-
-    QWidget *debuggerLabelWidget = new QWidget(this);
-    QVBoxLayout *debuggerLabelLayout = new QVBoxLayout(debuggerLabelWidget);
-    debuggerLabelLayout->setMargin(0);
-    debuggerLabelLayout->setSpacing(0);
-    debuggerLabelWidget->setLayout(debuggerLabelLayout);
-    QLabel *debuggerLabel = new QLabel(tr("Debugger:"), this);
-    debuggerLabelLayout->addWidget(debuggerLabel);
-    debuggerLabelLayout->addStretch(10);
-
-    m_debuggerLanguageChooser = new Utils::DebuggerLanguageChooser(this);
-    layout->addRow(debuggerLabelWidget, m_debuggerLanguageChooser);
-
-    m_debuggerLanguageChooser->setCppChecked(m_runConfiguration->useCppDebugger());
-    m_debuggerLanguageChooser->setQmlChecked(m_runConfiguration->useQmlDebugger());
-    m_debuggerLanguageChooser->setQmlDebugServerPort(m_runConfiguration->qmlDebugServerPort());
-
-    QVBoxLayout *vbox = new QVBoxLayout(this);
-    vbox->setMargin(0);
-
-    m_detailsContainer = new Utils::DetailsWidget(this);
-    m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
-    vbox->addWidget(m_detailsContainer);
-
-    QWidget *detailsWidget = new QWidget(m_detailsContainer);
-    m_detailsContainer->setWidget(detailsWidget);
-    detailsWidget->setLayout(layout);
-
-    QLabel *environmentLabel = new QLabel(this);
-    environmentLabel->setText(tr("Run Environment"));
-    QFont f = environmentLabel->font();
-    f.setBold(true);
-    f.setPointSizeF(f.pointSizeF() *1.2);
-    environmentLabel->setFont(f);
-    vbox->addWidget(environmentLabel);
-
-    QWidget *baseEnvironmentWidget = new QWidget;
-    QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
-    baseEnvironmentLayout->setMargin(0);
-    QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
-    baseEnvironmentLayout->addWidget(label);
-    m_baseEnvironmentComboBox = new QComboBox(this);
-    m_baseEnvironmentComboBox->addItems(QStringList()
-                                        << tr("Clean Environment")
-                                        << tr("System Environment")
-                                        << tr("Build Environment"));
-    m_baseEnvironmentComboBox->setCurrentIndex(rc->baseEnvironmentBase());
-    connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
-            this, SLOT(baseEnvironmentSelected(int)));
-    baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
-    baseEnvironmentLayout->addStretch(10);
-
-    m_environmentWidget = new EnvironmentWidget(this, baseEnvironmentWidget);
-    m_environmentWidget->setBaseEnvironment(rc->baseEnvironment());
-    m_environmentWidget->setBaseEnvironmentText(rc->baseEnvironmentText());
-    m_environmentWidget->setUserChanges(rc->userEnvironmentChanges());
-    vbox->addWidget(m_environmentWidget);
-
-    changed();
-
-    connect(m_executableChooser, SIGNAL(changed(QString)),
-            this, SLOT(executableEdited()));
-    connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
-            this, SLOT(argumentsEdited(const QString&)));
-    connect(m_workingDirectory, SIGNAL(changed(QString)),
-            this, SLOT(workingDirectoryEdited()));
-    connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
-            this, SLOT(termToggled(bool)));
-
-    connect(m_debuggerLanguageChooser, SIGNAL(cppLanguageToggled(bool)),
-            this, SLOT(useCppDebuggerToggled(bool)));
-    connect(m_debuggerLanguageChooser, SIGNAL(qmlLanguageToggled(bool)),
-            this, SLOT(useQmlDebuggerToggled(bool)));
-    connect(m_debuggerLanguageChooser, SIGNAL(qmlDebugServerPortChanged(uint)),
-            this, SLOT(qmlDebugServerPortChanged(uint)));
-
-    connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
-
-    connect(m_environmentWidget, SIGNAL(userChangesChanged()),
-            this, SLOT(userChangesChanged()));
-
-    connect(m_runConfiguration, SIGNAL(baseEnvironmentChanged()),
-            this, SLOT(baseEnvironmentChanged()));
-    connect(m_runConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
-            this, SLOT(userEnvironmentChangesChanged()));
-}
-
-void CustomExecutableConfigurationWidget::userChangesChanged()
-{
-    m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
-}
-
-void CustomExecutableConfigurationWidget::baseEnvironmentSelected(int index)
-{
-    m_ignoreChange = true;
-    m_runConfiguration->setBaseEnvironmentBase(CustomExecutableRunConfiguration::BaseEnvironmentBase(index));
-
-    m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
-    m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
-    m_ignoreChange = false;
-}
-
-void CustomExecutableConfigurationWidget::useCppDebuggerToggled(bool toggled)
-{
-    m_runConfiguration->setUseCppDebugger(toggled);
-}
-
-void CustomExecutableConfigurationWidget::useQmlDebuggerToggled(bool toggled)
-{
-    m_runConfiguration->setUseQmlDebugger(toggled);
-}
-
-void CustomExecutableConfigurationWidget::qmlDebugServerPortChanged(uint port)
-{
-    m_runConfiguration->setQmlDebugServerPort(port);
-}
-
-void CustomExecutableConfigurationWidget::baseEnvironmentChanged()
-{
-    if (m_ignoreChange)
-        return;
-
-    int index = CustomExecutableRunConfiguration::BaseEnvironmentBase(
-            m_runConfiguration->baseEnvironmentBase());
-    m_baseEnvironmentComboBox->setCurrentIndex(index);
-    m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
-    m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText());
-}
-
-void CustomExecutableConfigurationWidget::userEnvironmentChangesChanged()
-{
-    m_environmentWidget->setUserChanges(m_runConfiguration->userEnvironmentChanges());
-}
-
-
-void CustomExecutableConfigurationWidget::executableEdited()
-{
-    m_ignoreChange = true;
-    m_runConfiguration->setExecutable(m_executableChooser->rawPath());
-    m_ignoreChange = false;
-}
-void CustomExecutableConfigurationWidget::argumentsEdited(const QString &arguments)
-{
-    m_ignoreChange = true;
-    m_runConfiguration->setBaseCommandLineArguments(arguments);
-    m_ignoreChange = false;
-}
-void CustomExecutableConfigurationWidget::workingDirectoryEdited()
-{
-    m_ignoreChange = true;
-    m_runConfiguration->setBaseWorkingDirectory(m_workingDirectory->rawPath());
-    m_ignoreChange = false;
-}
-
-void CustomExecutableConfigurationWidget::termToggled(bool on)
-{
-    m_ignoreChange = true;
-    m_runConfiguration->setRunMode(on ? LocalApplicationRunConfiguration::Console
-                                      : LocalApplicationRunConfiguration::Gui);
-    m_ignoreChange = false;
-}
-
-void CustomExecutableConfigurationWidget::changed()
-{
-    // We triggered the change, don't update us
-    if (m_ignoreChange)
-        return;
-
-    m_executableChooser->setPath(m_runConfiguration->rawExecutable());
-    m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->baseCommandLineArguments()));
-    m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
-    m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console);
-}
-
 void CustomExecutableRunConfiguration::ctor()
 {
     setDefaultDisplayName(defaultDisplayName());
diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.h b/src/plugins/projectexplorer/customexecutablerunconfiguration.h
index b68b0447a3ebf6656af2616e3ba328d3723363e4..b1f0abe2c7286ffca68b6461b080496a67db104f 100644
--- a/src/plugins/projectexplorer/customexecutablerunconfiguration.h
+++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.h
@@ -33,25 +33,8 @@
 #include "applicationrunconfiguration.h"
 
 #include <QtCore/QVariantMap>
-#include <QtGui/QWidget>
-
-QT_BEGIN_NAMESPACE
-class QCheckBox;
-class QLineEdit;
-class QComboBox;
-class QLabel;
-class QAbstractButton;
-QT_END_NAMESPACE
-
-namespace Utils {
-class DetailsWidget;
-class PathChooser;
-class DebuggerLanguageChooser;
-}
 
 namespace ProjectExplorer {
-
-class EnvironmentWidget;
 class Target;
 
 namespace Internal {
@@ -160,46 +143,6 @@ public:
     RunConfiguration *clone(Target *parent, RunConfiguration *source);
 };
 
-namespace Internal {
-
-class CustomExecutableConfigurationWidget : public QWidget
-{
-    Q_OBJECT
-
-public:
-    CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc);
-
-private slots:
-    void changed();
-
-    void executableEdited();
-    void argumentsEdited(const QString &arguments);
-    void workingDirectoryEdited();
-    void termToggled(bool);
-
-    void userChangesChanged();
-    void baseEnvironmentChanged();
-    void userEnvironmentChangesChanged();
-    void baseEnvironmentSelected(int index);
-    void useCppDebuggerToggled(bool toggled);
-    void useQmlDebuggerToggled(bool toggled);
-    void qmlDebugServerPortChanged(uint port);
-
-private:
-    bool m_ignoreChange;
-    CustomExecutableRunConfiguration *m_runConfiguration;
-    Utils::PathChooser *m_executableChooser;
-    QLineEdit *m_userName;
-    QLineEdit *m_commandLineArgumentsLineEdit;
-    Utils::PathChooser *m_workingDirectory;
-    QCheckBox *m_useTerminalCheck;
-    ProjectExplorer::EnvironmentWidget *m_environmentWidget;
-    QComboBox *m_baseEnvironmentComboBox;
-    Utils::DetailsWidget *m_detailsContainer;
-    Utils::DebuggerLanguageChooser *m_debuggerLanguageChooser;
-};
-
-} // namespace Internal
 } // namespace ProjectExplorer
 
 #endif // CUSTOMEXECUTABLERUNCONFIGURATION_H
diff --git a/src/plugins/projectexplorer/debugginghelper.h b/src/plugins/projectexplorer/debugginghelper.h
index 38a4e40770bbdd165099cde4b32af8799b0b2423..ae6451855c76383e8f629933775c306ae8b2bc7f 100644
--- a/src/plugins/projectexplorer/debugginghelper.h
+++ b/src/plugins/projectexplorer/debugginghelper.h
@@ -32,7 +32,6 @@
 
 #include "projectexplorer_export.h"
 
-#include <utils/environment.h>
 #include <utils/buildablehelperlibrary.h>
 
 #include <QtCore/QString>
diff --git a/src/plugins/projectexplorer/deployconfiguration.h b/src/plugins/projectexplorer/deployconfiguration.h
index e03a2ee4f4878f219d85a9fbd8a1c608093725b7..f03f4b24f46fe4e62032316e17f06bcfc98aee23 100644
--- a/src/plugins/projectexplorer/deployconfiguration.h
+++ b/src/plugins/projectexplorer/deployconfiguration.h
@@ -37,8 +37,6 @@
 
 #include <QtCore/QString>
 #include <QtCore/QStringList>
-#include <QtCore/QList>
-#include <QtCore/QObject>
 
 namespace ProjectExplorer {
 
diff --git a/src/plugins/projectexplorer/filewatcher.h b/src/plugins/projectexplorer/filewatcher.h
index 61a83ae0ad15bb861d1b3d769fd6ceccc27546ee..51d15d0faefb4d144d94902b3b6d694afb1cee12 100644
--- a/src/plugins/projectexplorer/filewatcher.h
+++ b/src/plugins/projectexplorer/filewatcher.h
@@ -39,7 +39,6 @@
 #include <QtCore/QMap>
 
 QT_BEGIN_NAMESPACE
-class QTimer;
 class QFileSystemWatcher;
 QT_END_NAMESPACE
 
diff --git a/src/plugins/projectexplorer/ioutputparser.cpp b/src/plugins/projectexplorer/ioutputparser.cpp
index 4bd15206071b0743a6bafa805386589ad2a55470..9bc7ef60fb50241851c9f56b74def7958cc10b8e 100644
--- a/src/plugins/projectexplorer/ioutputparser.cpp
+++ b/src/plugins/projectexplorer/ioutputparser.cpp
@@ -28,7 +28,9 @@
 **************************************************************************/
 
 #include "ioutputparser.h"
-#include "utils/qtcassert.h"
+#include "task.h"
+
+#include <utils/qtcassert.h>
 
 namespace ProjectExplorer {
 
diff --git a/src/plugins/projectexplorer/ioutputparser.h b/src/plugins/projectexplorer/ioutputparser.h
index 37da95b6ce6f54bcd6b6531e5abf03720c1da153..b733aa5a12fdfeb97cf3ec7af046f8e37fe82d1c 100644
--- a/src/plugins/projectexplorer/ioutputparser.h
+++ b/src/plugins/projectexplorer/ioutputparser.h
@@ -31,13 +31,12 @@
 #define IOUTPUTPARSER_H
 
 #include "projectexplorer_export.h"
-#include "task.h"
 #include "buildstep.h"
 
-#include <QtCore/QObject>
 #include <QtCore/QString>
 
 namespace ProjectExplorer {
+class Task;
 
 class PROJECTEXPLORER_EXPORT IOutputParser : public QObject
 {
diff --git a/src/plugins/projectexplorer/iprojectproperties.h b/src/plugins/projectexplorer/iprojectproperties.h
index 052e3dceadf7c591c35690e4401ecadbe0496638..614bc50882af667e5ecf7f7d8e2baa955603d093 100644
--- a/src/plugins/projectexplorer/iprojectproperties.h
+++ b/src/plugins/projectexplorer/iprojectproperties.h
@@ -32,7 +32,9 @@
 
 #include "projectexplorer_export.h"
 
-#include <QtGui/QIcon>
+#include <QtCore/QObject>
+
+QT_FORWARD_DECLARE_CLASS(QIcon)
 
 namespace ProjectExplorer {
 class Project;
diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fda6752b7d03e51fa821d995ff35dcac65400d2e
--- /dev/null
+++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp
@@ -0,0 +1,141 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "localapplicationruncontrol.h"
+#include "applicationrunconfiguration.h"
+#include "projectexplorerconstants.h"
+
+#include <utils/qtcassert.h>
+#include <utils/environment.h>
+
+#include <QtGui/QLabel>
+#include <QtCore/QDir>
+
+namespace ProjectExplorer {
+namespace Internal {
+
+LocalApplicationRunControlFactory::LocalApplicationRunControlFactory()
+{
+}
+
+LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
+{
+}
+
+bool LocalApplicationRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const
+{
+    return (mode == ProjectExplorer::Constants::RUNMODE)
+            && (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration) != 0);
+}
+
+QString LocalApplicationRunControlFactory::displayName() const
+{
+    return tr("Run");
+}
+
+RunControl *LocalApplicationRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
+{
+    QTC_ASSERT(canRun(runConfiguration, mode), return 0);
+    return new LocalApplicationRunControl(qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration), mode);
+}
+
+QWidget *LocalApplicationRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
+{
+    Q_UNUSED(runConfiguration)
+    return new QLabel("TODO add Configuration widget");
+}
+
+// ApplicationRunControl
+
+LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, QString mode)
+    : RunControl(rc, mode)
+{
+    Utils::Environment env = rc->environment();
+    QString dir = rc->workingDirectory();
+    m_applicationLauncher.setEnvironment(env.toStringList());
+    m_applicationLauncher.setWorkingDirectory(dir);
+
+    m_executable = rc->executable();
+    m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode());
+    m_commandLineArguments = rc->commandLineArguments();
+
+    connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
+            this, SLOT(slotAppendMessage(QString,bool)));
+    connect(&m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
+            this, SLOT(slotAddToOutputWindow(QString, bool)));
+    connect(&m_applicationLauncher, SIGNAL(processExited(int)),
+            this, SLOT(processExited(int)));
+    connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
+            this, SLOT(bringApplicationToForeground(qint64)));
+}
+
+LocalApplicationRunControl::~LocalApplicationRunControl()
+{
+}
+
+void LocalApplicationRunControl::start()
+{
+    m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
+    emit started();
+
+    emit appendMessage(this, tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)), false);
+}
+
+LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop()
+{
+    m_applicationLauncher.stop();
+    return StoppedSynchronously;
+}
+
+bool LocalApplicationRunControl::isRunning() const
+{
+    return m_applicationLauncher.isRunning();
+}
+
+void LocalApplicationRunControl::slotAppendMessage(const QString &err,
+                                                   bool isError)
+{
+    emit appendMessage(this, err, isError);
+    emit finished();
+}
+
+void LocalApplicationRunControl::slotAddToOutputWindow(const QString &line,
+                                                       bool isError)
+{
+    emit addToOutputWindowInline(this, line, isError);
+}
+
+void LocalApplicationRunControl::processExited(int exitCode)
+{
+    emit appendMessage(this, tr("%1 exited with code %2").arg(QDir::toNativeSeparators(m_executable)).arg(exitCode), false);
+    emit finished();
+}
+
+} // namespace Internal
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.h b/src/plugins/projectexplorer/localapplicationruncontrol.h
new file mode 100644
index 0000000000000000000000000000000000000000..3c546f0c3bc7819185721ff1429a9a97b22d9108
--- /dev/null
+++ b/src/plugins/projectexplorer/localapplicationruncontrol.h
@@ -0,0 +1,76 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef LOCALAPPLICATIONRUNCONTROL_H
+#define LOCALAPPLICATIONRUNCONTROL_H
+
+#include "runconfiguration.h"
+#include "applicationlauncher.h"
+
+namespace ProjectExplorer {
+
+class LocalApplicationRunConfiguration;
+namespace Internal {
+
+class LocalApplicationRunControlFactory : public IRunControlFactory
+{
+    Q_OBJECT
+public:
+    LocalApplicationRunControlFactory ();
+    virtual ~LocalApplicationRunControlFactory();
+    virtual bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
+    virtual QString displayName() const;
+    virtual RunControl* create(RunConfiguration *runConfiguration, const QString &mode);
+    virtual QWidget *createConfigurationWidget(RunConfiguration  *runConfiguration);
+};
+
+class LocalApplicationRunControl : public RunControl
+{
+    Q_OBJECT
+public:
+    LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, QString mode);
+    virtual ~LocalApplicationRunControl();
+    virtual void start();
+    virtual StopResult stop();
+    virtual bool isRunning() const;
+private slots:
+    void processExited(int exitCode);
+    void slotAddToOutputWindow(const QString &line, bool isError);
+    void slotAppendMessage(const QString &err, bool isError);
+private:
+    ProjectExplorer::ApplicationLauncher m_applicationLauncher;
+    QString m_executable;
+    QStringList m_commandLineArguments;
+    ProjectExplorer::ApplicationLauncher::Mode m_runMode;
+};
+
+} // namespace Internal
+} // namespace ProjectExplorer
+
+#endif // LOCALAPPLICATIONRUNCONTROL_H
diff --git a/src/plugins/projectexplorer/outputformatter.cpp b/src/plugins/projectexplorer/outputformatter.cpp
index e42796ddd59273131bf1fa392f62642b90673e83..8efde3a70be974e9c8457a4ca112dd63cd40f1ca 100644
--- a/src/plugins/projectexplorer/outputformatter.cpp
+++ b/src/plugins/projectexplorer/outputformatter.cpp
@@ -33,6 +33,9 @@
 #include <texteditor/texteditorsettings.h>
 
 #include <QtGui/QPlainTextEdit>
+#include <QtGui/QColor>
+
+#include <QtCore/QString>
 
 using namespace ProjectExplorer;
 using namespace TextEditor;
diff --git a/src/plugins/projectexplorer/outputformatter.h b/src/plugins/projectexplorer/outputformatter.h
index 283e7a3a76eb1fdba047b90b592f6626725770ef..d1501c1b664fbc83bd0c49fbe6a8d9a305a1af2c 100644
--- a/src/plugins/projectexplorer/outputformatter.h
+++ b/src/plugins/projectexplorer/outputformatter.h
@@ -33,12 +33,11 @@
 #include "projectexplorer_export.h"
 
 #include <QtCore/QObject>
-#include <QtCore/QString>
-#include <QtGui/QColor>
 
 QT_FORWARD_DECLARE_CLASS(QMouseEvent);
 QT_FORWARD_DECLARE_CLASS(QPlainTextEdit);
 QT_FORWARD_DECLARE_CLASS(QTextCharFormat);
+QT_FORWARD_DECLARE_CLASS(QColor);
 
 namespace ProjectExplorer {
 
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 4e09ec0a836544f969b1c3458b48bcbeaf91b056..71ac23a92866afdaff39fe51a1fe51b5c5a58bd4 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -38,7 +38,7 @@
 #include "copytaskhandler.h"
 #include "showineditortaskhandler.h"
 #include "vcsannotatetaskhandler.h"
-#include "applicationrunconfiguration.h"
+#include "localapplicationruncontrol.h"
 #include "allprojectsfilter.h"
 #include "allprojectsfind.h"
 #include "buildmanager.h"
@@ -65,6 +65,7 @@
 #include "runsettingspropertiespage.h"
 #include "scriptwrappers.h"
 #include "session.h"
+#include "projectnodes.h"
 #include "sessiondialog.h"
 #include "target.h"
 #include "projectexplorersettingspage.h"
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index 2b395948d5f84f4b745633665d197d5887ca6b6d..3dd702f50b951adf7f7773da073aad960dca6ae5 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -92,7 +92,10 @@ HEADERS += projectexplorer.h \
     runconfigurationmodel.h \
     buildconfigurationmodel.h \
     abstractprocessstep.h \
-    taskhub.h
+    taskhub.h \
+    localapplicationruncontrol.h \
+    customexecutableconfigurationwidget.h \
+    sessionnodeimpl.h
 SOURCES += projectexplorer.cpp \
     projectwindow.cpp \
     buildmanager.cpp \
@@ -169,7 +172,10 @@ SOURCES += projectexplorer.cpp \
     outputformatter.cpp \
     runconfigurationmodel.cpp \
     buildconfigurationmodel.cpp \
-    taskhub.cpp
+    taskhub.cpp \
+    localapplicationruncontrol.cpp \
+    customexecutableconfigurationwidget.cpp \
+    sessionnodeimpl.cpp
 FORMS += processstep.ui \
     editorsettingspropertiespage.ui \
     runsettingspropertiespage.ui \
diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp
index 9a2e6815dbf8686fc19a24eb50b9fdca336a93fb..6739a064bb5876f46e99fc5e29a1fbf64c30feeb 100644
--- a/src/plugins/projectexplorer/projecttreewidget.cpp
+++ b/src/plugins/projectexplorer/projecttreewidget.cpp
@@ -30,6 +30,7 @@
 #include "projecttreewidget.h"
 
 #include "projectexplorer.h"
+#include "projectnodes.h"
 #include "project.h"
 #include "session.h"
 #include "projectexplorerconstants.h"
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h
index 0117104f7066a06fb3339955bafc1a8a9f42aa0b..523a8179faf2ef773b4a801c15b4dce0777ecb75 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.h
@@ -33,6 +33,7 @@
 #include "iprojectproperties.h"
 
 #include <QtGui/QWidget>
+#include <QtGui/QIcon>
 
 QT_BEGIN_NAMESPACE
 class QMenu;
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index 5f43ee19e06a2fdd90ff28d77463740b256085cf..9b04fbe1265f5d6b7c6b848cfe1e428e58fb5b87 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -28,6 +28,7 @@
 **************************************************************************/
 
 #include "session.h"
+#include "sessionnodeimpl.h"
 
 #include "project.h"
 #include "projectexplorer.h"
@@ -111,7 +112,6 @@ private:
 using namespace ProjectExplorer;
 using namespace ProjectExplorer::Internal;
 
-
 void SessionFile::sessionLoadingProgress()
 {
     future.setProgressValue(future.progressValue() + 1);
@@ -305,28 +305,6 @@ void SessionFile::clearFailedProjectFileNames()
     m_failedProjects.clear();
 }
 
-Internal::SessionNodeImpl::SessionNodeImpl(SessionManager *manager)
-        : ProjectExplorer::SessionNode(manager->currentSession(), manager)
-{
-    setFileName("session");
-}
-
-void Internal::SessionNodeImpl::addProjectNode(ProjectNode *projectNode)
-{
-    addProjectNodes(QList<ProjectNode*>() << projectNode);
-}
-
-void Internal::SessionNodeImpl::removeProjectNode(ProjectNode *projectNode)
-{
-    removeProjectNodes(QList<ProjectNode*>() << projectNode);
-}
-
-void Internal::SessionNodeImpl::setFileName(const QString &fileName)
-{
-    setPath(fileName);
-    setDisplayName(fileName);
-}
-
 /* --------------------------------- */
 
 SessionManager::SessionManager(QObject *parent)
diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h
index 89d10e675ecbe195e3192a3b630f5eecd5388d8a..213730b5f687d8b5b5143bd61ffb1064c1e94c96 100644
--- a/src/plugins/projectexplorer/session.h
+++ b/src/plugins/projectexplorer/session.h
@@ -31,16 +31,15 @@
 #define SESSION_H
 
 #include "projectexplorer_export.h"
-#include "projectnodes.h"
 
 #include <QtCore/QHash>
-#include <QtCore/QList>
 #include <QtCore/QString>
 #include <QtCore/QStringList>
 #include <QtCore/QPointer>
 
 QT_BEGIN_NAMESPACE
 class QAbstractItemModel;
+class QTimer;
 QT_END_NAMESPACE
 
 namespace Core {
@@ -58,23 +57,8 @@ class SessionNode;
 class SessionManager;
 
 namespace Internal {
-
 class SessionFile;
-
-// Must be in header as otherwise moc has issues
-// with ProjectExplorer::SessionNode on msvc2005
-class SessionNodeImpl : public ProjectExplorer::SessionNode
-{
-    Q_OBJECT
-public:
-    SessionNodeImpl(SessionManager *manager);
-
-    void addProjectNode(ProjectNode *projectNode);
-    void removeProjectNode(ProjectNode *projectNode);
-
-    void setFileName(const QString &fileName);
-};
-
+class SessionNodeImpl;
 } // namespace Internal
 
 // TODO the interface of this class is not really great
diff --git a/src/plugins/projectexplorer/sessionnodeimpl.cpp b/src/plugins/projectexplorer/sessionnodeimpl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2f2696b076226c8fd21fb587198c9dd24b102427
--- /dev/null
+++ b/src/plugins/projectexplorer/sessionnodeimpl.cpp
@@ -0,0 +1,59 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "sessionnodeimpl.h"
+#include "session.h"
+
+namespace ProjectExplorer {
+namespace Internal {
+
+SessionNodeImpl::SessionNodeImpl(SessionManager *manager)
+        : ProjectExplorer::SessionNode(manager->currentSession(), manager)
+{
+    setFileName(QLatin1String("session"));
+}
+
+void SessionNodeImpl::addProjectNode(ProjectNode *projectNode)
+{
+    addProjectNodes(QList<ProjectNode*>() << projectNode);
+}
+
+void SessionNodeImpl::removeProjectNode(ProjectNode *projectNode)
+{
+    removeProjectNodes(QList<ProjectNode*>() << projectNode);
+}
+
+void SessionNodeImpl::setFileName(const QString &fileName)
+{
+    setPath(fileName);
+    setDisplayName(fileName);
+}
+
+} // namespace Internal
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/sessionnodeimpl.h b/src/plugins/projectexplorer/sessionnodeimpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..24f1b678fbfa89f7280cc357f09b54dc9068b8e1
--- /dev/null
+++ b/src/plugins/projectexplorer/sessionnodeimpl.h
@@ -0,0 +1,57 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef SESSIONNODEIMPL_H
+#define SESSIONNODEIMPL_H
+
+#include "projectnodes.h"
+
+namespace ProjectExplorer {
+class SessionManager;
+
+namespace Internal {
+
+// Must be in a header as otherwise moc has issues
+// with ProjectExplorer::SessionNode on msvc2005
+class SessionNodeImpl : public ProjectExplorer::SessionNode
+{
+    Q_OBJECT
+public:
+    explicit SessionNodeImpl(SessionManager *manager);
+
+    void addProjectNode(ProjectNode *projectNode);
+    void removeProjectNode(ProjectNode *projectNode);
+
+    void setFileName(const QString &fileName);
+};
+
+} // namespace Internal
+} // namespace ProjectExplorer
+
+#endif // SESSIONNODEIMPL_H
diff --git a/src/plugins/projectexplorer/showineditortaskhandler.h b/src/plugins/projectexplorer/showineditortaskhandler.h
index 09cc874f3d6c2340f733525ca5b38ae4d7b50c75..21f177544136496c9f2d18a0aa8004b86d6b0bb7 100644
--- a/src/plugins/projectexplorer/showineditortaskhandler.h
+++ b/src/plugins/projectexplorer/showineditortaskhandler.h
@@ -30,14 +30,12 @@
 #ifndef PROJECTEXPLORER_SHOWINEDITORTASKHANDLER_H
 #define PROJECTEXPLORER_SHOWINEDITORTASKHANDLER_H
 
-#include "projectexplorer_export.h"
-
 #include "itaskhandler.h"
 
 namespace ProjectExplorer {
 namespace Internal {
 
-class PROJECTEXPLORER_EXPORT ShowInEditorTaskHandler : public ITaskHandler
+class ShowInEditorTaskHandler : public ITaskHandler
 {
     Q_OBJECT
 
diff --git a/src/plugins/projectexplorer/showoutputtaskhandler.h b/src/plugins/projectexplorer/showoutputtaskhandler.h
index b53f81f0c5b7cae9e874de1db9aeb038c1facab7..33647597ff064b55231da2d9566678148857c052 100644
--- a/src/plugins/projectexplorer/showoutputtaskhandler.h
+++ b/src/plugins/projectexplorer/showoutputtaskhandler.h
@@ -30,8 +30,6 @@
 #ifndef PROJECTEXPLORER_SHOWOUTPUTTASKHANDLER_H
 #define PROJECTEXPLORER_SHOWOUTPUTTASKHANDLER_H
 
-#include "projectexplorer_export.h"
-
 #include "itaskhandler.h"
 
 namespace ProjectExplorer {
@@ -39,7 +37,7 @@ namespace Internal {
 
 class CompileOutputWindow;
 
-class PROJECTEXPLORER_EXPORT ShowOutputTaskHandler : public ITaskHandler
+class ShowOutputTaskHandler : public ITaskHandler
 {
     Q_OBJECT
 
diff --git a/src/plugins/projectexplorer/vcsannotatetaskhandler.h b/src/plugins/projectexplorer/vcsannotatetaskhandler.h
index 18bfcaf6b8d8c84cefba12f69db7513436ecc39a..42b5b9b2e9528e6797818290d8ef8eda1fa82d2a 100644
--- a/src/plugins/projectexplorer/vcsannotatetaskhandler.h
+++ b/src/plugins/projectexplorer/vcsannotatetaskhandler.h
@@ -30,8 +30,6 @@
 #ifndef PROJECTEXPLORER_VCSANNOTATETASKHANDLER_H
 #define PROJECTEXPLORER_VCSANNOTATETASKHANDLER_H
 
-#include "projectexplorer_export.h"
-
 #include "itaskhandler.h"
 
 namespace Core {
@@ -41,7 +39,7 @@ class IVersionControl;
 namespace ProjectExplorer {
 namespace Internal {
 
-class PROJECTEXPLORER_EXPORT VcsAnnotateTaskHandler : public ITaskHandler
+class VcsAnnotateTaskHandler : public ITaskHandler
 {
     Q_OBJECT