forked from qt-creator/qt-creator
QmlJS: Remove old 'Rename id' action.
Replaced by superior 'Rename Symbol Under Cursor'. Change-Id: I0d0367d1297fde37d501266ef7df515256c6abd7 Reviewed-on: http://codereview.qt.nokia.com/1428 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@nokia.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
35cb3793a1
commit
51d8f468e4
@@ -979,18 +979,6 @@ void QmlJSTextEditorWidget::setUpdateSelectedElements(bool value)
|
||||
m_updateSelectedElements = value;
|
||||
}
|
||||
|
||||
void QmlJSTextEditorWidget::renameId(const QString &oldId, const QString &newId)
|
||||
{
|
||||
Utils::ChangeSet changeSet;
|
||||
|
||||
foreach (const AST::SourceLocation &loc, m_semanticInfo.idLocations.value(oldId)) {
|
||||
changeSet.replace(loc.begin(), loc.end(), newId);
|
||||
}
|
||||
|
||||
QTextCursor tc = textCursor();
|
||||
changeSet.apply(&tc);
|
||||
}
|
||||
|
||||
void QmlJSTextEditorWidget::updateUsesNow()
|
||||
{
|
||||
if (document()->revision() != m_semanticInfo.revision()) {
|
||||
@@ -1164,20 +1152,6 @@ void QmlJSTextEditorWidget::updateFileName()
|
||||
{
|
||||
}
|
||||
|
||||
void QmlJSTextEditorWidget::renameIdUnderCursor()
|
||||
{
|
||||
const QString id = wordUnderCursor();
|
||||
bool ok = false;
|
||||
const QString newId = QInputDialog::getText(Core::ICore::instance()->mainWindow(),
|
||||
tr("Rename..."),
|
||||
tr("New id:"),
|
||||
QLineEdit::Normal,
|
||||
id, &ok);
|
||||
if (ok) {
|
||||
renameId(id, newId);
|
||||
}
|
||||
}
|
||||
|
||||
void QmlJSTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
|
||||
{
|
||||
TextEditor::BaseTextEditorWidget::setFontSettings(fs);
|
||||
@@ -1361,14 +1335,6 @@ void QmlJSTextEditorWidget::contextMenuEvent(QContextMenuEvent *e)
|
||||
|
||||
QMenu *refactoringMenu = new QMenu(tr("Refactoring"), menu);
|
||||
|
||||
// Conditionally add the rename-id action:
|
||||
const QString id = wordUnderCursor();
|
||||
const QList<AST::SourceLocation> &locations = m_semanticInfo.idLocations.value(id);
|
||||
if (! locations.isEmpty()) {
|
||||
QAction *a = refactoringMenu->addAction(tr("Rename id '%1'...").arg(id));
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(renameIdUnderCursor()));
|
||||
}
|
||||
|
||||
QSignalMapper mapper;
|
||||
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
|
||||
if (! isOutdated()) {
|
||||
|
||||
@@ -156,8 +156,6 @@ public:
|
||||
bool updateSelectedElements() const;
|
||||
void setUpdateSelectedElements(bool value);
|
||||
|
||||
void renameId(const QString &oldId, const QString &newId);
|
||||
|
||||
static QVector<QString> highlighterFormatCategories();
|
||||
|
||||
TextEditor::IAssistInterface *createAssistInterface(TextEditor::AssistKind assistKind,
|
||||
@@ -192,9 +190,6 @@ private slots:
|
||||
void updateUses();
|
||||
void updateUsesNow();
|
||||
|
||||
// refactoring ops
|
||||
void renameIdUnderCursor();
|
||||
|
||||
void semanticRehighlight();
|
||||
void forceSemanticRehighlightIfCurrentEditor();
|
||||
void updateSemanticInfo(const QmlJSEditor::SemanticInfo &semanticInfo);
|
||||
|
||||
@@ -180,7 +180,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
|
||||
contextMenu->addAction(cmd);
|
||||
qmlToolsMenu->addAction(cmd);
|
||||
|
||||
QAction *renameUsagesAction = new QAction(tr("Rename Usages"), this);
|
||||
QAction *renameUsagesAction = new QAction(tr("Rename Symbol Under Cursor"), this);
|
||||
cmd = am->registerAction(renameUsagesAction, Constants::RENAME_USAGES, context);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+R")));
|
||||
connect(renameUsagesAction, SIGNAL(triggered()), this, SLOT(renameUsages()));
|
||||
|
||||
Reference in New Issue
Block a user