diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-06-07 13:06:21 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-06-14 10:10:05 +0200 |
commit | e42ca194c53b8286447c7750feb8c7497c88e698 (patch) | |
tree | ab99d8feb411815c51f9d9a2b119aedd1a41244f /src/plugins/cpptools/cpptoolseditorsupport.cpp | |
parent | 2e1001621042a5704e504821fd5677733ffd9167 (diff) | |
download | qt-creator-e42ca194c53b8286447c7750feb8c7497c88e698.tar.gz |
Introduced token caching to prevent repetetive tokenizing.
Also removed TokenUnderCursor as it's functionality is in the token cache.
Reviewed-by: ckamm
Diffstat (limited to 'src/plugins/cpptools/cpptoolseditorsupport.cpp')
-rw-r--r-- | src/plugins/cpptools/cpptoolseditorsupport.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index 77cccf1018..33eed4e020 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.cpp +++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp @@ -67,8 +67,12 @@ void CppEditorSupport::setTextEditor(TextEditor::ITextEditor *textEditor) { _textEditor = textEditor; - if (! _textEditor) + if (_textEditor) { + if (TextEditor::BaseTextEditor *ed = qobject_cast<TextEditor::BaseTextEditor *>(_textEditor->widget())) + _tokenCache.setDocument(ed->document()); + } else { return; + } connect(_textEditor, SIGNAL(contentsChanged()), this, SIGNAL(contentsChanged())); connect(this, SIGNAL(contentsChanged()), this, SLOT(updateDocument())); @@ -96,6 +100,11 @@ unsigned CppEditorSupport::editorRevision() const return 0; } +TokenCache *CppEditorSupport::tokenCache() +{ + return &_tokenCache; +} + int CppEditorSupport::updateDocumentInterval() const { return _updateDocumentInterval; } |