Analyzer: Use AnalyzerManager for run control creation

Less code.

Change-Id: Ic26d291ada7efd05899623738d89c52b4175716c
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
This commit is contained in:
hjk
2013-08-01 15:02:42 +02:00
parent c1919f0ac3
commit 213cb601af
8 changed files with 24 additions and 54 deletions

View File

@@ -867,11 +867,17 @@ void AnalyzerManager::handleToolFinished()
m_instance->d->handleToolFinished();
}
IAnalyzerTool *AnalyzerManager::toolFromRunMode(RunMode runMode)
AnalyzerRunControl *AnalyzerManager::createRunControl(
const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode runMode,
QString *errorMessage)
{
foreach (IAnalyzerTool *tool, m_instance->d->m_tools)
if (tool->runMode() == runMode)
return tool;
return tool->createRunControl(sp, runConfiguration);
if (errorMessage)
*errorMessage = tr("No analyzer tool selected.");
return 0;
}

View File

@@ -43,16 +43,17 @@ class QDockWidget;
class QAction;
QT_END_NAMESPACE
namespace Utils {
class FancyMainWindow;
}
namespace Utils { class FancyMainWindow; }
namespace ProjectExplorer { class RunConfiguration; }
namespace Analyzer {
typedef QList<StartMode> StartModes;
class IAnalyzerTool;
class AnalyzerRunControl;
class AnalyzerManagerPrivate;
class AnalyzerStartParameters;
// FIXME: Merge with AnalyzerPlugin.
@@ -69,7 +70,6 @@ public:
// Register a tool and initialize it.
static void addTool(IAnalyzerTool *tool, const StartModes &mode);
static IAnalyzerTool *toolFromRunMode(ProjectExplorer::RunMode runMode);
// Dockwidgets are registered to the main window.
static QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
@@ -97,6 +97,10 @@ public:
static void handleToolFinished();
static QAction *stopAction();
static AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode runMode,
QString *errorMessage);
private:
friend class AnalyzerManagerPrivate;
AnalyzerManagerPrivate *const d;