forked from qt-creator/qt-creator
analyzer: refactor AnalyzerManager
Change-Id: Id925bb638b2757ef079c21192d4e2a8cc8f08694 Reviewed-on: http://codereview.qt.nokia.com/908 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -54,8 +54,6 @@
|
||||
using namespace Analyzer;
|
||||
using namespace Analyzer::Internal;
|
||||
|
||||
static const char lastActiveToolC[] = "Analyzer.Plugin.LastActiveTool";
|
||||
|
||||
AnalyzerPlugin *AnalyzerPlugin::m_instance = 0;
|
||||
|
||||
|
||||
@@ -113,34 +111,11 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
|
||||
|
||||
void AnalyzerPlugin::extensionsInitialized()
|
||||
{
|
||||
const QList<IAnalyzerTool *> tools = d->m_manager->tools();
|
||||
if (tools.isEmpty())
|
||||
return;
|
||||
|
||||
const QSettings *settings = Core::ICore::instance()->settings();
|
||||
const QString lastActiveToolId =
|
||||
settings->value(QLatin1String(lastActiveToolC), QString()).toString();
|
||||
IAnalyzerTool *lastActiveTool = 0;
|
||||
|
||||
foreach (IAnalyzerTool *tool, tools) {
|
||||
tool->extensionsInitialized();
|
||||
if (tool->id() == lastActiveToolId)
|
||||
lastActiveTool = tool;
|
||||
}
|
||||
|
||||
if (!lastActiveTool)
|
||||
lastActiveTool = tools.back();
|
||||
if (lastActiveTool)
|
||||
d->m_manager->selectTool(lastActiveTool);
|
||||
d->m_manager->extensionsInitialized();
|
||||
}
|
||||
|
||||
ExtensionSystem::IPlugin::ShutdownFlag AnalyzerPlugin::aboutToShutdown()
|
||||
{
|
||||
if (const IAnalyzerTool *tool = d->m_manager->currentTool()) {
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->setValue(QLatin1String(lastActiveToolC), tool->id());
|
||||
}
|
||||
|
||||
d->m_manager->shutdown();
|
||||
return SynchronousShutdown;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user