mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix indexer progress message, follow up for bug 232155.
This commit is contained in:
parent
0502665ec0
commit
54ab181228
2 changed files with 16 additions and 27 deletions
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.internal.core.pdom.IndexerProgress;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
/**
|
||||
* A task for index updates.
|
||||
|
@ -59,13 +60,13 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
|||
}
|
||||
}
|
||||
|
||||
private static Object[] concat(Collection added, Collection changed) {
|
||||
private static Object[] concat(Collection<?> added, Collection<?> changed) {
|
||||
Object[] result= new Object[added.size() + changed.size()];
|
||||
int i=0;
|
||||
for (Iterator iterator = added.iterator(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = added.iterator(); iterator.hasNext();) {
|
||||
result[i++]= iterator.next();
|
||||
}
|
||||
for (Iterator iterator = changed.iterator(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = changed.iterator(); iterator.hasNext();) {
|
||||
result[i++]= iterator.next();
|
||||
}
|
||||
return result;
|
||||
|
@ -190,14 +191,13 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
|||
// TODO: find a way to do non-OSGi NLS
|
||||
switch(kind) {
|
||||
case parsingFileTask:
|
||||
return new String("parsing {0} ({1})"); //$NON-NLS-1$
|
||||
return NLS.bind("parsing {0} ({1})", arguments); //$NON-NLS-1$
|
||||
|
||||
case errorWhileParsing:
|
||||
return new String("Error while parsing {0}."); //$NON-NLS-1$
|
||||
return NLS.bind("Error while parsing {0}.", arguments); //$NON-NLS-1$
|
||||
|
||||
|
||||
case tooManyIndexProblems:
|
||||
return new String("Too many errors while indexing, stopping indexer."); //$NON-NLS-1$
|
||||
return "Too many errors while indexing, stopping indexer."; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package org.eclipse.cdt.internal.core.pdom;
|
||||
|
||||
import java.net.URI;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -92,7 +91,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
public ICPPUsingDirective[] fDirectives;
|
||||
}
|
||||
|
||||
protected enum MessageKind {parsingFileTask, errorWhileParsing, tooManyIndexProblems};
|
||||
protected enum MessageKind {parsingFileTask, errorWhileParsing, tooManyIndexProblems}
|
||||
|
||||
private int fUpdateFlags= IIndexManager.UPDATE_ALL;
|
||||
private boolean fIndexHeadersWithoutContext= true;
|
||||
|
@ -199,9 +198,6 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected IParserLogService getLogService() {
|
||||
return ParserUtil.getParserLogService();
|
||||
}
|
||||
|
@ -444,8 +440,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
if (fShowActivity) {
|
||||
System.out.println("Indexer: parsing " + filePath + " up front"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
monitor.subTask(MessageFormat.format(getMessage(MessageKind.parsingFileTask),
|
||||
new Object[]{fileName, path.removeLastSegments(1).toString()}));
|
||||
monitor.subTask(getMessage(MessageKind.parsingFileTask,
|
||||
fileName, path.removeLastSegments(1).toString()));
|
||||
|
||||
AbstractLanguage[] langs= getLanguages(fileName);
|
||||
for (AbstractLanguage lang : langs) {
|
||||
|
@ -593,8 +589,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
if (fShowActivity) {
|
||||
System.out.println("Indexer: parsing " + path.toOSString()); //$NON-NLS-1$
|
||||
}
|
||||
pm.subTask(MessageFormat.format(getMessage(MessageKind.parsingFileTask),
|
||||
new Object[]{path.lastSegment(), path.removeLastSegments(1).toString()}));
|
||||
pm.subTask(getMessage(MessageKind.parsingFileTask,
|
||||
path.lastSegment(), path.removeLastSegments(1).toString()));
|
||||
long start= System.currentTimeMillis();
|
||||
IASTTranslationUnit ast= createAST(tu, lang, scanInfo, fASTOptions, pm);
|
||||
fStatistics.fParsingTime += System.currentTimeMillis()-start;
|
||||
|
@ -708,8 +704,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
}
|
||||
}
|
||||
else {
|
||||
s= CCorePlugin.createStatus(
|
||||
MessageFormat.format(getMessage(MessageKind.errorWhileParsing), new Object[]{file}), e);
|
||||
s= CCorePlugin.createStatus(getMessage(MessageKind.errorWhileParsing, file), e);
|
||||
}
|
||||
logError(s);
|
||||
if (++fStatistics.fErrorCount > MAX_ERRORS) {
|
||||
|
@ -799,18 +794,12 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
|||
protected String getMessage(MessageKind kind, Object... arguments) {
|
||||
switch (kind) {
|
||||
case parsingFileTask:
|
||||
return NLS.bind(Messages.AbstractIndexerTask_parsingFileTask,
|
||||
arguments);
|
||||
return NLS.bind(Messages.AbstractIndexerTask_parsingFileTask, arguments);
|
||||
case errorWhileParsing:
|
||||
return NLS.bind(Messages.AbstractIndexerTask_errorWhileParsing,
|
||||
arguments);
|
||||
|
||||
return NLS.bind(Messages.AbstractIndexerTask_errorWhileParsing, arguments);
|
||||
case tooManyIndexProblems:
|
||||
return NLS.bind(Messages.AbstractIndexerTask_tooManyIndexProblems,
|
||||
arguments);
|
||||
|
||||
return Messages.AbstractIndexerTask_tooManyIndexProblems;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue