forked from qt-creator/qt-creator
Editor: centrally emit filesChangedInternally after refactorings
...instead of relying on the surrounding code of the refactoring to emit the signal. This also ensures that the signal is only emitted for files that are not opened inside a TextEditor. Change-Id: I6223362864014c691962d895b864f9f44c36e035 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -691,13 +691,10 @@ void SymbolSupport::handleRenameResponse(Core::SearchResult *search,
|
||||
void SymbolSupport::applyRename(const Utils::SearchResultItems &checkedItems,
|
||||
Core::SearchResult *search)
|
||||
{
|
||||
QSet<Utils::FilePath> affectedNonOpenFilePaths;
|
||||
QMap<Utils::FilePath, QList<TextEdit>> editsForDocuments;
|
||||
QList<DocumentChange> changes;
|
||||
for (const Utils::SearchResultItem &item : checkedItems) {
|
||||
const auto filePath = Utils::FilePath::fromUserInput(item.path().value(0));
|
||||
if (!m_client->documentForFilePath(filePath))
|
||||
affectedNonOpenFilePaths << filePath;
|
||||
const QJsonObject jsonObject = item.userData().toJsonObject();
|
||||
if (const TextEdit edit(jsonObject); edit.isValid())
|
||||
editsForDocuments[filePath] << edit;
|
||||
@@ -715,10 +712,6 @@ void SymbolSupport::applyRename(const Utils::SearchResultItems &checkedItems,
|
||||
for (auto it = editsForDocuments.begin(), end = editsForDocuments.end(); it != end; ++it)
|
||||
applyTextEdits(m_client, it.key(), it.value());
|
||||
|
||||
if (!affectedNonOpenFilePaths.isEmpty()) {
|
||||
Core::DocumentManager::notifyFilesChangedInternally(Utils::toList(affectedNonOpenFilePaths));
|
||||
}
|
||||
|
||||
const auto extraWidget = qobject_cast<ReplaceWidget *>(search->additionalReplaceWidget());
|
||||
QTC_ASSERT(extraWidget, return);
|
||||
if (!extraWidget->shouldRenameFiles())
|
||||
|
||||
Reference in New Issue
Block a user