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())
|
if (!link.hasValidTarget())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::ModeSwitch;
|
||||||
if (inNextSplit) {
|
if (inNextSplit)
|
||||||
editorManager->gotoOtherSplit();
|
flags |= Core::EditorManager::OpenInOtherSplit;
|
||||||
} else if (baseTextDocument()->fileName() == link.targetFileName) {
|
|
||||||
editorManager->addCurrentPositionToNavigationHistory();
|
|
||||||
gotoLine(link.targetLine, link.targetColumn);
|
|
||||||
setFocus();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Core::EditorManager::openEditorAt(link.targetFileName,
|
return Core::EditorManager::openEditorAt(link.targetFileName,
|
||||||
link.targetLine,
|
link.targetLine,
|
||||||
link.targetColumn,
|
link.targetColumn,
|
||||||
Constants::CPPEDITOR_ID);
|
Constants::CPPEDITOR_ID,
|
||||||
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditorWidget::semanticRehighlight(bool force)
|
void CPPEditorWidget::semanticRehighlight(bool force)
|
||||||
|
|||||||
@@ -472,17 +472,8 @@ void QmlInspectorAdapter::jumpToObjectDefinitionInEditor(
|
|||||||
{
|
{
|
||||||
const QString fileName = m_engine->toFileInProject(objSource.url());
|
const QString fileName = m_engine->toFileInProject(objSource.url());
|
||||||
|
|
||||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
Core::EditorManager::openEditorAt(fileName, objSource.lineNumber(),
|
||||||
Core::IEditor *editor = editorManager->openEditor(fileName);
|
0, Core::Id(), Core::EditorManager::ModeSwitch);
|
||||||
TextEditor::ITextEditor *textEditor
|
|
||||||
= qobject_cast<TextEditor::ITextEditor*>(editor);
|
|
||||||
|
|
||||||
if (textEditor) {
|
|
||||||
editorManager->addCurrentPositionToNavigationHistory();
|
|
||||||
textEditor->gotoLine(objSource.lineNumber());
|
|
||||||
textEditor->widget()->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debugId != -1 && debugId != m_currentSelectedDebugId) {
|
if (debugId != -1 && debugId != m_currentSelectedDebugId) {
|
||||||
m_currentSelectedDebugId = debugId;
|
m_currentSelectedDebugId = debugId;
|
||||||
m_currentSelectedDebugName = agent()->displayName(debugId);
|
m_currentSelectedDebugName = agent()->displayName(debugId);
|
||||||
|
|||||||
Reference in New Issue
Block a user