Refactoring changes: Cleanup and improvements.

Previously RefactoringFiles were usually passed around by value.
However, since a RefactoringFile may sometimes own a QTextDocument
(when it was read from a file), that's not great and caused the
file to be reread after every copy.

With this change RefactoringFile becomes noncopyable and is always
owned by a shared pointer.

This change also allowed having const RefactoringFiles which is
useful because they can be safely used from other threads. See
CppRefactoringChanges::fileNoEditor.

Change-Id: I9045921d6d0f6349f9558ff2a3d8317ea172193b
Reviewed-on: http://codereview.qt.nokia.com/3084
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-08-17 11:35:57 +02:00
parent a07acad516
commit 8a6d767a8f
30 changed files with 609 additions and 500 deletions

View File

@@ -51,6 +51,7 @@ QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSTextEditorWidget
: DefaultAssistInterface(editor->document(), editor->position(), editor->file(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(m_editor, m_semanticInfo.document))
{}
QmlJSQuickFixAssistInterface::~QmlJSQuickFixAssistInterface()
@@ -61,9 +62,9 @@ const SemanticInfo &QmlJSQuickFixAssistInterface::semanticInfo() const
return m_semanticInfo;
}
const QmlJSTools::QmlJSRefactoringFile QmlJSQuickFixAssistInterface::currentFile() const
QmlJSRefactoringFilePtr QmlJSQuickFixAssistInterface::currentFile() const
{
return QmlJSRefactoringFile(m_editor, m_semanticInfo.document);
return m_currentFile;
}
QWidget *QmlJSQuickFixAssistInterface::widget() const