TextEditor: move rename symbol action to text editor

Task-number: QTCREATORBUG-21578
Change-Id: I9a873dcd38bacb2287c45973b6be0091c3eb9480
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-05-06 07:30:33 +02:00
parent a9aa561234
commit 3559af69db
12 changed files with 33 additions and 30 deletions

View File

@@ -844,7 +844,7 @@ void QmlJSEditorWidget::findUsages()
m_findReferences->findUsages(textDocument()->filePath().toString(), textCursor().position());
}
void QmlJSEditorWidget::renameUsages()
void QmlJSEditorWidget::renameSymbolUnderCursor()
{
m_findReferences->renameUsages(textDocument()->filePath().toString(), textCursor().position());
}
@@ -1098,9 +1098,10 @@ QmlJSEditorFactory::QmlJSEditorFactory(Core::Id _id)
setCompletionAssistProvider(new QmlJSCompletionAssistProvider);
setEditorActionHandlers(TextEditorActionHandler::Format
| TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::UnCollapseAll
| TextEditorActionHandler::FollowSymbolUnderCursor);
| TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::UnCollapseAll
| TextEditorActionHandler::FollowSymbolUnderCursor
| TextEditorActionHandler::RenameSymbol);
}
void QmlJSEditorFactory::decorateEditor(TextEditorWidget *editor)

View File

@@ -74,7 +74,7 @@ public:
void inspectElementUnderCursor() const;
void findUsages() override;
void renameUsages();
void renameSymbolUnderCursor() override;
void showContextPane();
signals:

View File

@@ -162,10 +162,7 @@ QmlJSEditorPluginPrivate::QmlJSEditorPluginPrivate()
contextMenu->addAction(cmd);
qmlToolsMenu->addAction(cmd);
QAction *renameUsagesAction = new QAction(QmlJSEditorPlugin::tr("Rename Symbol Under Cursor"), this);
cmd = ActionManager::registerAction(renameUsagesAction, "QmlJSEditor.RenameUsages", context);
cmd->setDefaultKeySequence(QKeySequence(QmlJSEditorPlugin::tr("Ctrl+Shift+R")));
connect(renameUsagesAction, &QAction::triggered, this, &QmlJSEditorPluginPrivate::renameUsages);
cmd = ActionManager::command(TextEditor::Constants::RENAME_SYMBOL);
contextMenu->addAction(cmd);
qmlToolsMenu->addAction(cmd);
@@ -247,7 +244,7 @@ QuickToolBar *QmlJSEditorPlugin::quickToolBar()
void QmlJSEditorPluginPrivate::renameUsages()
{
if (auto editor = qobject_cast<QmlJSEditorWidget*>(EditorManager::currentEditor()->widget()))
editor->renameUsages();
editor->renameSymbolUnderCursor();
}
void QmlJSEditorPluginPrivate::reformatFile()