From 8d6553b223b7595341a30b1ff99f0c9fd83c6997 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Fri, 7 Dec 2007 16:44:20 +0000 Subject: [PATCH] Improved progress reporting when refreshing the content of the index. --- .../internal/core/pdom/AbstractIndexerTask.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java index cca21f57972..ad18cfbea11 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java @@ -80,6 +80,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { private static class FileInfo { IIndexFile fIndexFile= null; boolean fRequestUpdate= false; + boolean fRequestIsCounted= true; boolean fIsUpdated= false; public IMacro[] fMacros; } @@ -476,6 +477,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { final IIndexFileLocation ifl = fResolver.resolveFile(tu); final FileInfo info= getFileInfo(linkageID, ifl); if (info != null && info.fRequestUpdate && !info.fIsUpdated) { + info.fRequestIsCounted= false; final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, tu); parseFile(tu, linkageID, ifl, scannerInfo, monitor); if (info.fIsUpdated) { @@ -501,6 +503,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { Object tu= findContext((IIndexFragmentFile) info.fIndexFile, contextMap); if (tu != null) { final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, tu); + info.fRequestIsCounted= false; parseFile(tu, linkageID, fResolver.resolveFile(tu), scannerInfo, monitor); if (info.fIsUpdated) { updateInfo(0, 1, 0); // a header was parsed in context @@ -524,6 +527,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { final IIndexFileLocation ifl = fResolver.resolveFile(header); final FileInfo info= getFileInfo(linkageID, ifl); if (info != null && info.fRequestUpdate && !info.fIsUpdated) { + info.fRequestIsCounted= false; final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, header); parseFile(header, linkageID, ifl, scannerInfo, monitor); if (info.fIsUpdated) { @@ -665,13 +669,16 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } info= createFileInfo(new FileKey(linkageID, ifl.getURI()), ifile); if (ifile == null) { - if (info.fRequestUpdate && !info.fIsUpdated) { - updateInfo(0,0,-1); // header found implicitly - } + info.fRequestIsCounted= false; info.fRequestUpdate= true; } } - return !info.fIsUpdated && info.fRequestUpdate; + final boolean needUpdate= !info.fIsUpdated && info.fRequestUpdate; + if (needUpdate && info.fRequestIsCounted) { + updateInfo(0, 0, -1); + info.fRequestIsCounted= false; + } + return needUpdate; } private IPath getPathForLabel(IIndexFileLocation ifl) {