forked from qt-creator/qt-creator
CppEditor: add startGlobalRenaming
Existing built-in functionality is moved there. Clang part is to be implemented later Change-Id: I7595898495213c087243cd534b4ba1617b4c27e9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -84,6 +84,11 @@ void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data,
|
|||||||
server.requestSourceLocationsForRenamingMessage(std::move(message));
|
server.requestSourceLocationsForRenamingMessage(std::move(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RefactoringEngine::startGlobalRenaming(const CppTools::CursorInEditor &)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
bool RefactoringEngine::isUsable() const
|
bool RefactoringEngine::isUsable() const
|
||||||
{
|
{
|
||||||
return server.isUsable();
|
return server.isUsable();
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public:
|
|||||||
void startLocalRenaming(const CppTools::CursorInEditor &data,
|
void startLocalRenaming(const CppTools::CursorInEditor &data,
|
||||||
CppTools::ProjectPart *projectPart,
|
CppTools::ProjectPart *projectPart,
|
||||||
RenameCallback &&renameSymbolsCallback) override;
|
RenameCallback &&renameSymbolsCallback) override;
|
||||||
|
void startGlobalRenaming(const CppTools::CursorInEditor &data) override;
|
||||||
|
|
||||||
bool isUsable() const override;
|
bool isUsable() const override;
|
||||||
void setUsable(bool isUsable);
|
void setUsable(bool isUsable);
|
||||||
|
|||||||
@@ -546,8 +546,10 @@ void CppEditorWidget::renameSymbolUnderCursor()
|
|||||||
setExtraSelections(TextEditor::TextEditorWidget::CodeSemanticsSelection, selections);
|
setExtraSelections(TextEditor::TextEditorWidget::CodeSemanticsSelection, selections);
|
||||||
d->m_localRenaming.updateSelectionsForVariableUnderCursor(selections);
|
d->m_localRenaming.updateSelectionsForVariableUnderCursor(selections);
|
||||||
}
|
}
|
||||||
if (!d->m_localRenaming.start()) // Rename local symbol
|
if (!d->m_localRenaming.start()) {
|
||||||
renameUsages(); // Rename non-local symbol or macro
|
refactoringEngine()->startGlobalRenaming(
|
||||||
|
CppTools::CursorInEditor{textCursor(), textDocument()->filePath(), this});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -46,5 +46,13 @@ void CppRefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &da
|
|||||||
editorWidget->document()->revision());
|
editorWidget->document()->revision());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppRefactoringEngine::startGlobalRenaming(const CppTools::CursorInEditor &data)
|
||||||
|
{
|
||||||
|
CppEditorWidget *editorWidget = static_cast<CppEditorWidget *>(data.editorWidget());
|
||||||
|
if (!editorWidget)
|
||||||
|
return;
|
||||||
|
editorWidget->renameUsages();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
void startLocalRenaming(const CppTools::CursorInEditor &data,
|
void startLocalRenaming(const CppTools::CursorInEditor &data,
|
||||||
CppTools::ProjectPart *projectPart,
|
CppTools::ProjectPart *projectPart,
|
||||||
RenameCallback &&renameSymbolsCallback) override;
|
RenameCallback &&renameSymbolsCallback) override;
|
||||||
|
void startGlobalRenaming(const CppTools::CursorInEditor &data) override;
|
||||||
|
|
||||||
bool isUsable() const override { return true; }
|
bool isUsable() const override { return true; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public:
|
|||||||
virtual void startLocalRenaming(const CursorInEditor &data,
|
virtual void startLocalRenaming(const CursorInEditor &data,
|
||||||
CppTools::ProjectPart *projectPart,
|
CppTools::ProjectPart *projectPart,
|
||||||
RenameCallback &&renameSymbolsCallback) = 0;
|
RenameCallback &&renameSymbolsCallback) = 0;
|
||||||
|
virtual void startGlobalRenaming(const CursorInEditor &data) = 0;
|
||||||
|
|
||||||
virtual bool isUsable() const = 0;
|
virtual bool isUsable() const = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user