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

Bug 248853 - Index source and include files discovered by CEditor

This commit is contained in:
Sergey Prigogin 2011-05-23 22:30:12 +00:00
parent 0f3bd7d90f
commit 8fc40a2884
11 changed files with 133 additions and 31 deletions

View file

@ -1,12 +1,13 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.index; package org.eclipse.cdt.core.index;
@ -88,6 +89,12 @@ public interface IIndexManager extends IPDOMManager {
*/ */
public final static int UPDATE_CHECK_CONTENTS_HASH= 0x10; public final static int UPDATE_CHECK_CONTENTS_HASH= 0x10;
/**
* Include files that are otherwise would be excluded from the index.
* @since 5.3
*/
public final static int FORCE_INDEX_INCLUSION= 0x20;
/** /**
* Returns the index for the given project. * Returns the index for the given project.
* @param project the project to get the index for * @param project the project to get the index for

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -465,6 +465,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final boolean checkTimestamps= (fUpdateFlags & IIndexManager.UPDATE_CHECK_TIMESTAMPS) != 0; final boolean checkTimestamps= (fUpdateFlags & IIndexManager.UPDATE_CHECK_TIMESTAMPS) != 0;
final boolean checkFileContentsHash = (fUpdateFlags & IIndexManager.UPDATE_CHECK_CONTENTS_HASH) != 0; final boolean checkFileContentsHash = (fUpdateFlags & IIndexManager.UPDATE_CHECK_CONTENTS_HASH) != 0;
final boolean checkConfig= (fUpdateFlags & IIndexManager.UPDATE_CHECK_CONFIGURATION) != 0; final boolean checkConfig= (fUpdateFlags & IIndexManager.UPDATE_CHECK_CONFIGURATION) != 0;
final boolean forceInclusion= (fUpdateFlags & IIndexManager.FORCE_INDEX_INCLUSION) != 0;
int count= 0; int count= 0;
int forceFirst= fForceNumberFiles; int forceFirst= fForceNumberFiles;
@ -482,8 +483,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final boolean isSourceUnit= fResolver.isSourceUnit(tu); final boolean isSourceUnit= fResolver.isSourceUnit(tu);
final boolean isExcludedSource= isSourceUnit && !fIndexFilesWithoutConfiguration && !fResolver.isFileBuildConfigured(tu); final boolean isExcludedSource= isSourceUnit && !fIndexFilesWithoutConfiguration && !fResolver.isFileBuildConfigured(tu);
if ((isSourceUnit && !isExcludedSource) || fIndexHeadersWithoutContext != UnusedHeaderStrategy.skip) { if ((isSourceUnit && !isExcludedSource) || fIndexHeadersWithoutContext != UnusedHeaderStrategy.skip ||
// headers or sources required with a specific linkage forceInclusion) {
// Headers or sources required with a specific linkage
AbstractLanguage[] langs= fResolver.getLanguages(tu, fIndexHeadersWithoutContext == UnusedHeaderStrategy.useBoth); AbstractLanguage[] langs= fResolver.getLanguages(tu, fIndexHeadersWithoutContext == UnusedHeaderStrategy.useBoth);
for (AbstractLanguage lang : langs) { for (AbstractLanguage lang : langs) {
int linkageID = lang.getLinkageID(); int linkageID = lang.getLinkageID();

View file

@ -1,12 +1,13 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.indexer; package org.eclipse.cdt.internal.core.pdom.indexer;
@ -20,7 +21,6 @@ import org.eclipse.cdt.core.model.ICProject;
* Abstract base class for all indexers. * Abstract base class for all indexers.
*/ */
public abstract class AbstractPDOMIndexer implements IPDOMIndexer { public abstract class AbstractPDOMIndexer implements IPDOMIndexer {
protected ICProject project; protected ICProject project;
protected Properties fProperties= new Properties(); protected Properties fProperties= new Properties();
@ -28,7 +28,7 @@ public abstract class AbstractPDOMIndexer implements IPDOMIndexer {
fProperties.put(IndexerPreferences.KEY_INDEX_ALL_FILES, String.valueOf(true)); fProperties.put(IndexerPreferences.KEY_INDEX_ALL_FILES, String.valueOf(true));
fProperties.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, String.valueOf(false)); fProperties.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, String.valueOf(false));
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_ALL_FILES, 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));
fProperties.put(IndexerPreferences.KEY_FILES_TO_PARSE_UP_FRONT, ""); //$NON-NLS-1$ fProperties.put(IndexerPreferences.KEY_FILES_TO_PARSE_UP_FRONT, ""); //$NON-NLS-1$

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.indexer; package org.eclipse.cdt.internal.core.pdom.indexer;
@ -47,6 +48,7 @@ public class IndexerPreferences {
public static final String KEY_INDEX_ALL_FILES= "indexAllFiles"; //$NON-NLS-1$ public static final String KEY_INDEX_ALL_FILES= "indexAllFiles"; //$NON-NLS-1$
public static final String KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG= "indexUnusedHeadersWithDefaultLang"; //$NON-NLS-1$ public static final String KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG= "indexUnusedHeadersWithDefaultLang"; //$NON-NLS-1$
public static final String KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG= "indexUnusedHeadersWithAlternateLang"; //$NON-NLS-1$ public static final String KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG= "indexUnusedHeadersWithAlternateLang"; //$NON-NLS-1$
public static final String KEY_INDEX_ON_OPEN= "indexOnOpen"; //$NON-NLS-1$
public static final String KEY_INCLUDE_HEURISTICS= "useHeuristicIncludeResolution"; //$NON-NLS-1$ public static final String KEY_INCLUDE_HEURISTICS= "useHeuristicIncludeResolution"; //$NON-NLS-1$
public static final String KEY_FILES_TO_PARSE_UP_FRONT= "filesToParseUpFront"; //$NON-NLS-1$ public static final String KEY_FILES_TO_PARSE_UP_FRONT= "filesToParseUpFront"; //$NON-NLS-1$
public static final String KEY_SKIP_ALL_REFERENCES= "skipReferences"; //$NON-NLS-1$ public static final String KEY_SKIP_ALL_REFERENCES= "skipReferences"; //$NON-NLS-1$
@ -330,6 +332,7 @@ public class IndexerPreferences {
prefs.putBoolean(KEY_INDEX_ALL_FILES, true); prefs.putBoolean(KEY_INDEX_ALL_FILES, true);
prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, false); prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, false);
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_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);
prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false); prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false);

View file

@ -29,6 +29,7 @@ import java.util.Stack;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -175,7 +176,13 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage; import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexFile;
import org.eclipse.cdt.core.index.IIndexFileLocation;
import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.index.IndexLocationFactory;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ILanguage; import org.eclipse.cdt.core.model.ILanguage;
@ -194,6 +201,7 @@ import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider; import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider;
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable; import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil; import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.CPluginImages;
@ -237,7 +245,6 @@ import org.eclipse.cdt.internal.ui.viewsupport.SelectionListenerWithASTManager;
* C/C++ source editor. * C/C++ source editor.
*/ */
public class CEditor extends TextEditor implements ISelectionChangedListener, ICReconcilingListener { public class CEditor extends TextEditor implements ISelectionChangedListener, ICReconcilingListener {
/** Marker used for synchronization from Problems View to the editor on double-click. */ /** Marker used for synchronization from Problems View to the editor on double-click. */
private IMarker fSyncProblemsViewMarker = null; private IMarker fSyncProblemsViewMarker = null;
@ -1427,12 +1434,59 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
} }
ICElement element= getInputCElement(); ICElement element= getInputCElement();
if (element instanceof ITranslationUnit) { if (element instanceof ITranslationUnit) {
fBracketMatcher.configure(((ITranslationUnit) element).getLanguage()); ITranslationUnit tu = (ITranslationUnit) element;
addToIndexIfNecessary(tu);
fBracketMatcher.configure(tu.getLanguage());
} else { } else {
fBracketMatcher.configure(null); fBracketMatcher.configure(null);
} }
} }
private void addToIndexIfNecessary(ITranslationUnit tu) {
IProject project = tu.getCProject().getProject();
if (String.valueOf(true).equals(IndexerPreferences.get(project, IndexerPreferences.KEY_INDEX_ON_OPEN, null))) {
IndexUpdateRequestorJob job = new IndexUpdateRequestorJob(tu);
job.schedule();
}
}
private static class IndexUpdateRequestorJob extends Job {
private final ITranslationUnit tu;
IndexUpdateRequestorJob(ITranslationUnit tu) {
super(CEditorMessages.CEditor_index_expander_job_name);
this.tu = tu;
setSystem(true);
setPriority(Job.DECORATE);
}
@Override
protected IStatus run(IProgressMonitor monitor) {
ICProject[] projects;
try {
projects = CoreModel.getDefault().getCModel().getCProjects();
IIndexManager indexManager = CCorePlugin.getIndexManager();
IIndex index = indexManager.getIndex(projects);
index.acquireReadLock();
try {
IIndexFileLocation ifl = IndexLocationFactory.getIFL(tu);
IIndexFile file = index.getFile(tu.getLanguage().getLinkageID(), ifl);
if (file != null) {
return Status.OK_STATUS; // Already indexed.
}
indexManager.update(new ICElement[] { tu },
IIndexManager.FORCE_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS);
} finally {
index.releaseReadLock();
}
} catch (CModelException e) {
} catch (CoreException e) {
} catch (InterruptedException e) {
}
return Status.OK_STATUS;
}
}
private void updateScalabilityMode(IEditorInput input) { private void updateScalabilityMode(IEditorInput input) {
int lines = getDocumentProvider().getDocument(input).getNumberOfLines(); int lines = getDocumentProvider().getDocument(input).getNumberOfLines();
boolean wasEnabled = fEnableScalablilityMode; boolean wasEnabled = fEnableScalablilityMode;

View file

@ -95,6 +95,7 @@ public final class CEditorMessages extends NLS {
public static String SemanticHighlighting_problem; public static String SemanticHighlighting_problem;
public static String SemanticHighlighting_externalSDK; public static String SemanticHighlighting_externalSDK;
public static String CEditor_markOccurrences_job_name; public static String CEditor_markOccurrences_job_name;
public static String CEditor_index_expander_job_name;
public static String CEditorActionContributor_ExpandSelectionMenu_label; public static String CEditorActionContributor_ExpandSelectionMenu_label;
static { static {

View file

@ -92,4 +92,5 @@ SemanticHighlighting_problem= Problems
SemanticHighlighting_externalSDK= External SDK calls SemanticHighlighting_externalSDK= External SDK calls
CEditor_markOccurrences_job_name= Occurrences Marker CEditor_markOccurrences_job_name= Occurrences Marker
CEditor_index_expander_job_name= Index Expander
CEditorActionContributor_ExpandSelectionMenu_label=E&xpand Selection To CEditorActionContributor_ExpandSelectionMenu_label=E&xpand Selection To

View file

@ -1,13 +1,14 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others. * Copyright (c) 2005, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Bogdan Gheorghe (IBM) - Initial API and implementation * Bogdan Gheorghe (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.dialogs; package org.eclipse.cdt.ui.dialogs;
@ -15,6 +16,7 @@ import java.util.Properties;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.jface.preference.FieldEditor; import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.IntegerFieldEditor; import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.IPropertyChangeListener;
@ -34,6 +36,8 @@ import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.cdt.internal.core.model.CProject; import org.eclipse.cdt.internal.core.model.CProject;
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences; import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
/** /**
* Configuration for indexer. * Configuration for indexer.
*/ */
@ -44,6 +48,7 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
private Button fAllSources; private Button fAllSources;
private Button fAllHeadersDefault; private Button fAllHeadersDefault;
private Button fAllHeadersAlt; private Button fAllHeadersAlt;
private Button fIndexOnOpen;
private Button fIncludeHeuristics; private Button fIncludeHeuristics;
private IntegerFieldEditor fFileSizeLimit; private IntegerFieldEditor fFileSizeLimit;
private Text fFilesToParseUpFront; private Text fFilesToParseUpFront;
@ -58,6 +63,8 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
} }
} }
}; };
/** @since 5.3 */
protected PixelConverter pixelConverter;
protected AbstractIndexerPage() { protected AbstractIndexerPage() {
super(); super();
@ -73,8 +80,14 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
@Override @Override
public void createControl(Composite parent) { public void createControl(Composite parent) {
pixelConverter = new PixelConverter(parent);
GridLayout gl; GridLayout gl;
Composite page = ControlFactory.createComposite(parent, 1); Composite page = new Composite(parent, SWT.NULL);
page.setFont(parent.getFont());
page.setLayout(gl= new GridLayout(1, true));
gl.marginHeight = 0;
gl.marginWidth = 0;
page.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite group= new Composite(page, SWT.NONE); Composite group= new Composite(page, SWT.NONE);
fAllSources= createAllFilesButton(group); fAllSources= createAllFilesButton(group);
@ -85,17 +98,19 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
fAllHeadersDefault= createAllCppHeadersButton(group); fAllHeadersDefault= createAllCppHeadersButton(group);
fAllHeadersAlt= createAllCHeadersButton(group); fAllHeadersAlt= createAllCHeadersButton(group);
} }
fIndexOnOpen= createIndexOnOpenButton(group);
fIncludeHeuristics= createIncludeHeuristicsButton(group); fIncludeHeuristics= createIncludeHeuristicsButton(group);
fFileSizeLimit= createFileSizeLimit(group); fFileSizeLimit= createFileSizeLimit(group);
group.setLayout(gl= new GridLayout(3, false)); group.setLayout(gl= new GridLayout(3, false));
gl.marginHeight = 0;
gl.marginWidth= 0; gl.marginWidth= 0;
group.setLayoutData(new GridData()); group.setLayoutData(new GridData());
group= new Composite(page, SWT.NONE); group= new Composite(page, SWT.NONE);
group.setLayout(gl= new GridLayout(1, false)); group.setLayout(gl= new GridLayout(1, false));
gl.marginHeight = 0;
gl.marginWidth= 0; gl.marginWidth= 0;
group.setLayoutData(new GridData()); group.setLayoutData(new GridData());
fSkipReferences= createSkipReferencesButton(group); fSkipReferences= createSkipReferencesButton(group);
@ -133,6 +148,10 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
boolean indexAllFiles= TRUE.equals(properties.get(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG)); boolean indexAllFiles= TRUE.equals(properties.get(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG));
fAllHeadersAlt.setSelection(indexAllFiles); fAllHeadersAlt.setSelection(indexAllFiles);
} }
if (fIndexOnOpen != null) {
boolean indexOnOpen= TRUE.equals(properties.get(IndexerPreferences.KEY_INDEX_ON_OPEN));
fIndexOnOpen.setSelection(indexOnOpen);
}
if (fIncludeHeuristics != null) { if (fIncludeHeuristics != null) {
Object prop= properties.get(IndexerPreferences.KEY_INCLUDE_HEURISTICS); Object prop= properties.get(IndexerPreferences.KEY_INCLUDE_HEURISTICS);
boolean use= prop == null || TRUE.equals(prop); boolean use= prop == null || TRUE.equals(prop);
@ -187,6 +206,9 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
if (fAllHeadersAlt != null) { if (fAllHeadersAlt != null) {
props.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, String.valueOf(fAllHeadersAlt.getSelection())); props.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, String.valueOf(fAllHeadersAlt.getSelection()));
} }
if (fIndexOnOpen != null) {
props.put(IndexerPreferences.KEY_INDEX_ON_OPEN, String.valueOf(fIndexOnOpen.getSelection()));
}
if (fIncludeHeuristics != null) { if (fIncludeHeuristics != null) {
props.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(fIncludeHeuristics.getSelection())); props.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(fIncludeHeuristics.getSelection()));
} }
@ -289,6 +311,12 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
return result; return result;
} }
private Button createIndexOnOpenButton(Composite page) {
Button result= ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexOpenedFiles);
((GridData) result.getLayoutData()).horizontalSpan= 3;
return result;
}
private Button createIncludeHeuristicsButton(Composite page) { private Button createIncludeHeuristicsButton(Composite page) {
Button result= ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_heuristicIncludes); Button result= ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_heuristicIncludes);
((GridData) result.getLayoutData()).horizontalSpan= 3; ((GridData) result.getLayoutData()).horizontalSpan= 3;
@ -299,10 +327,10 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
IntegerFieldEditor result= new IntegerFieldEditor(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, DialogsMessages.AbstractIndexerPage_fileSizeLimit, group, 5); IntegerFieldEditor result= new IntegerFieldEditor(IndexerPreferences.KEY_SKIP_FILES_LARGER_THAN_MB, DialogsMessages.AbstractIndexerPage_fileSizeLimit, group, 5);
result.setValidRange(1, 100000); result.setValidRange(1, 100000);
ControlFactory.createLabel(group, DialogsMessages.CacheSizeBlock_MB); ControlFactory.createLabel(group, DialogsMessages.CacheSizeBlock_MB);
GridData gd = new GridData(); Text control = result.getTextControl(group);
gd.grabExcessHorizontalSpace= true; LayoutUtil.setWidthHint(control, pixelConverter.convertWidthInCharsToPixels(10));
gd.horizontalAlignment= GridData.FILL; LayoutUtil.setHorizontalGrabbing(control, false);
result.getLabelControl(group).setLayoutData(gd);
result.setPropertyChangeListener(validityChangeListener); result.setPropertyChangeListener(validityChangeListener);
return result; return result;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* IBM Corporation * IBM Corporation
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.dialogs; package org.eclipse.cdt.ui.dialogs;
@ -31,6 +32,8 @@ public class DialogsMessages extends NLS {
public static String AbstractIndexerPage_indexAllHeadersC; public static String AbstractIndexerPage_indexAllHeadersC;
/** @since 5.1 */ /** @since 5.1 */
public static String AbstractIndexerPage_indexAllHeadersCpp; public static String AbstractIndexerPage_indexAllHeadersCpp;
/** @since 5.3 */
public static String AbstractIndexerPage_indexOpenedFiles;
public static String AbstractIndexerPage_indexUpFront; public static String AbstractIndexerPage_indexUpFront;
public static String AbstractIndexerPage_skipAllReferences; public static String AbstractIndexerPage_skipAllReferences;
/** @since 5.1 */ /** @since 5.1 */
@ -41,6 +44,8 @@ public class DialogsMessages extends NLS {
public static String AbstractIndexerPage_skipMacroReferences; public static String AbstractIndexerPage_skipMacroReferences;
public static String CacheSizeBlock_MB; public static String CacheSizeBlock_MB;
public static String IndexerBlock_fixedBuildConfig; public static String IndexerBlock_fixedBuildConfig;
/** @since 5.3 */
public static String IndexerBlock_indexerOptions;
public static String IndexerStrategyBlock_activeBuildConfig; public static String IndexerStrategyBlock_activeBuildConfig;
public static String IndexerStrategyBlock_autoUpdate; public static String IndexerStrategyBlock_autoUpdate;
public static String IndexerStrategyBlock_buildConfigGroup; public static String IndexerStrategyBlock_buildConfigGroup;

View file

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2007, 2010 Wind River Systems, Inc. and others. # Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
@ -9,22 +9,24 @@
# Markus Schorn (Wind River Systems) # Markus Schorn (Wind River Systems)
# IBM Corporation # IBM Corporation
# Andrew Ferguson (Symbian) # Andrew Ferguson (Symbian)
# Sergey Prigogin (Google)
############################################################################### ###############################################################################
PreferenceScopeBlock_enableProjectSettings=Enable project specific settings 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_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_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)
AbstractIndexerPage_skipTypeReferences=Skip type references (Search for type 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_skipMacroReferences=Skip macro references (Search for macro references will not work)
AbstractIndexerPage_indexUpFront=Files to index up-front:
CacheSizeBlock_cacheLimitGroup=Cache limits 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:
@ -36,9 +38,10 @@ DocCommentOwnerBlock_EnableProjectSpecificSettings=Enable project specific setti
DocCommentOwnerBlock_SelectDocToolDescription=Select the documentation tool to be used to determine editor behaviors in this project DocCommentOwnerBlock_SelectDocToolDescription=Select the documentation tool to be used to determine editor behaviors in this project
DocCommentOwnerCombo_None=None DocCommentOwnerCombo_None=None
DocCommentOwnerComposite_DocumentationToolGroupTitle=Documentation tool comments DocCommentOwnerComposite_DocumentationToolGroupTitle=Documentation tool comments
IndexerBlock_fixedBuildConfig=Use a fixed build configuration
IndexerBlock_indexerOptions=Indexer options
IndexerStrategyBlock_strategyGroup=Indexing strategy IndexerStrategyBlock_strategyGroup=Indexing strategy
IndexerStrategyBlock_autoUpdate=Automatically update the index IndexerStrategyBlock_autoUpdate=Automatically update the index
IndexerBlock_fixedBuildConfig=Use a fixed build configuration
IndexerStrategyBlock_immediateUpdate=Update index immediately after every file-save IndexerStrategyBlock_immediateUpdate=Update index immediately after every file-save
IndexerStrategyBlock_buildConfigGroup=Build configuration for the indexer IndexerStrategyBlock_buildConfigGroup=Build configuration for the indexer
IndexerStrategyBlock_activeBuildConfig=Use active build configuration IndexerStrategyBlock_activeBuildConfig=Use active build configuration

View file

@ -72,7 +72,6 @@ public class IndexerBlock extends AbstractCOptionPage {
private static final String INDEXER_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.label" ); //$NON-NLS-1$ private static final String INDEXER_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.label" ); //$NON-NLS-1$
private static final String INDEXER_DESCRIPTION = CUIPlugin.getResourceString("BaseIndexerBlock.desc"); //$NON-NLS-1$ private static final String INDEXER_DESCRIPTION = CUIPlugin.getResourceString("BaseIndexerBlock.desc"); //$NON-NLS-1$
private static final String INDEXER_COMBO_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.comboLabel"); //$NON-NLS-1$
private PreferenceScopeBlock fPrefScopeBlock; private PreferenceScopeBlock fPrefScopeBlock;
private Button fEnableIndexer; private Button fEnableIndexer;
@ -187,7 +186,6 @@ public class IndexerBlock extends AbstractCOptionPage {
layout.marginWidth= 0; layout.marginWidth= 0;
gd= (GridData) fPreferenceContent.getLayoutData(); gd= (GridData) fPreferenceContent.getLayoutData();
gd.horizontalIndent= 0; gd.horizontalIndent= 0;
// add option to enable indexer // add option to enable indexer
final SelectionAdapter indexerChangeListener = new SelectionAdapter() { final SelectionAdapter indexerChangeListener = new SelectionAdapter() {
@ -199,13 +197,13 @@ public class IndexerBlock extends AbstractCOptionPage {
fEnableIndexer= ControlFactory.createCheckBox(fPreferenceContent, CUIPlugin.getResourceString("IndexerBlock.enable")); //$NON-NLS-1$ fEnableIndexer= ControlFactory.createCheckBox(fPreferenceContent, CUIPlugin.getResourceString("IndexerBlock.enable")); //$NON-NLS-1$
fEnableIndexer.addSelectionListener(indexerChangeListener); fEnableIndexer.addSelectionListener(indexerChangeListener);
// add combo to select indexer // Add a group for indexer options.
Group group= ControlFactory.createGroup(fPreferenceContent, INDEXER_COMBO_LABEL, 1); Group group= ControlFactory.createGroup(fPreferenceContent, DialogsMessages.IndexerBlock_indexerOptions, 1);
gd= (GridData) group.getLayoutData(); gd= (GridData) group.getLayoutData();
gd.grabExcessHorizontalSpace= true; gd.grabExcessHorizontalSpace= true;
if (fIndexerConfigMap.size() > 2) { if (fIndexerConfigMap.size() > 2) {
fIndexersComboBox = ControlFactory.createSelectCombo(group,"", ""); //$NON-NLS-1$ //$NON-NLS-2$ fIndexersComboBox = ControlFactory.createSelectCombo(group, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
fIndexersComboBox.addSelectionListener(indexerChangeListener); fIndexersComboBox.addSelectionListener(indexerChangeListener);
} }