1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Logs the name of the file currently parsed, together with exceptions caught by the indexer.

This commit is contained in:
Markus Schorn 2006-11-13 14:57:14 +00:00
parent 94f1a13a14
commit 52bbe25b47

View file

@ -36,6 +36,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
@ -128,20 +129,37 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
} }
protected void parseTU(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, InterruptedException { protected void parseTU(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, InterruptedException {
try {
IPath path= tu.getPath(); IPath path= tu.getPath();
try {
if (fTrace) {
System.out.println("Indexer: parsing " + path.toOSString()); //$NON-NLS-1$
}
fMessage= MessageFormat.format(Messages.PDOMIndexerTask_parsingFileTask, fMessage= MessageFormat.format(Messages.PDOMIndexerTask_parsingFileTask,
new Object[]{path.lastSegment(), path.removeLastSegments(1).toString()}); new Object[]{path.lastSegment(), path.removeLastSegments(1).toString()});
doParseTU(tu, pm); doParseTU(tu, pm);
} }
catch (CoreException e) { catch (CoreException e) {
if (++fErrorCount <= MAX_ERRORS) { if (!swallowError(path, e))
CCorePlugin.log(e); throw e;
} }
else { catch (RuntimeException e) {
if (!swallowError(path, e))
throw e;
}
catch (Error e) {
if (!swallowError(path, e))
throw e; throw e;
} }
} }
private boolean swallowError(IPath file, Throwable e) {
if (++fErrorCount <= MAX_ERRORS) {
IStatus status= CCorePlugin.createStatus(
MessageFormat.format(Messages.PDOMIndexerTask_errorWhileParsing, new Object[]{file}), e);
CCorePlugin.log(status);
return true;
}
return false;
} }
abstract protected void doParseTU(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, InterruptedException; abstract protected void doParseTU(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, InterruptedException;