MCPcopy Create free account
hub / github.com/KDE/kdevelop / documentUrlChanged

Method documentUrlChanged

plugins/problemreporter/problemreporterplugin.cpp:174–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174void ProblemReporterPlugin::documentUrlChanged(IDocument* document, const QUrl& previousUrl)
175{
176 if (!document->textDocument())
177 return;
178
179 qCDebug(PLUGIN_PROBLEMREPORTER) << "document URL changed from" << previousUrl.toString() << "to"
180 << document->url().toString();
181
182 const IndexedString previousUrlIndexed(previousUrl);
183 const auto it = m_visualizers.constFind(previousUrlIndexed);
184 if (it == m_visualizers.cend()) {
185 qCWarning(PLUGIN_PROBLEMREPORTER)
186 << "a visualizer for renamed document is missing:" << document->textDocument();
187 return;
188 }
189 Q_ASSERT(it.value()->document() == document->textDocument());
190
191 m_reHighlightNeeded.remove(previousUrlIndexed);
192
193 auto* const visualizer = it.value();
194 m_visualizers.erase(it);
195
196 const IndexedString currentUrl{document->url()};
197 if (m_visualizers.contains(currentUrl)) {
198 // The renamed document must have been closed already in DocumentControllerPrivate::changeDocumentUrl()
199 // because of a conflict with another open modified document at its new URL. See a similar comment in
200 // ProblemReporterPlugin::documentClosed(). Just destroy document's obsolete visualizer here.
201 delete visualizer;
202 qCDebug(PLUGIN_PROBLEMREPORTER) << "the renamed document's URL equals another document's URL:" << document;
203 return;
204 }
205 m_visualizers.insert(currentUrl, visualizer);
206}
207
208void ProblemReporterPlugin::documentActivated(KDevelop::IDocument* document)
209{

Callers

nothing calls this directly

Calls 9

textDocumentMethod · 0.45
toStringMethod · 0.45
urlMethod · 0.45
constFindMethod · 0.45
documentMethod · 0.45
valueMethod · 0.45
removeMethod · 0.45
containsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected