C++ editor: Unify rehighlight() and semanticRehighlight().

They did the same thing.

Change-Id: Ic4d1a269417575110ea32ba5d583a01397c9d806
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-11-14 13:34:41 +01:00
parent 232724cc11
commit af8b381f98
3 changed files with 5 additions and 12 deletions

View File

@@ -635,12 +635,6 @@ void CPPEditorWidget::abortRename()
setExtraSelections(CodeSemanticsSelection, m_renameSelections); setExtraSelections(CodeSemanticsSelection, m_renameSelections);
} }
void CPPEditorWidget::rehighlight(bool force)
{
const SemanticHighlighter::Source source = currentSource(force);
m_semanticHighlighter->rehighlight(source);
}
void CPPEditorWidget::onDocumentUpdated(Document::Ptr doc) void CPPEditorWidget::onDocumentUpdated(Document::Ptr doc)
{ {
if (doc->fileName() != file()->fileName()) if (doc->fileName() != file()->fileName())
@@ -655,7 +649,7 @@ void CPPEditorWidget::onDocumentUpdated(Document::Ptr doc)
|| !m_lastSemanticInfo.doc->translationUnit()->ast() || !m_lastSemanticInfo.doc->translationUnit()->ast()
|| m_lastSemanticInfo.doc->fileName() != file()->fileName()))) { || m_lastSemanticInfo.doc->fileName() != file()->fileName()))) {
m_initialized = true; m_initialized = true;
rehighlight(/* force = */ true); semanticRehighlight(/* force = */ true);
} }
m_updateOutlineTimer->start(); m_updateOutlineTimer->start();
@@ -1758,9 +1752,9 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link)
Constants::CPPEDITOR_ID); Constants::CPPEDITOR_ID);
} }
void CPPEditorWidget::semanticRehighlight() void CPPEditorWidget::semanticRehighlight(bool force)
{ {
m_semanticHighlighter->rehighlight(currentSource()); m_semanticHighlighter->rehighlight(currentSource(force));
} }
void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo) void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)

View File

@@ -211,7 +211,7 @@ public Q_SLOTS:
void renameUsages(); void renameUsages();
void findUsages(); void findUsages();
void renameUsagesNow(const QString &replacement = QString()); void renameUsagesNow(const QString &replacement = QString());
void rehighlight(bool force = false); void semanticRehighlight(bool force = false);
protected: protected:
bool event(QEvent *e); bool event(QEvent *e);
@@ -240,7 +240,6 @@ private Q_SLOTS:
void onDocumentUpdated(CPlusPlus::Document::Ptr doc); void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
void onContentsChanged(int position, int charsRemoved, int charsAdded); void onContentsChanged(int position, int charsRemoved, int charsAdded);
void semanticRehighlight();
void updateSemanticInfo(const CppEditor::Internal::SemanticInfo &semanticInfo); void updateSemanticInfo(const CppEditor::Internal::SemanticInfo &semanticInfo);
void highlightSymbolUsages(int from, int to); void highlightSymbolUsages(int from, int to);
void finishHighlightSymbolUsages(); void finishHighlightSymbolUsages();

View File

@@ -406,7 +406,7 @@ void CppPlugin::currentEditorChanged(Core::IEditor *editor)
return; return;
else if (CPPEditorWidget *textEditor = qobject_cast<CPPEditorWidget *>(editor->widget())) { else if (CPPEditorWidget *textEditor = qobject_cast<CPPEditorWidget *>(editor->widget())) {
textEditor->rehighlight(/*force = */ true); textEditor->semanticRehighlight(/*force = */ true);
} }
} }