forked from qt-creator/qt-creator
SearchEngine: Replace openEditor() with editorOpener()
Change-Id: I45da343f4df3cf634c24bbb518703c856fbb4d90 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -269,20 +269,22 @@ QFuture<SearchResultItems> GitGrep::executeSearch(const FileFindParameters ¶
|
||||
return Utils::asyncRun(runGitGrep, parameters);
|
||||
}
|
||||
|
||||
IEditor *GitGrep::openEditor(const SearchResultItem &item,
|
||||
const FileFindParameters ¶meters)
|
||||
EditorOpener GitGrep::editorOpener() const
|
||||
{
|
||||
const GitGrepParameters params = parameters.searchEngineParameters.value<GitGrepParameters>();
|
||||
const QStringList &itemPath = item.path();
|
||||
if (params.ref.isEmpty() || itemPath.isEmpty())
|
||||
return nullptr;
|
||||
const FilePath path = FilePath::fromUserInput(itemPath.first());
|
||||
const FilePath topLevel = FilePath::fromString(parameters.additionalParameters.toString());
|
||||
IEditor *editor = m_client->openShowEditor(topLevel, params.ref, path,
|
||||
GitClient::ShowEditor::OnlyIfDifferent);
|
||||
if (editor)
|
||||
editor->gotoLine(item.mainRange().begin.line, item.mainRange().begin.column);
|
||||
return editor;
|
||||
return [](const Utils::SearchResultItem &item,
|
||||
const FileFindParameters ¶meters) -> IEditor * {
|
||||
const GitGrepParameters params = parameters.searchEngineParameters.value<GitGrepParameters>();
|
||||
const QStringList &itemPath = item.path();
|
||||
if (params.ref.isEmpty() || itemPath.isEmpty())
|
||||
return nullptr;
|
||||
const FilePath path = FilePath::fromUserInput(itemPath.first());
|
||||
const FilePath topLevel = FilePath::fromString(parameters.additionalParameters.toString());
|
||||
IEditor *editor = GitClient::instance()->openShowEditor(
|
||||
topLevel, params.ref, path, GitClient::ShowEditor::OnlyIfDifferent);
|
||||
if (editor)
|
||||
editor->gotoLine(item.mainRange().begin.line, item.mainRange().begin.column);
|
||||
return editor;
|
||||
};
|
||||
}
|
||||
|
||||
} // Git::Internal
|
||||
|
||||
Reference in New Issue
Block a user