| 1235 | } |
| 1236 | |
| 1237 | void 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 | |
| 1280 | void ContextBrowserPlugin::updateButtonState() |
| 1281 | { |
no test coverage detected