Add support to force skip deploy before running or debugging

When we enabled the option "Always deploy project before running it",
and try to running or debugging a big project, e.g. QtCreator.
We need waitting a long time for deploy it.
But in fact, we not need this in every time.
So we can add two menu items:
"Run Without Deployment" and "Debug Without Deployment".
We can running or debugging directly.

Change-Id: I6ba92aa0cfa792cef923012856b79c29a672252c
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Yuchen Deng
2011-10-25 18:23:37 +08:00
committed by Tobias Hunger
parent e453585df5
commit 4537e1b834
4 changed files with 76 additions and 14 deletions

View File

@@ -90,14 +90,15 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorersettings.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h>
#include <qtsupport/qtsupportconstants.h>
@@ -719,8 +720,10 @@ public slots:
void onModeChanged(Core::IMode *mode);
void onCoreAboutToOpen();
void showSettingsDialog();
void updateDebugWithoutDeployMenu();
void debugProject();
void debugProjectWithoutDeploy();
void debugProjectBreakMain();
void startExternalApplication();
void startRemoteCdbSession();
@@ -1027,6 +1030,7 @@ public:
Utils::ProxyAction *m_visibleStartAction;
Utils::ProxyAction *m_hiddenStopAction;
QAction *m_startAction;
QAction *m_debugWithoutDeployAction;
QAction *m_startExternalAction;
QAction *m_startRemoteAction;
QAction *m_attachToQmlPortAction;
@@ -1145,6 +1149,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
m_reverseToolButton = 0;
m_startAction = 0;
m_debugWithoutDeployAction = 0;
m_startExternalAction = 0;
m_startRemoteAction = 0;
m_attachRemoteAction = 0;
@@ -1395,6 +1400,7 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
m_continueAction->setEnabled(false);
m_exitAction->setEnabled(false);
m_startAction->setEnabled(true);
m_debugWithoutDeployAction->setEnabled(true);
m_visibleStartAction->setAction(m_startAction);
}
@@ -1409,6 +1415,13 @@ void DebuggerPluginPrivate::debugProject()
pe->runProject(pro, Constants::DEBUGMODE);
}
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *pro = pe->startupProject())
pe->runProject(pro, Constants::DEBUGMODE, true);
}
void DebuggerPluginPrivate::debugProjectBreakMain()
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
@@ -2158,6 +2171,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_continueAction->setEnabled(false);
m_exitAction->setEnabled(false);
m_startAction->setEnabled(true);
m_debugWithoutDeployAction->setEnabled(true);
m_visibleStartAction->setAction(m_startAction);
m_hiddenStopAction->setAction(m_undisturbableAction);
} else if (state == InferiorStopOk) {
@@ -2166,6 +2180,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_continueAction->setEnabled(true);
m_exitAction->setEnabled(true);
m_startAction->setEnabled(false);
m_debugWithoutDeployAction->setEnabled(false);
m_visibleStartAction->setAction(m_continueAction);
m_hiddenStopAction->setAction(m_exitAction);
} else if (state == InferiorRunOk) {
@@ -2174,6 +2189,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_continueAction->setEnabled(false);
m_exitAction->setEnabled(true);
m_startAction->setEnabled(false);
m_debugWithoutDeployAction->setEnabled(false);
m_visibleStartAction->setAction(m_interruptAction);
m_hiddenStopAction->setAction(m_interruptAction);
} else if (state == DebuggerFinished) {
@@ -2182,6 +2198,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_continueAction->setEnabled(false);
m_exitAction->setEnabled(false);
m_startAction->setEnabled(true);
m_debugWithoutDeployAction->setEnabled(true);
m_visibleStartAction->setAction(m_startAction);
m_hiddenStopAction->setAction(m_undisturbableAction);
m_codeModelSnapshot = CPlusPlus::Snapshot();
@@ -2193,6 +2210,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_continueAction->setEnabled(false);
m_exitAction->setEnabled(true);
m_startAction->setEnabled(false);
m_debugWithoutDeployAction->setEnabled(false);
m_visibleStartAction->setAction(m_startAction);
m_hiddenStopAction->setAction(m_undisturbableAction);
} else {
@@ -2201,6 +2219,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_continueAction->setEnabled(false);
m_exitAction->setEnabled(false);
m_startAction->setEnabled(false);
m_debugWithoutDeployAction->setEnabled(false);
m_visibleStartAction->setAction(m_undisturbableAction);
m_hiddenStopAction->setAction(m_undisturbableAction);
}
@@ -2288,6 +2307,7 @@ void DebuggerPluginPrivate::updateDebugActions()
const bool canRun = pe->canRun(project, debugMode);
m_startAction->setEnabled(canRun);
m_startAction->setToolTip(canRun ? QString() : pe->cannotRunReason(project, debugMode));
m_debugWithoutDeployAction->setEnabled(canRun);
// Step into/next: Start and break at 'main' unless a debugger is running.
if (m_snapshotHandler->currentIndex() < 0) {
@@ -2342,6 +2362,12 @@ void DebuggerPluginPrivate::showSettingsDialog()
_(DEBUGGER_COMMON_SETTINGS_ID));
}
void DebuggerPluginPrivate::updateDebugWithoutDeployMenu()
{
const bool state = ProjectExplorerPlugin::instance()->projectExplorerSettings().deployBeforeRun;
m_debugWithoutDeployAction->setVisible(state);
}
void DebuggerPluginPrivate::dumpLog()
{
QString fileName = QFileDialog::getSaveFileName(mainWindow(),
@@ -2952,6 +2978,10 @@ void DebuggerPluginPrivate::extensionsInitialized()
act->setText(tr("Start Debugging"));
connect(act, SIGNAL(triggered()), this, SLOT(debugProject()));
act = m_debugWithoutDeployAction = new QAction(this);
act->setText(tr("Debug Without Deployment"));
connect(act, SIGNAL(triggered()), this, SLOT(debugProjectWithoutDeploy()));
// Handling of external applications.
act = m_startExternalAction = new QAction(this);
act->setText(tr("Start and Debug External Application..."));
@@ -3018,6 +3048,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
ModeManager *modeManager = ModeManager::instance();
modeManager->addAction(m_visibleStartAction, Constants::P_ACTION_DEBUG);
cmd = am->registerAction(m_debugWithoutDeployAction,
"Debugger.DebugWithoutDeploy", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_attachExternalAction,
"Debugger.AttachExternal", globalcontext);
cmd->setAttribute(Command::CA_Hide);
@@ -3238,7 +3273,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
SLOT(onModeChanged(Core::IMode*)));
connect(ICore::instance(), SIGNAL(coreAboutToOpen()),
SLOT(onCoreAboutToOpen()));
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
this, SLOT(updateDebugWithoutDeployMenu()));
// Debug mode setup
DebugMode *debugMode = new DebugMode;