Commit 4933406f authored by Eike Ziller's avatar Eike Ziller

Use EditorManager::openEditorAt instead of duplicating code

Change-Id: I231e89849e2f06958d05a511320ec236b5702a1c
Reviewed-by: default avatarAurindam Jana <aurindam.jana@digia.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 2125525e
......@@ -1992,20 +1992,14 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit)
if (!link.hasValidTarget())
return false;
Core::EditorManager *editorManager = Core::EditorManager::instance();
if (inNextSplit) {
editorManager->gotoOtherSplit();
} else if (baseTextDocument()->fileName() == link.targetFileName) {
editorManager->addCurrentPositionToNavigationHistory();
gotoLine(link.targetLine, link.targetColumn);
setFocus();
return true;
}
Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::ModeSwitch;
if (inNextSplit)
flags |= Core::EditorManager::OpenInOtherSplit;
return Core::EditorManager::openEditorAt(link.targetFileName,
link.targetLine,
link.targetColumn,
Constants::CPPEDITOR_ID);
Constants::CPPEDITOR_ID,
flags);
}
void CPPEditorWidget::semanticRehighlight(bool force)
......
......@@ -472,17 +472,8 @@ void QmlInspectorAdapter::jumpToObjectDefinitionInEditor(
{
const QString fileName = m_engine->toFileInProject(objSource.url());
Core::EditorManager *editorManager = Core::EditorManager::instance();
Core::IEditor *editor = editorManager->openEditor(fileName);
TextEditor::ITextEditor *textEditor
= qobject_cast<TextEditor::ITextEditor*>(editor);
if (textEditor) {
editorManager->addCurrentPositionToNavigationHistory();
textEditor->gotoLine(objSource.lineNumber());
textEditor->widget()->setFocus();
}
Core::EditorManager::openEditorAt(fileName, objSource.lineNumber(),
0, Core::Id(), Core::EditorManager::ModeSwitch);
if (debugId != -1 && debugId != m_currentSelectedDebugId) {
m_currentSelectedDebugId = debugId;
m_currentSelectedDebugName = agent()->displayName(debugId);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment