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

Bug 302289: File size limit for files to be indexed.

This commit is contained in:
Markus Schorn 2010-02-24 15:44:36 +00:00
parent 25b266f275
commit fc4b41e811
14 changed files with 205 additions and 56 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2009 QNX Software Systems and others.
* Copyright (c) 2005, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -52,6 +52,7 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
private final ASTFilePathResolver fPathResolver;
private final AbstractIndexerTask fRelatedIndexerTask;
private boolean fSupportFillGapFromContextToHeader= false;
private long fFileSizeLimit= 0;
public IndexBasedFileContentProvider(IIndex index,
ASTFilePathResolver pathResolver, int linkage, IncludeFileContentProvider fallbackFactory) {
@ -71,6 +72,10 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
fSupportFillGapFromContextToHeader= val;
}
public void setFileSizeLimit(long limit) {
fFileSizeLimit= limit;
}
public void setLinkage(int linkageID) {
fLinkage= linkageID;
}
@ -104,7 +109,7 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
}
path= fPathResolver.getASTPath(ifl);
// include files once, only.
// Include files once, only.
if (!fIncludedFiles.add(ifl)) {
return new InternalFileContent(path, InclusionKind.SKIP_FILE);
}
@ -128,6 +133,11 @@ public final class IndexBasedFileContentProvider extends InternalFileContentProv
catch (CoreException e) {
CCorePlugin.log(e);
}
// Skip large files
if (fFileSizeLimit > 0 && fPathResolver.getFileSize(path) > fFileSizeLimit) {
return new InternalFileContent(path, InclusionKind.SKIP_FILE);
}
if (fFallBackFactory != null) {
InternalFileContent ifc= getContentForInclusion(ifl, path);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -59,6 +59,11 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
public boolean isSource(String filename) {
return isValidSourceUnitName(filename);
}
@Override
public long getFileSize(String astFilePath) {
return new File(astFilePath).length();
}
@Override
public IIndexFileLocation resolveFile(Object tu) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -14,7 +14,6 @@ import org.eclipse.cdt.core.index.IIndexFileLocation;
/**
* Abstract class for resolving paths as computed by the parser.
* @since 5.0
*/
public abstract class ASTFilePathResolver {
@ -45,4 +44,9 @@ public abstract class ASTFilePathResolver {
* Answers whether this file is considered to be a source file (vs. a header file).
*/
public abstract boolean isSource(String astFilePath);
/**
* Returns the size of the file in bytes, or -1 if it cannot be determined
*/
public abstract long getFileSize(String astFilePath);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -179,6 +179,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
protected IWritableIndex fIndex;
private ITodoTaskUpdater fTodoTaskUpdater;
private final boolean fIsFastIndexer;
private long fFileSizeLimit= 0;
private InternalFileContentProvider fCodeReaderFactory;
public AbstractIndexerTask(Object[] filesToUpdate, Object[] filesToRemove, IndexerInputAdapter resolver, boolean fastIndexer) {
@ -210,6 +211,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
public final void setForceFirstFiles(int number) {
fForceNumberFiles= number;
}
public final void setFileSizeLimit(long limit) {
fFileSizeLimit= limit;
}
protected abstract IWritableIndex createIndex();
protected abstract IIncludeFileResolutionHeuristics createIncludeHeuristics();
@ -255,12 +259,19 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
private final IASTTranslationUnit createAST(AbstractLanguage language, FileContent codeReader,
IScannerInfo scanInfo, int options, boolean inContext, IProgressMonitor pm) throws CoreException {
if (fFileSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fFileSizeLimit) {
if (fShowActivity) {
trace("Indexer: Skipping large file " + codeReader.getFileLocation()); //$NON-NLS-1$
}
return null;
}
if (fCodeReaderFactory == null) {
InternalFileContentProvider fileContentProvider = createInternalFileContentProvider();
if (fIsFastIndexer) {
IndexBasedFileContentProvider ibfcp = new IndexBasedFileContentProvider(fIndex, fResolver,
language.getLinkageID(), fileContentProvider, this);
ibfcp.setSupportFillGapFromContextToHeader(inContext);
ibfcp.setFileSizeLimit(fFileSizeLimit);
fCodeReaderFactory= ibfcp;
} else {
fCodeReaderFactory= fileContentProvider;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -30,6 +30,7 @@ public abstract class AbstractPDOMIndexer implements IPDOMIndexer {
fProperties.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, String.valueOf(false));
fProperties.put(IndexerPreferences.KEY_INDEX_ALL_FILES, String.valueOf(false));
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_FILES_TO_PARSE_UP_FRONT, ""); //$NON-NLS-1$
fProperties.put(IndexerPreferences.KEY_SKIP_ALL_REFERENCES, String.valueOf(false));
fProperties.put(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES, String.valueOf(false));

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -50,6 +50,9 @@ public final class FileExistsCache {
}
String parent= file.getParent();
if (parent == null)
return false;
String name= file.getName();
if (CASE_INSENSITIVE)
name= name.toUpperCase();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -54,6 +54,7 @@ public class IndexerPreferences {
public static final String KEY_SKIP_TYPE_REFERENCES= "skipTypeReferences"; //$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_SKIP_FILES_LARGER_THAN_MB = "skipFilesLargerThanMB"; //$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$
@ -72,6 +73,7 @@ public class IndexerPreferences {
"signal.h, " + // configures bits/signum.h //$NON-NLS-1$
"cstdio"; // configures stdio.h for c++ !! fragments bits/signum.h !! //$NON-NLS-1$
private static final int DEFAULT_UPDATE_POLICY= 0;
public static final int DEFAULT_FILE_SIZE_LIMIT = 8;
private static final String QUALIFIER = CCorePlugin.PLUGIN_ID;
private static final String INDEXER_NODE = "indexer"; //$NON-NLS-1$
@ -329,6 +331,7 @@ public class IndexerPreferences {
prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, false);
prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, false);
prefs.putBoolean(KEY_INCLUDE_HEURISTICS, true);
prefs.putInt(KEY_SKIP_FILES_LARGER_THAN_MB, DEFAULT_FILE_SIZE_LIMIT);
prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false);
prefs.putBoolean(KEY_SKIP_IMPLICIT_REFERENCES, false);
prefs.putBoolean(KEY_SKIP_TYPE_REFERENCES, false);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -65,6 +65,8 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
setShowScannerProblems(checkDebugOption(TRACE_SCANNER_PROBLEMS, TRUE));
setShowSyntaxProblems(checkDebugOption(TRACE_SYNTAX_PROBLEMS, TRUE));
setShowProblems(checkDebugOption(TRACE_PROBLEMS, TRUE));
final long limit = getIntProperty(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, 0);
setFileSizeLimit(limit * 1024 * 1024);
if (checkProperty(IndexerPreferences.KEY_SKIP_ALL_REFERENCES)) {
setSkipReferences(SKIP_ALL_REFERENCES);
} else {
@ -140,7 +142,18 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
private boolean checkProperty(String key) {
return TRUE.equals(getIndexer().getProperty(key));
}
private int getIntProperty(String key, int defaultValue) {
final String value = getIndexer().getProperty(key);
if (value != null) {
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
}
}
return defaultValue;
}
@Override
protected String getASTPathForParsingUpFront() {
final IProject project = getProject().getProject();

View file

@ -119,6 +119,11 @@ public class ProjectIndexerInputAdapter extends IndexerInputAdapter {
}
return new File(includePath).isFile();
}
@Override
public long getFileSize(String astFilePath) {
return new File(astFilePath).length();
}
@Override
public String getASTPath(IIndexFileLocation ifl) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2008 QNX Software Systems and others.
* Copyright (c) 2005, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -42,6 +42,7 @@ public class IndexerPreferencePage extends PreferencePage implements
public IndexerPreferencePage(){
fOptionBlock = new IndexerBlock();
fOptionBlock.setContainer(this);
fStrategyBlock= new IndexerStrategyBlock(this);
fCacheBlock= new CacheSizeBlock(this);
}

View file

@ -1,13 +1,13 @@
/*******************************************************************************
* Copyright (c) 2005, 2009 IBM Corporation and others.
* Copyright (c) 2005, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bogdan Gheorghe (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.ui.dialogs;
@ -15,9 +15,15 @@ import java.util.Properties;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@ -29,7 +35,7 @@ import org.eclipse.cdt.internal.core.model.CProject;
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
/**
* @author Bogdan Gheorghe
* Configuration for indexer.
*/
public abstract class AbstractIndexerPage extends AbstractCOptionPage {
protected static final String INDEX_ALL_FILES = DialogsMessages.AbstractIndexerPage_indexAllFiles;
@ -39,11 +45,19 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
private Button fAllHeadersDefault;
private Button fAllHeadersAlt;
private Button fIncludeHeuristics;
private IntegerFieldEditor fFileSizeLimit;
private Text fFilesToParseUpFront;
private Button fSkipReferences;
private Button fSkipTypeReferences;
private Button fSkipImplicitReferences;
private Button fSkipMacroReferences;
private Button fSkipMacroAndTypeReferences;
private IPropertyChangeListener validityChangeListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(FieldEditor.IS_VALID)) {
updateValidState();
}
}
};
protected AbstractIndexerPage() {
super();
@ -59,20 +73,35 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
@Override
public void createControl(Composite parent) {
GridLayout gl;
Composite page = ControlFactory.createComposite(parent, 1);
fAllSources= createAllFilesButton(page);
Composite group= new Composite(page, SWT.NONE);
fAllSources= createAllFilesButton(group);
IProject prj= getCurrentProject();
if (prj == null || !CProject.hasCCNature(prj)) {
fAllHeadersDefault= createAllHeadersButton(page);
fAllHeadersDefault= createAllHeadersButton(group);
} else {
fAllHeadersDefault= createAllCppHeadersButton(page);
fAllHeadersAlt= createAllCHeadersButton(page);
fAllHeadersDefault= createAllCppHeadersButton(group);
fAllHeadersAlt= createAllCHeadersButton(group);
}
fIncludeHeuristics= createIncludeHeuristicsButton(page);
fSkipReferences= createSkipReferencesButton(page);
fSkipImplicitReferences= createSkipImplicitReferencesButton(page);
fSkipTypeReferences= createSkipTypeReferencesButton(page);
fSkipMacroReferences= createSkipMacroReferencesButton(page);
fIncludeHeuristics= createIncludeHeuristicsButton(group);
fFileSizeLimit= createFileSizeLimit(group);
group.setLayout(gl= new GridLayout(3, false));
gl.marginWidth= 0;
group.setLayoutData(new GridData());
group= new Composite(page, SWT.NONE);
group.setLayout(gl= new GridLayout(1, false));
gl.marginWidth= 0;
group.setLayoutData(new GridData());
fSkipReferences= createSkipReferencesButton(group);
fSkipImplicitReferences= createSkipImplicitReferencesButton(group);
fSkipMacroAndTypeReferences= createSkipMacroAndTypeReferencesButton(group);
fFilesToParseUpFront= createParseUpFrontTextField(page);
final SelectionAdapter selectionListener = new SelectionAdapter() {
@ -109,6 +138,20 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
boolean use= prop == null || TRUE.equals(prop);
fIncludeHeuristics.setSelection(use);
}
if (fFileSizeLimit != null) {
Object prop= properties.get(IndexerPreferences.KEY_SKIP_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_FILE_SIZE_LIMIT;
}
fFileSizeLimit.setStringValue(String.valueOf(size));
}
if (fSkipReferences != null) {
boolean skipReferences= TRUE.equals(properties.get(IndexerPreferences.KEY_SKIP_ALL_REFERENCES));
fSkipReferences.setSelection(skipReferences);
@ -117,13 +160,10 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
boolean skipImplicitReferences= TRUE.equals(properties.get(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES));
fSkipImplicitReferences.setSelection(skipImplicitReferences);
}
if (fSkipTypeReferences != null) {
if (fSkipMacroAndTypeReferences != null) {
boolean skipTypeReferences= TRUE.equals(properties.get(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES));
fSkipTypeReferences.setSelection(skipTypeReferences);
}
if (fSkipMacroReferences != null) {
boolean skipMacroReferences= TRUE.equals(properties.get(IndexerPreferences.KEY_SKIP_MACRO_REFERENCES));
fSkipMacroReferences.setSelection(skipMacroReferences);
fSkipMacroAndTypeReferences.setSelection(skipTypeReferences && skipMacroReferences);
}
if (fFilesToParseUpFront != null) {
String files = getNotNull(properties, IndexerPreferences.KEY_FILES_TO_PARSE_UP_FRONT);
@ -150,6 +190,9 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
if (fIncludeHeuristics != null) {
props.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(fIncludeHeuristics.getSelection()));
}
if (fFileSizeLimit != null) {
props.put(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, String.valueOf(fFileSizeLimit.getIntValue()));
}
if (fFilesToParseUpFront != null) {
props.put(IndexerPreferences.KEY_FILES_TO_PARSE_UP_FRONT, fFilesToParseUpFront.getText());
}
@ -159,11 +202,10 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
if (fSkipImplicitReferences != null) {
props.put(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES, String.valueOf(fSkipImplicitReferences.getSelection()));
}
if (fSkipTypeReferences != null) {
props.put(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES, String.valueOf(fSkipTypeReferences.getSelection()));
}
if (fSkipMacroReferences != null) {
props.put(IndexerPreferences.KEY_SKIP_MACRO_REFERENCES, String.valueOf(fSkipMacroReferences.getSelection()));
if (fSkipMacroAndTypeReferences != null) {
final String value = String.valueOf(fSkipMacroAndTypeReferences.getSelection());
props.put(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES, value);
props.put(IndexerPreferences.KEY_SKIP_MACRO_REFERENCES, value);
}
return props;
}
@ -190,15 +232,25 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
if (fSkipImplicitReferences != null) {
fSkipImplicitReferences.setEnabled(!skipReferences);
}
if (fSkipTypeReferences != null) {
fSkipTypeReferences.setEnabled(!skipReferences);
}
if (fSkipMacroReferences != null) {
fSkipMacroReferences.setEnabled(!skipReferences);
if (fSkipMacroAndTypeReferences != null) {
fSkipMacroAndTypeReferences.setEnabled(!skipReferences);
}
}
}
private void updateValidState() {
if (!fFileSizeLimit.isValid()) {
setErrorMessage(fFileSizeLimit.getErrorMessage());
setValid(false);
} else {
setValid(true);
}
final ICOptionContainer container = getContainer();
if (container != null) {
container.updateContainer();
}
}
private String getNotNull(Properties properties, String key) {
String files= (String) properties.get(key);
if (files == null) {
@ -214,23 +266,45 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
}
private Button createAllFilesButton(Composite page) {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllFiles);
Button result= ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllFiles);
((GridData) result.getLayoutData()).horizontalSpan= 3;
return result;
}
private Button createAllHeadersButton(Composite page) {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeaders);
Button result= ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeaders);
((GridData) result.getLayoutData()).horizontalSpan= 3;
return result;
}
private Button createAllCHeadersButton(Composite page) {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeadersC);
Button result= ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeadersC);
((GridData) result.getLayoutData()).horizontalSpan= 3;
return result;
}
private Button createAllCppHeadersButton(Composite page) {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeadersCpp);
Button result= ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeadersCpp);
((GridData) result.getLayoutData()).horizontalSpan= 3;
return result;
}
private Button createIncludeHeuristicsButton(Composite page) {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_heuristicIncludes);
Button result= ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_heuristicIncludes);
((GridData) result.getLayoutData()).horizontalSpan= 3;
return result;
}
private IntegerFieldEditor createFileSizeLimit(Composite group) {
IntegerFieldEditor result= new IntegerFieldEditor(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, DialogsMessages.AbstractIndexerPage_fileSizeLimit, group, 5);
result.setValidRange(1, 100000);
ControlFactory.createLabel(group, DialogsMessages.CacheSizeBlock_MB);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace= true;
gd.horizontalAlignment= GridData.FILL;
result.getLabelControl(group).setLayoutData(gd);
result.setPropertyChangeListener(validityChangeListener);
return result;
}
private Button createSkipReferencesButton(Composite page) {
@ -241,11 +315,7 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_skipImplicitReferences);
}
private Button createSkipTypeReferencesButton(Composite page) {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_skipTypeReferences);
}
private Button createSkipMacroReferencesButton(Composite page) {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_skipMacroReferences);
private Button createSkipMacroAndTypeReferencesButton(Composite page) {
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_skipTypeAndMacroReferences);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -20,6 +20,8 @@ import org.eclipse.osgi.util.NLS;
*/
public class DialogsMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.ui.dialogs.DialogsMessages"; //$NON-NLS-1$
/** @since 5.2 */
public static String AbstractIndexerPage_fileSizeLimit;
/** @since 5.1 */
public static String AbstractIndexerPage_heuristicIncludes;
public static String AbstractIndexerPage_indexAllFiles;
@ -33,6 +35,8 @@ public class DialogsMessages extends NLS {
public static String AbstractIndexerPage_skipAllReferences;
/** @since 5.1 */
public static String AbstractIndexerPage_skipImplicitReferences;
/** @since 5.2 */
public static String AbstractIndexerPage_skipTypeAndMacroReferences;
public static String AbstractIndexerPage_skipTypeReferences;
public static String AbstractIndexerPage_skipMacroReferences;
public static String CacheSizeBlock_MB;

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
# Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
PreferenceScopeBlock_enableProjectSettings=Enable project specific settings
PreferenceScopeBlock_storeWithProject=Store settings with project
PreferenceScopeBlock_preferenceLink=<a>Configure Workspace Settings...</a>
AbstractIndexerPage_fileSizeLimit=Skip files larger than
AbstractIndexerPage_heuristicIncludes=Allow heuristic resolution of includes
AbstractIndexerPage_indexAllFiles=Index source files not included in the build
AbstractIndexerPage_indexAllHeaders=Index unused headers
@ -20,6 +21,7 @@ AbstractIndexerPage_indexAllHeadersC=Index unused headers as C files
AbstractIndexerPage_indexAllHeadersCpp=Index unused headers as C++ files
AbstractIndexerPage_skipAllReferences=Skip all references (Call Hierarchy and Search will not work)
AbstractIndexerPage_skipImplicitReferences=Skip implicit references (e.g. overloaded operators)
AbstractIndexerPage_skipTypeAndMacroReferences=Skip type and macro references (Search for these references will not work)
AbstractIndexerPage_skipTypeReferences=Skip type references (Search for type references will not work)
AbstractIndexerPage_skipMacroReferences=Skip macro references (Search for macro references will not work)
AbstractIndexerPage_indexUpFront=Files to index up-front:
@ -28,7 +30,7 @@ CacheSizeBlock_indexDatabaseCache=Index database cache:
CacheSizeBlock_limitRelativeToMaxHeapSize=Limit relative to the maximum heap size:
CacheSizeBlock_absoluteLimit=Absolute Limit:
CacheSizeBlock_MB=MB
CacheSizeBlock_headerFileCache=Header file cache (used by full indexer and refactoring):
CacheSizeBlock_headerFileCache=Header file cache (used by refactoring):
DocCommentOwnerBlock_DocToolLabel=Documentation tool:
DocCommentOwnerBlock_EnableProjectSpecificSettings=Enable project specific settings
DocCommentOwnerBlock_SelectDocToolDescription=Select the documentation tool to be used to determine editor behaviors in this project

View file

@ -96,6 +96,23 @@ public class IndexerBlock extends AbstractCOptionPage {
initializeIndexerConfigMap();
}
@Override
public boolean isValid() {
return super.isValid() && (fCurrentPage == null || fCurrentPage.isValid());
}
@Override
public String getErrorMessage() {
String msg = super.getErrorMessage();
if (msg == null && fCurrentPage != null) {
msg= fCurrentPage.getErrorMessage();
}
return msg;
}
/**
* Create a profile page only on request
*/