Changeset View
Changeset View
Standalone View
Standalone View
plugins/problemreporter/problemreporterplugin.cpp
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 87 | { | |||
---|---|---|---|---|---|
93 | connect(ICore::self()->documentController(), &IDocumentController::documentClosed, this, | 93 | connect(ICore::self()->documentController(), &IDocumentController::documentClosed, this, | ||
94 | &ProblemReporterPlugin::documentClosed); | 94 | &ProblemReporterPlugin::documentClosed); | ||
95 | connect(ICore::self()->documentController(), &IDocumentController::textDocumentCreated, this, | 95 | connect(ICore::self()->documentController(), &IDocumentController::textDocumentCreated, this, | ||
96 | &ProblemReporterPlugin::textDocumentCreated); | 96 | &ProblemReporterPlugin::textDocumentCreated); | ||
97 | connect(DUChain::self(), &DUChain::updateReady, | 97 | connect(DUChain::self(), &DUChain::updateReady, | ||
98 | this, &ProblemReporterPlugin::updateReady); | 98 | this, &ProblemReporterPlugin::updateReady); | ||
99 | connect(ICore::self()->languageController()->staticAssistantsManager(), &StaticAssistantsManager::problemsChanged, | 99 | connect(ICore::self()->languageController()->staticAssistantsManager(), &StaticAssistantsManager::problemsChanged, | ||
100 | this, &ProblemReporterPlugin::updateHighlight); | 100 | this, &ProblemReporterPlugin::updateHighlight); | ||
101 | connect(pms, &ProblemModelSet::showRequested, this, &ProblemReporterPlugin::showModel); | ||||
101 | } | 102 | } | ||
102 | 103 | | |||
103 | ProblemReporterPlugin::~ProblemReporterPlugin() | 104 | ProblemReporterPlugin::~ProblemReporterPlugin() | ||
104 | { | 105 | { | ||
105 | qDeleteAll(m_highlighters); | 106 | qDeleteAll(m_highlighters); | ||
106 | } | 107 | } | ||
107 | 108 | | |||
108 | ProblemReporterModel* ProblemReporterPlugin::model() const | 109 | ProblemReporterModel* ProblemReporterPlugin::model() const | ||
Show All 36 Lines | |||||
145 | { | 146 | { | ||
146 | ProblemHighlighter* ph = m_highlighters.value(url); | 147 | ProblemHighlighter* ph = m_highlighters.value(url); | ||
147 | if (ph) { | 148 | if (ph) { | ||
148 | auto allProblems = m_model->problems(url, false); | 149 | auto allProblems = m_model->problems(url, false); | ||
149 | ph->setProblems(allProblems); | 150 | ph->setProblems(allProblems); | ||
150 | } | 151 | } | ||
151 | } | 152 | } | ||
152 | 153 | | |||
154 | void ProblemReporterPlugin::showModel(const QString& name) | ||||
155 | { | ||||
156 | auto w = dynamic_cast<ProblemsView*>(core()->uiController()->findToolView(i18n("Problems"), m_factory)); | ||||
kfunk: This definitely needs to check against w being a nullptr. | |||||
fixed. But old code seems to be correct, because we provide not-null pointer to factory and widget will be created if necessary. antonanikin: fixed. But old code seems to be correct, because we provide not-null pointer to factory and… | |||||
157 | if (w) | ||||
158 | w->showModel(name); | ||||
159 | } | ||||
160 | | ||||
153 | KDevelop::ContextMenuExtension ProblemReporterPlugin::contextMenuExtension(KDevelop::Context* context) | 161 | KDevelop::ContextMenuExtension ProblemReporterPlugin::contextMenuExtension(KDevelop::Context* context) | ||
154 | { | 162 | { | ||
155 | KDevelop::ContextMenuExtension extension; | 163 | KDevelop::ContextMenuExtension extension; | ||
156 | 164 | | |||
157 | KDevelop::EditorContext* editorContext = dynamic_cast<KDevelop::EditorContext*>(context); | 165 | KDevelop::EditorContext* editorContext = dynamic_cast<KDevelop::EditorContext*>(context); | ||
158 | if (editorContext) { | 166 | if (editorContext) { | ||
159 | DUChainReadLocker lock(DUChain::lock(), 1000); | 167 | DUChainReadLocker lock(DUChain::lock(), 1000); | ||
160 | if (!lock.locked()) { | 168 | if (!lock.locked()) { | ||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |
This definitely needs to check against w being a nullptr.