forked from qt-creator/qt-creator
Use EditorManager::openEditorAt instead of duplicating code
Change-Id: I231e89849e2f06958d05a511320ec236b5702a1c Reviewed-by: Aurindam Jana <aurindam.jana@digia.com> Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user