1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 432547 - Introduce separate size limits for indexing of source and

header files
This commit is contained in:
Sergey Prigogin 2014-04-11 18:53:34 -07:00
parent 5c7a64d0fb
commit 88d0024075
8 changed files with 78 additions and 40 deletions

View file

@ -93,7 +93,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
LinkageTask(int linkageID) { LinkageTask(int linkageID) {
fLinkageID= linkageID; fLinkageID= linkageID;
fLocationTasks= new HashMap<IIndexFileLocation, LocationTask>(); fLocationTasks= new HashMap<>();
} }
boolean requestUpdate(IIndexFileLocation ifl, IIndexFragmentFile ifile, Object tu, boolean requestUpdate(IIndexFileLocation ifl, IIndexFragmentFile ifile, Object tu,
@ -164,7 +164,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
fVersionTasks= Collections.singletonList(fc); fVersionTasks= Collections.singletonList(fc);
break; break;
case 1: case 1:
List<FileVersionTask> newList= new ArrayList<FileVersionTask>(2); List<FileVersionTask> newList= new ArrayList<>(2);
newList.add(fVersionTasks.get(0)); newList.add(fVersionTasks.get(0));
newList.add(fc); newList.add(fc);
fVersionTasks= newList; fVersionTasks= newList;
@ -298,20 +298,21 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private boolean fIndexFilesWithoutConfiguration= true; private boolean fIndexFilesWithoutConfiguration= true;
private boolean fIndexAllHeaderVersions = false; private boolean fIndexAllHeaderVersions = false;
private Set<String> fHeadersToIndexAllVersions = Collections.emptySet(); private Set<String> fHeadersToIndexAllVersions = Collections.emptySet();
private List<LinkageTask> fRequestsPerLinkage= new ArrayList<LinkageTask>(); private List<LinkageTask> fRequestsPerLinkage= new ArrayList<>();
private Map<IIndexFile, IndexFileContent> fIndexContentCache= new LRUCache<IIndexFile, IndexFileContent>(500); private Map<IIndexFile, IndexFileContent> fIndexContentCache= new LRUCache<>(500);
private Map<IIndexFileLocation, IIndexFragmentFile[]> fIndexFilesCache= new LRUCache<IIndexFileLocation, IIndexFragmentFile[]>(5000); private Map<IIndexFileLocation, IIndexFragmentFile[]> fIndexFilesCache= new LRUCache<>(5000);
private Map<IIndexFileLocation, LocationTask> fOneLinkageTasks= new HashMap<IIndexFileLocation, AbstractIndexerTask.LocationTask>(); private Map<IIndexFileLocation, LocationTask> fOneLinkageTasks= new HashMap<>();
private Object[] fFilesToUpdate; private Object[] fFilesToUpdate;
private List<Object> fFilesToRemove = new ArrayList<Object>(); private List<Object> fFilesToRemove = new ArrayList<>();
private int fASTOptions; private int fASTOptions;
private int fForceNumberFiles= 0; private int fForceNumberFiles;
protected IWritableIndex fIndex; protected IWritableIndex fIndex;
private ITodoTaskUpdater fTodoTaskUpdater; private ITodoTaskUpdater fTodoTaskUpdater;
private final boolean fIsFastIndexer; private final boolean fIsFastIndexer;
private long fFileSizeLimit= 0; private long fTranslationUnitSizeLimit;
private long fIncludedFileSizeLimit;
private InternalFileContentProvider fCodeReaderFactory; private InternalFileContentProvider fCodeReaderFactory;
private int fSwallowOutOfMemoryError= 5; private int fSwallowOutOfMemoryError= 5;
/** /**
@ -329,7 +330,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
fFilesToUpdate= filesToUpdate; fFilesToUpdate= filesToUpdate;
Collections.addAll(fFilesToRemove, filesToRemove); Collections.addAll(fFilesToRemove, filesToRemove);
incrementRequestedFilesCount(fFilesToUpdate.length + fFilesToRemove.size()); incrementRequestedFilesCount(fFilesToUpdate.length + fFilesToRemove.size());
fUrgentTasks = new LinkedList<AbstractIndexerTask>(); fUrgentTasks = new LinkedList<>();
} }
public final void setIndexHeadersWithoutContext(UnusedHeaderStrategy mode) { public final void setIndexHeadersWithoutContext(UnusedHeaderStrategy mode) {
@ -356,8 +357,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
fForceNumberFiles= number; fForceNumberFiles= number;
} }
public final void setFileSizeLimit(long limit) { public final void setFileSizeLimits(long translationUnitSizeLimit, long includedFileSizeLimit) {
fFileSizeLimit= limit; fTranslationUnitSizeLimit= translationUnitSizeLimit;
fIncludedFileSizeLimit= includedFileSizeLimit;
} }
public void setIndexAllHeaderVersions(boolean indexAllHeaderVersions) { public void setIndexAllHeaderVersions(boolean indexAllHeaderVersions) {
@ -520,8 +522,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
try { try {
try { try {
// Split into sources and headers, remove excluded sources. // Split into sources and headers, remove excluded sources.
HashMap<Integer, List<IIndexFileLocation>> files= new HashMap<Integer, List<IIndexFileLocation>>(); HashMap<Integer, List<IIndexFileLocation>> files= new HashMap<>();
final ArrayList<IIndexFragmentFile> indexFilesToRemove= new ArrayList<IIndexFragmentFile>(); final ArrayList<IIndexFragmentFile> indexFilesToRemove= new ArrayList<>();
extractFiles(files, indexFilesToRemove, monitor); extractFiles(files, indexFilesToRemove, monitor);
setResume(true); setResume(true);
@ -574,7 +576,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
} }
} }
// Extract files from the urgent task. // Extract files from the urgent task.
files = new HashMap<Integer, List<IIndexFileLocation>>(); files = new HashMap<>();
fFilesToUpdate = urgentTask.fFilesToUpdate; fFilesToUpdate = urgentTask.fFilesToUpdate;
fForceNumberFiles = urgentTask.fForceNumberFiles; fForceNumberFiles = urgentTask.fForceNumberFiles;
fFilesToRemove = urgentTask.fFilesToRemove; fFilesToRemove = urgentTask.fFilesToRemove;
@ -697,7 +699,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private void addPerLinkage(int linkageID, IIndexFileLocation ifl, HashMap<Integer, List<IIndexFileLocation>> files) { private void addPerLinkage(int linkageID, IIndexFileLocation ifl, HashMap<Integer, List<IIndexFileLocation>> files) {
List<IIndexFileLocation> list= files.get(linkageID); List<IIndexFileLocation> list= files.get(linkageID);
if (list == null) { if (list == null) {
list= new LinkedList<IIndexFileLocation>(); list= new LinkedList<>();
files.put(linkageID, list); files.put(linkageID, list);
} }
list.add(ifl); list.add(ifl);
@ -952,7 +954,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
// File was not parsed, because there is a dependency that needs to be // File was not parsed, because there is a dependency that needs to be
// handled before. // handled before.
if (dependencies == null) if (dependencies == null)
dependencies= new HashSet<IIndexFile>(); dependencies= new HashSet<>();
if (dependencies.add(d.fIndexFile)) { if (dependencies.add(d.fIndexFile)) {
if (parseFile(d.fTu, language, d.fIndexFile.getLocation(), scannerInfo, new FileContext(ctxFile, d.fIndexFile), monitor) == null) if (parseFile(d.fTu, language, d.fIndexFile.getLocation(), scannerInfo, new FileContext(ctxFile, d.fIndexFile), monitor) == null)
done= false; done= false;
@ -1161,7 +1163,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
if (isSource) { if (isSource) {
options |= ILanguage.OPTION_IS_SOURCE_UNIT; options |= ILanguage.OPTION_IS_SOURCE_UNIT;
} }
if (fFileSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fFileSizeLimit) { if (fTranslationUnitSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fTranslationUnitSizeLimit) {
if (fShowActivity) { if (fShowActivity) {
trace("Indexer: Skipping large file " + codeReader.getFileLocation()); //$NON-NLS-1$ trace("Indexer: Skipping large file " + codeReader.getFileLocation()); //$NON-NLS-1$
} }
@ -1174,7 +1176,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
IndexBasedFileContentProvider ibfcp = new IndexBasedFileContentProvider(fIndex, fResolver, IndexBasedFileContentProvider ibfcp = new IndexBasedFileContentProvider(fIndex, fResolver,
language.getLinkageID(), fileContentProvider, this); language.getLinkageID(), fileContentProvider, this);
ibfcp.setContextToHeaderGap(ctx2header); ibfcp.setContextToHeaderGap(ctx2header);
ibfcp.setFileSizeLimit(fFileSizeLimit); ibfcp.setFileSizeLimit(fIncludedFileSizeLimit);
ibfcp.setHeadersToIndexAllVersions(fHeadersToIndexAllVersions); ibfcp.setHeadersToIndexAllVersions(fHeadersToIndexAllVersions);
ibfcp.setIndexAllHeaderVersions(fIndexAllHeaderVersions); ibfcp.setIndexAllHeaderVersions(fIndexAllHeaderVersions);
fCodeReaderFactory= ibfcp; fCodeReaderFactory= ibfcp;
@ -1206,8 +1208,8 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private void writeToIndex(final int linkageID, IASTTranslationUnit ast, FileContent codeReader, private void writeToIndex(final int linkageID, IASTTranslationUnit ast, FileContent codeReader,
FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException { FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException {
HashSet<FileContentKey> enteredFiles= new HashSet<FileContentKey>(); HashSet<FileContentKey> enteredFiles= new HashSet<>();
ArrayList<FileInAST> orderedFileKeys= new ArrayList<FileInAST>(); ArrayList<FileInAST> orderedFileKeys= new ArrayList<>();
final IIndexFileLocation topIfl = fResolver.resolveASTPath(ast.getFilePath()); final IIndexFileLocation topIfl = fResolver.resolveASTPath(ast.getFilePath());
FileContentKey topKey = new FileContentKey(linkageID, topIfl, ast.getSignificantMacros()); FileContentKey topKey = new FileContentKey(linkageID, topIfl, ast.getSignificantMacros());

View file

@ -30,7 +30,8 @@ public abstract class AbstractPDOMIndexer implements IPDOMIndexer {
fProperties.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, String.valueOf(false)); fProperties.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, String.valueOf(false));
fProperties.put(IndexerPreferences.KEY_INDEX_ON_OPEN, String.valueOf(false)); fProperties.put(IndexerPreferences.KEY_INDEX_ON_OPEN, String.valueOf(false));
fProperties.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(true)); fProperties.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(true));
fProperties.put(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, String.valueOf(IndexerPreferences.DEFAULT_FILE_SIZE_LIMIT)); fProperties.put(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, String.valueOf(IndexerPreferences.DEFAULT_FILE_SIZE_LIMIT_MB));
fProperties.put(IndexerPreferences.KEY_SKIP_INCLUDED_FILES_LARGER_THAN_MB, String.valueOf(IndexerPreferences.DEFAULT_INCLUDED_FILE_SIZE_LIMIT_MB));
fProperties.put(IndexerPreferences.KEY_SKIP_ALL_REFERENCES, String.valueOf(false)); fProperties.put(IndexerPreferences.KEY_SKIP_ALL_REFERENCES, String.valueOf(false));
fProperties.put(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES, String.valueOf(false)); fProperties.put(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES, String.valueOf(false));
fProperties.put(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES, String.valueOf(false)); fProperties.put(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES, String.valueOf(false));

View file

@ -59,6 +59,7 @@ public class IndexerPreferences {
public static final String KEY_SKIP_MACRO_REFERENCES= "skipMacroReferences"; //$NON-NLS-1$ public static final String KEY_SKIP_MACRO_REFERENCES= "skipMacroReferences"; //$NON-NLS-1$
public static final String KEY_UPDATE_POLICY= "updatePolicy"; //$NON-NLS-1$ public static final String KEY_UPDATE_POLICY= "updatePolicy"; //$NON-NLS-1$
public static final String KEY_SKIP_FILES_LARGER_THAN_MB = "skipFilesLargerThanMB"; //$NON-NLS-1$ public static final String KEY_SKIP_FILES_LARGER_THAN_MB = "skipFilesLargerThanMB"; //$NON-NLS-1$
public static final String KEY_SKIP_INCLUDED_FILES_LARGER_THAN_MB = "skipIncludedFilesLargerThanMB"; //$NON-NLS-1$
private static final String KEY_INDEXER_PREFS_SCOPE = "preferenceScope"; //$NON-NLS-1$ private static final String KEY_INDEXER_PREFS_SCOPE = "preferenceScope"; //$NON-NLS-1$
private static final String KEY_INDEX_IMPORT_LOCATION = "indexImportLocation"; //$NON-NLS-1$ private static final String KEY_INDEX_IMPORT_LOCATION = "indexImportLocation"; //$NON-NLS-1$
@ -70,7 +71,8 @@ public class IndexerPreferences {
private static final String DEFAULT_INDEX_IMPORT_LOCATION = ".settings/cdt-index.zip"; //$NON-NLS-1$ private static final String DEFAULT_INDEX_IMPORT_LOCATION = ".settings/cdt-index.zip"; //$NON-NLS-1$
private static final int DEFAULT_UPDATE_POLICY= 0; private static final int DEFAULT_UPDATE_POLICY= 0;
public static final int DEFAULT_FILE_SIZE_LIMIT = 8; public static final int DEFAULT_FILE_SIZE_LIMIT_MB = 8;
public static final int DEFAULT_INCLUDED_FILE_SIZE_LIMIT_MB = 16;
private static final String QUALIFIER = CCorePlugin.PLUGIN_ID; private static final String QUALIFIER = CCorePlugin.PLUGIN_ID;
private static final String INDEXER_NODE = "indexer"; //$NON-NLS-1$ private static final String INDEXER_NODE = "indexer"; //$NON-NLS-1$
@ -326,7 +328,8 @@ public class IndexerPreferences {
prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, false); prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, false);
prefs.putBoolean(KEY_INDEX_ON_OPEN, false); prefs.putBoolean(KEY_INDEX_ON_OPEN, false);
prefs.putBoolean(KEY_INCLUDE_HEURISTICS, true); prefs.putBoolean(KEY_INCLUDE_HEURISTICS, true);
prefs.putInt(KEY_SKIP_FILES_LARGER_THAN_MB, DEFAULT_FILE_SIZE_LIMIT); prefs.putInt(KEY_SKIP_FILES_LARGER_THAN_MB, DEFAULT_FILE_SIZE_LIMIT_MB);
prefs.putInt(KEY_SKIP_INCLUDED_FILES_LARGER_THAN_MB, DEFAULT_INCLUDED_FILE_SIZE_LIMIT_MB);
prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false); prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false);
prefs.putBoolean(KEY_SKIP_IMPLICIT_REFERENCES, false); prefs.putBoolean(KEY_SKIP_IMPLICIT_REFERENCES, false);
prefs.putBoolean(KEY_SKIP_TYPE_REFERENCES, false); prefs.putBoolean(KEY_SKIP_TYPE_REFERENCES, false);

View file

@ -62,8 +62,9 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
setShowScannerProblems(checkDebugOption(TRACE_SCANNER_PROBLEMS, TRUE)); setShowScannerProblems(checkDebugOption(TRACE_SCANNER_PROBLEMS, TRUE));
setShowSyntaxProblems(checkDebugOption(TRACE_SYNTAX_PROBLEMS, TRUE)); setShowSyntaxProblems(checkDebugOption(TRACE_SYNTAX_PROBLEMS, TRUE));
setShowProblems(checkDebugOption(TRACE_PROBLEMS, TRUE)); setShowProblems(checkDebugOption(TRACE_PROBLEMS, TRUE));
final long limit = getIntProperty(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, 0); final long fileLimit = getIntProperty(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, 0);
setFileSizeLimit(limit * 1024 * 1024); final long includedFileLimit = getIntProperty(IndexerPreferences.KEY_SKIP_INCLUDED_FILES_LARGER_THAN_MB, 0);
setFileSizeLimits(fileLimit * 1024 * 1024, includedFileLimit * 1024 * 1024);
setIndexAllHeaderVersions(checkProperty(IndexerPreferences.KEY_INDEX_ALL_HEADER_VERSIONS)); setIndexAllHeaderVersions(checkProperty(IndexerPreferences.KEY_INDEX_ALL_HEADER_VERSIONS));
setHeadersToIndexAllVersions(getStringSet(IndexerPreferences.KEY_INDEX_ALL_VERSIONS_SPECIFIC_HEADERS)); setHeadersToIndexAllVersions(getStringSet(IndexerPreferences.KEY_INDEX_ALL_VERSIONS_SPECIFIC_HEADERS));
if (checkProperty(IndexerPreferences.KEY_SKIP_ALL_REFERENCES)) { if (checkProperty(IndexerPreferences.KEY_SKIP_ALL_REFERENCES)) {

View file

@ -52,6 +52,7 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
private Button fIndexOnOpen; private Button fIndexOnOpen;
private Button fIncludeHeuristics; private Button fIncludeHeuristics;
private IntegerFieldEditor fFileSizeLimit; private IntegerFieldEditor fFileSizeLimit;
private IntegerFieldEditor fIncludedFileSizeLimit;
private Button fSkipReferences; private Button fSkipReferences;
private Button fSkipImplicitReferences; private Button fSkipImplicitReferences;
private Button fSkipMacroAndTypeReferences; private Button fSkipMacroAndTypeReferences;
@ -91,7 +92,12 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
gl.marginHeight = 0; gl.marginHeight = 0;
gl.marginWidth = 0; gl.marginWidth = 0;
page.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); page.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite group= new Composite(page, SWT.NONE); Composite group= new Composite(page, SWT.NONE);
group.setLayout(gl= new GridLayout(3, false));
gl.marginHeight = 0;
gl.marginWidth= 0;
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fAllSources= createAllFilesButton(group); fAllSources= createAllFilesButton(group);
IProject prj= getCurrentProject(); IProject prj= getCurrentProject();
@ -111,21 +117,26 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
}); });
Label label = ControlFactory.createLabel(group, DialogsMessages.AbstractIndexerPage_indexAllVersionsSpecificHeaders); Label label = ControlFactory.createLabel(group, DialogsMessages.AbstractIndexerPage_indexAllVersionsSpecificHeaders);
int indent = pixelConverter.convertHorizontalDLUsToPixels(12);
GridData layoutData = new GridData(); GridData layoutData = new GridData();
layoutData.horizontalSpan = 3; layoutData.horizontalSpan = 3;
layoutData.horizontalIndent = 10; layoutData.horizontalIndent = indent;
label.setLayoutData(layoutData); label.setLayoutData(layoutData);
fIndexAllVersionsSpecificHeaders = ControlFactory.createTextField(group); fIndexAllVersionsSpecificHeaders = ControlFactory.createTextField(group);
layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 3; layoutData.horizontalSpan = 3;
layoutData.horizontalIndent = 10; layoutData.horizontalIndent = indent;
fIndexAllVersionsSpecificHeaders.setLayoutData(layoutData); fIndexAllVersionsSpecificHeaders.setLayoutData(layoutData);
fIndexOnOpen= createIndexOnOpenButton(group); fIndexOnOpen= createIndexOnOpenButton(group);
fIncludeHeuristics= createIncludeHeuristicsButton(group); fIncludeHeuristics= createIncludeHeuristicsButton(group);
fFileSizeLimit= createFileSizeLimit(group);
group= new Composite(page, SWT.NONE);
fFileSizeLimit= createFileSizeLimit(group, IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB,
DialogsMessages.AbstractIndexerPage_fileSizeLimit);
fIncludedFileSizeLimit= createFileSizeLimit(group, IndexerPreferences.KEY_SKIP_INCLUDED_FILES_LARGER_THAN_MB,
DialogsMessages.AbstractIndexerPage_includedFileSizeLimit);
group.setLayout(gl= new GridLayout(3, false)); group.setLayout(gl= new GridLayout(3, false));
gl.marginHeight = 0; gl.marginHeight = 0;
gl.marginWidth= 0; gl.marginWidth= 0;
@ -188,10 +199,24 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
} }
} }
if (size <= 0) { if (size <= 0) {
size= IndexerPreferences.DEFAULT_FILE_SIZE_LIMIT; size= IndexerPreferences.DEFAULT_FILE_SIZE_LIMIT_MB;
} }
fFileSizeLimit.setStringValue(String.valueOf(size)); fFileSizeLimit.setStringValue(String.valueOf(size));
} }
if (fIncludedFileSizeLimit != null) {
Object prop= properties.get(IndexerPreferences.KEY_SKIP_INCLUDED_FILES_LARGER_THAN_MB);
int size= 0;
if (prop != null) {
try {
size= Integer.parseInt(prop.toString());
} catch (NumberFormatException e) {
}
}
if (size <= 0) {
size= IndexerPreferences.DEFAULT_INCLUDED_FILE_SIZE_LIMIT_MB;
}
fIncludedFileSizeLimit.setStringValue(String.valueOf(size));
}
if (fSkipReferences != null) { if (fSkipReferences != null) {
boolean skipReferences= TRUE.equals(properties.get(IndexerPreferences.KEY_SKIP_ALL_REFERENCES)); boolean skipReferences= TRUE.equals(properties.get(IndexerPreferences.KEY_SKIP_ALL_REFERENCES));
fSkipReferences.setSelection(skipReferences); fSkipReferences.setSelection(skipReferences);
@ -240,6 +265,9 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
if (fFileSizeLimit != null) { if (fFileSizeLimit != null) {
props.put(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, String.valueOf(fFileSizeLimit.getIntValue())); props.put(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, String.valueOf(fFileSizeLimit.getIntValue()));
} }
if (fIncludedFileSizeLimit != null) {
props.put(IndexerPreferences.KEY_SKIP_INCLUDED_FILES_LARGER_THAN_MB, String.valueOf(fIncludedFileSizeLimit.getIntValue()));
}
if (fSkipReferences != null) { if (fSkipReferences != null) {
props.put(IndexerPreferences.KEY_SKIP_ALL_REFERENCES, String.valueOf(fSkipReferences.getSelection())); props.put(IndexerPreferences.KEY_SKIP_ALL_REFERENCES, String.valueOf(fSkipReferences.getSelection()));
} }
@ -309,6 +337,9 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
if (!fFileSizeLimit.isValid()) { if (!fFileSizeLimit.isValid()) {
setErrorMessage(fFileSizeLimit.getErrorMessage()); setErrorMessage(fFileSizeLimit.getErrorMessage());
setValid(false); setValid(false);
} else if (!fIncludedFileSizeLimit.isValid()) {
setErrorMessage(fIncludedFileSizeLimit.getErrorMessage());
setValid(false);
} else { } else {
setValid(true); setValid(true);
} }
@ -354,10 +385,10 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
return result; return result;
} }
private IntegerFieldEditor createFileSizeLimit(Composite group) { private IntegerFieldEditor createFileSizeLimit(Composite group, String key, String label) {
IntegerFieldEditor result= new IntegerFieldEditor(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, DialogsMessages.AbstractIndexerPage_fileSizeLimit, group, 5); IntegerFieldEditor result= new IntegerFieldEditor(key, label, group, 5);
result.setValidRange(1, 100000); result.setValidRange(1, 100000);
ControlFactory.createLabel(group, DialogsMessages.CacheSizeBlock_MB); ControlFactory.createLabel(group, DialogsMessages.Megabyte);
Text control = result.getTextControl(group); Text control = result.getTextControl(group);
LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10)); LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10));
LayoutUtil.setHorizontalGrabbing(control, false); LayoutUtil.setHorizontalGrabbing(control, false);

View file

@ -95,7 +95,7 @@ public class CacheSizeBlock extends AbstractCOptionPage {
control = fDBAbsoluteLimit.getTextControl(cacheComp); control = fDBAbsoluteLimit.getTextControl(cacheComp);
LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10)); LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10));
LayoutUtil.setHorizontalGrabbing(control, false); LayoutUtil.setHorizontalGrabbing(control, false);
ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_MB); ControlFactory.createLabel(cacheComp, DialogsMessages.Megabyte);
Label codeReaderLabel= ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_headerFileCache); Label codeReaderLabel= ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_headerFileCache);
fCodeReaderLimit= new IntegerFieldEditor(CodeReaderCache.CODE_READER_BUFFER, DialogsMessages.CacheSizeBlock_absoluteLimit, cacheComp, 4); fCodeReaderLimit= new IntegerFieldEditor(CodeReaderCache.CODE_READER_BUFFER, DialogsMessages.CacheSizeBlock_absoluteLimit, cacheComp, 4);
@ -103,7 +103,7 @@ public class CacheSizeBlock extends AbstractCOptionPage {
control = fCodeReaderLimit.getTextControl(cacheComp); control = fCodeReaderLimit.getTextControl(cacheComp);
LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10)); LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10));
LayoutUtil.setHorizontalGrabbing(control, false); LayoutUtil.setHorizontalGrabbing(control, false);
ControlFactory.createLabel(cacheComp, DialogsMessages.CacheSizeBlock_MB); ControlFactory.createLabel(cacheComp, DialogsMessages.Megabyte);
gl= (GridLayout) cacheComp.getLayout(); gl= (GridLayout) cacheComp.getLayout();
gl.numColumns= 3; gl.numColumns= 3;

View file

@ -18,13 +18,13 @@ import org.eclipse.osgi.util.NLS;
class DialogsMessages extends NLS { class DialogsMessages extends NLS {
public static String AbstractIndexerPage_fileSizeLimit; public static String AbstractIndexerPage_fileSizeLimit;
public static String AbstractIndexerPage_includedFileSizeLimit;
public static String AbstractIndexerPage_heuristicIncludes; public static String AbstractIndexerPage_heuristicIncludes;
public static String AbstractIndexerPage_indexAllFiles; public static String AbstractIndexerPage_indexAllFiles;
public static String AbstractIndexerPage_indexAllHeaders; public static String AbstractIndexerPage_indexAllHeaders;
public static String AbstractIndexerPage_indexAllHeadersC; public static String AbstractIndexerPage_indexAllHeadersC;
public static String AbstractIndexerPage_indexAllHeadersCpp; public static String AbstractIndexerPage_indexAllHeadersCpp;
public static String AbstractIndexerPage_indexOpenedFiles; public static String AbstractIndexerPage_indexOpenedFiles;
public static String AbstractIndexerPage_indexUpFront;
public static String AbstractIndexerPage_skipAllReferences; public static String AbstractIndexerPage_skipAllReferences;
public static String AbstractIndexerPage_skipImplicitReferences; public static String AbstractIndexerPage_skipImplicitReferences;
public static String AbstractIndexerPage_skipTypeAndMacroReferences; public static String AbstractIndexerPage_skipTypeAndMacroReferences;
@ -32,7 +32,7 @@ class DialogsMessages extends NLS {
public static String AbstractIndexerPage_skipMacroReferences; public static String AbstractIndexerPage_skipMacroReferences;
public static String AbstractIndexerPage_indexAllHeaderVersions; public static String AbstractIndexerPage_indexAllHeaderVersions;
public static String AbstractIndexerPage_indexAllVersionsSpecificHeaders; public static String AbstractIndexerPage_indexAllVersionsSpecificHeaders;
public static String CacheSizeBlock_MB; public static String Megabyte;
public static String IndexerBlock_fixedBuildConfig; public static String IndexerBlock_fixedBuildConfig;
public static String IndexerBlock_indexerOptions; public static String IndexerBlock_indexerOptions;
public static String IndexerBlock_buildConfigGroup; public static String IndexerBlock_buildConfigGroup;

View file

@ -16,13 +16,13 @@ PreferenceScopeBlock_enableProjectSettings=Enable project specific settings
PreferenceScopeBlock_storeWithProject=Store settings with project PreferenceScopeBlock_storeWithProject=Store settings with project
PreferenceScopeBlock_preferenceLink=<a>Configure Workspace Settings...</a> PreferenceScopeBlock_preferenceLink=<a>Configure Workspace Settings...</a>
AbstractIndexerPage_fileSizeLimit=Skip files larger than: AbstractIndexerPage_fileSizeLimit=Skip files larger than:
AbstractIndexerPage_includedFileSizeLimit=Skip included files larger than:
AbstractIndexerPage_heuristicIncludes=Allow heuristic resolution of includes AbstractIndexerPage_heuristicIncludes=Allow heuristic resolution of includes
AbstractIndexerPage_indexAllFiles=Index source files not included in the build AbstractIndexerPage_indexAllFiles=Index source files not included in the build
AbstractIndexerPage_indexAllHeaders=Index unused headers AbstractIndexerPage_indexAllHeaders=Index unused headers
AbstractIndexerPage_indexAllHeadersC=Index unused headers as C files AbstractIndexerPage_indexAllHeadersC=Index unused headers as C files
AbstractIndexerPage_indexAllHeadersCpp=Index unused headers as C++ files AbstractIndexerPage_indexAllHeadersCpp=Index unused headers as C++ files
AbstractIndexerPage_indexOpenedFiles=Index source and header files opened in editor AbstractIndexerPage_indexOpenedFiles=Index source and header files opened in editor
AbstractIndexerPage_indexUpFront=Files to index up-front:
AbstractIndexerPage_skipAllReferences=Skip all references (Call Hierarchy and Search will not work) AbstractIndexerPage_skipAllReferences=Skip all references (Call Hierarchy and Search will not work)
AbstractIndexerPage_skipImplicitReferences=Skip implicit references (e.g. overloaded operators) AbstractIndexerPage_skipImplicitReferences=Skip implicit references (e.g. overloaded operators)
AbstractIndexerPage_skipTypeAndMacroReferences=Skip type and macro references (Search for these references will not work) AbstractIndexerPage_skipTypeAndMacroReferences=Skip type and macro references (Search for these references will not work)
@ -34,7 +34,7 @@ CacheSizeBlock_cacheLimitGroup=Cache limits
CacheSizeBlock_indexDatabaseCache=Index database cache: CacheSizeBlock_indexDatabaseCache=Index database cache:
CacheSizeBlock_limitRelativeToMaxHeapSize=Limit relative to the maximum heap size: CacheSizeBlock_limitRelativeToMaxHeapSize=Limit relative to the maximum heap size:
CacheSizeBlock_absoluteLimit=Absolute Limit: CacheSizeBlock_absoluteLimit=Absolute Limit:
CacheSizeBlock_MB=MB Megabyte=MB
CacheSizeBlock_headerFileCache=Header file cache (used by refactoring): CacheSizeBlock_headerFileCache=Header file cache (used by refactoring):
DocCommentOwnerBlock_DocToolLabel=Documentation tool: DocCommentOwnerBlock_DocToolLabel=Documentation tool:
DocCommentOwnerBlock_EnableProjectSpecificSettings=Enable project specific settings DocCommentOwnerBlock_EnableProjectSpecificSettings=Enable project specific settings