summaryrefslogtreecommitdiff
path: root/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2012-01-12 13:23:48 +0100
committerLeandro Melo <leandro.melo@nokia.com>2012-01-12 15:32:02 +0100
commitf04be782ab6350563ac3ed87e8ef6028a0140042 (patch)
tree8dfa2b4036f446f8d341e9744ae00758d2611361 /src/plugins/qmljstools/qmljsrefactoringchanges.cpp
parent80a62301449b12dd8e541208c8b1a8e7bb1c6d14 (diff)
downloadqt-creator-f04be782ab6350563ac3ed87e8ef6028a0140042.tar.gz
C++: Preserve original indentation in extract function
Also extend the refactoring changes to allow for reindenting. Task-number: QTCREATORBUG-6797 Change-Id: I515c9a37d9e62e1d5de52ff99bd492e739a81885 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/plugins/qmljstools/qmljsrefactoringchanges.cpp')
-rw-r--r--src/plugins/qmljstools/qmljsrefactoringchanges.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
index 54108940c9..f741e5b2c5 100644
--- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
+++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
@@ -34,6 +34,7 @@
#include "qmljsqtstylecodeformatter.h"
#include "qmljstoolsconstants.h"
#include "qmljsmodelmanager.h"
+#include "qmljsindenter.h"
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
@@ -77,6 +78,17 @@ public:
} while (block.isValid() && block != end);
}
+ virtual void reindentSelection(const QTextCursor &selection,
+ const QString &fileName,
+ const TextEditor::BaseTextEditorWidget *textEditor) const
+ {
+ const TextEditor::TabSettings &tabSettings =
+ ProjectExplorer::actualTabSettings(fileName, textEditor);
+
+ QmlJSEditor::Internal::Indenter indenter;
+ indenter.reindent(selection.document(), selection, tabSettings);
+ }
+
virtual void fileChanged(const QString &fileName)
{
m_modelManager->updateSourceFiles(QStringList(fileName), true);