TextEditor: add find usage to context menu

... of the generic text editor if the editor has the FindUsage optional
action mask set. This is mainly used to show this action when a language
server is configured for this editor that supports find usages.

Change-Id: I55c6983cd553c46817332144f78f1207185ac3f6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2022-09-23 12:35:38 +02:00
parent 54feec93e3
commit 45bd886e3e

View File

@@ -7935,10 +7935,13 @@ void TextEditorWidget::setupFallBackEditor(Id id)
void TextEditorWidget::appendStandardContextMenuActions(QMenu *menu) void TextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
{ {
if (optionalActions() & TextEditorActionHandler::FindUsage)
menu->addAction(ActionManager::command(Constants::FIND_USAGES)->action());
menu->addSeparator(); menu->addSeparator();
appendMenuActionsFromContext(menu, Constants::M_STANDARDCONTEXTMENU); appendMenuActionsFromContext(menu, Constants::M_STANDARDCONTEXTMENU);
Command *bomCmd = ActionManager::command(Constants::SWITCH_UTF8BOM);
if (bomCmd) { if (Command *bomCmd = ActionManager::command(Constants::SWITCH_UTF8BOM)) {
QAction *a = bomCmd->action(); QAction *a = bomCmd->action();
TextDocument *doc = textDocument(); TextDocument *doc = textDocument();
if (doc->codec()->name() == QByteArray("UTF-8") && doc->supportsUtf8Bom()) { if (doc->codec()->name() == QByteArray("UTF-8") && doc->supportsUtf8Bom()) {