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

Method documentJumpPerformed

plugins/contextbrowser/contextbrowser.cpp:1237–1278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1235}
1236
1237void ContextBrowserPlugin::documentJumpPerformed(KDevelop::IDocument* newDocument,
1238 const KTextEditor::Cursor& newCursor,
1239 KDevelop::IDocument* previousDocument,
1240 const KTextEditor::Cursor& previousCursor)
1241{
1242 DUChainReadLocker lock(DUChain::lock());
1243
1244 /*TODO: support multiple windows if that ever gets revived
1245 if(newDocument && newDocument->textDocument() && newDocument->textDocument()->activeView() && masterWidget(newDocument->textDocument()->activeView()) != masterWidget(this))
1246 return;
1247 */
1248
1249 if (previousDocument && previousCursor.isValid()) {
1250 qCDebug(PLUGIN_CONTEXTBROWSER) << "updating jump source";
1251 DUContext* context = contextAt(previousDocument->url(), previousCursor);
1252 if (context) {
1253 updateHistory(context, KTextEditor::Cursor(previousCursor), true);
1254 } else {
1255 //We just want this place in the history
1256 m_history.resize(m_nextHistoryIndex); // discard forward history
1257 m_history.append(HistoryEntry(DocumentCursor(IndexedString(previousDocument->url()),
1258 KTextEditor::Cursor(previousCursor))));
1259 ++m_nextHistoryIndex;
1260 }
1261 }
1262 qCDebug(PLUGIN_CONTEXTBROWSER) << "new doc: " << newDocument << " new cursor: " << newCursor;
1263 if (newDocument && newCursor.isValid()) {
1264 qCDebug(PLUGIN_CONTEXTBROWSER) << "updating jump target";
1265 DUContext* context = contextAt(newDocument->url(), newCursor);
1266 if (context) {
1267 updateHistory(context, KTextEditor::Cursor(newCursor), true);
1268 } else {
1269 //We just want this place in the history
1270 m_history.resize(m_nextHistoryIndex); // discard forward history
1271 m_history.append(HistoryEntry(DocumentCursor(IndexedString(newDocument->url()),
1272 KTextEditor::Cursor(newCursor))));
1273 ++m_nextHistoryIndex;
1274 if (m_outlineLine)
1275 m_outlineLine->clear();
1276 }
1277 }
1278}
1279
1280void ContextBrowserPlugin::updateButtonState()
1281{

Callers 1

openDocumentInternalMethod · 0.80

Calls 9

contextAtFunction · 0.85
HistoryEntryClass · 0.70
CursorClass · 0.50
DocumentCursorClass · 0.50
IndexedStringClass · 0.50
isValidMethod · 0.45
urlMethod · 0.45
appendMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected