1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 22:05:44 +02:00

Initial support for non-PDOM index fragments contributed through an

extension.
This commit is contained in:
Sergey Prigogin 2011-09-16 18:30:17 -07:00
parent 7a3c9ba3a1
commit 9972595fc7
13 changed files with 212 additions and 120 deletions

View file

@ -237,7 +237,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
ipm.reset(VERSION_405); ipm.startup(); ipm.reset(VERSION_405); ipm.startup();
ipm.addIndexProvider(provider1); ipm.addIndexProvider(provider2); ipm.addIndexProvider(provider1); ipm.addIndexProvider(provider2);
IIndexFragment[] actual = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); IIndexFragment[] actual = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(1, actual.length); assertEquals(1, actual.length);
assertFragmentPresent("contentID.contentA", "38", actual); assertFragmentPresent("contentID.contentA", "38", actual);
} finally { } finally {
@ -292,7 +292,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
ipm.reset(VERSION_502); ipm.startup(); ipm.reset(VERSION_502); ipm.startup();
ipm.addIndexProvider(provider1); ipm.addIndexProvider(provider2); ipm.addIndexProvider(provider1); ipm.addIndexProvider(provider2);
IIndexFragment[] actual = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); IIndexFragment[] actual = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(3, actual.length); assertEquals(3, actual.length);
assertFragmentPresent("contentID.foo", "90", actual); assertFragmentPresent("contentID.foo", "90", actual);
assertFragmentPresent("contentID.bar", "91", actual); assertFragmentPresent("contentID.bar", "91", actual);
@ -399,29 +399,29 @@ public class IndexProviderManagerTest extends IndexTestBase {
IIndexFragment[] fragments; IIndexFragment[] fragments;
mockState.setConfig(MockState.REL_V1_ID); mockState.setConfig(MockState.REL_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[0]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0]));
mockState.setConfig(MockState.DBG_V2_ID); mockState.setConfig(MockState.DBG_V2_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[3]));
mockState.setConfig(MockState.DBG_V1_ID); mockState.setConfig(MockState.DBG_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(0, fragments.length); assertEquals(0, fragments.length);
mockState.setConfig(MockState.REL_V2_ID); mockState.setConfig(MockState.REL_V2_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[1])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[1]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[1])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[1]));
mockState.setConfig(MockState.REL_V1_ID); mockState.setConfig(MockState.REL_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[0]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0]));
@ -429,29 +429,29 @@ public class IndexProviderManagerTest extends IndexTestBase {
provider1.invert(); provider1.invert();
mockState.setConfig(MockState.REL_V1_ID); mockState.setConfig(MockState.REL_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0]));
mockState.setConfig(MockState.DBG_V2_ID); mockState.setConfig(MockState.DBG_V2_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[0]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[3]));
mockState.setConfig(MockState.DBG_V1_ID); mockState.setConfig(MockState.DBG_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(1, fragments.length); assertEquals(1, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[1])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[1]));
mockState.setConfig(MockState.REL_V2_ID); mockState.setConfig(MockState.REL_V2_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(1, fragments.length); assertEquals(1, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[1])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[1]));
mockState.setConfig(MockState.REL_V1_ID); mockState.setConfig(MockState.REL_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0]));
@ -459,29 +459,29 @@ public class IndexProviderManagerTest extends IndexTestBase {
provider2.invert(); provider2.invert();
mockState.setConfig(MockState.REL_V1_ID); mockState.setConfig(MockState.REL_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[3]));
mockState.setConfig(MockState.DBG_V2_ID); mockState.setConfig(MockState.DBG_V2_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[0]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[0]));
mockState.setConfig(MockState.DBG_V1_ID); mockState.setConfig(MockState.DBG_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[1])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[1]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[1])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[1]));
mockState.setConfig(MockState.REL_V2_ID); mockState.setConfig(MockState.REL_V2_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(0, fragments.length); assertEquals(0, fragments.length);
mockState.setConfig(MockState.REL_V1_ID); mockState.setConfig(MockState.REL_V1_ID);
fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig()); fragments = ipm.getProvidedIndexFragments(mockState.getCurrentConfig(), true);
assertEquals(2, fragments.length); assertEquals(2, fragments.length);
assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider1.fragments[3]));
assertTrue(ArrayUtil.contains(fragments, provider2.fragments[3])); assertTrue(ArrayUtil.contains(fragments, provider2.fragments[3]));

View file

@ -305,7 +305,7 @@ public class PDOMProviderTests extends PDOMTestBase {
for(int i=0; i<3; i++) { for(int i=0; i<3; i++) {
// try several times in order to test the status is logged only once // try several times in order to test the status is logged only once
ICProjectDescription pd= CCorePlugin.getDefault().getProjectDescription(cproject2.getProject(), false); ICProjectDescription pd= CCorePlugin.getDefault().getProjectDescription(cproject2.getProject(), false);
assertEquals(0, ipm.getProvidedIndexFragments(pd.getActiveConfiguration()).length); assertEquals(0, ipm.getProvidedIndexFragments(pd.getActiveConfiguration(), true).length);
} }
} }

View file

@ -43,12 +43,22 @@ public interface IIndexManager extends IPDOMManager {
public final static int ADD_DEPENDENT = 0x2; public final static int ADD_DEPENDENT = 0x2;
/** /**
* Constant for passing to getIndex methods. This constant, when set, indicates * Constant for passing to getIndex methods. This constant, when set, indicates that the index
* that index content provided via the CIndex extension point should not be included * content provided via the CIndex extension point should not be included in the resulting
* in the resulting index, as it would have done otherwise. * index, as it would have done otherwise.
*/ */
public final static int SKIP_PROVIDED = 0x4; public final static int SKIP_PROVIDED = 0x4;
/**
* Constant for passing to getIndex methods. This constant, when set, indicates that the index
* content provided via the ReadOnlyIndexFragmentProvider element of the CIndex extension point
* should be included in the resulting index. By default such index content is not included.
* This flag is ignored if SKIP_PROVIDED flag is set.
*
* @since 5.4
*/
public final static int ADD_EXTENSION_FRAGMENTS = 0x8;
/** /**
* Constant for indicating there is no time out period for joining the indexer job. * Constant for indicating there is no time out period for joining the indexer job.
* @see IIndexManager#joinIndexer(int, IProgressMonitor) * @see IIndexManager#joinIndexer(int, IProgressMonitor)

View file

@ -20,7 +20,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -65,6 +64,14 @@ public class CIndex implements IIndex {
private int fReadLock; private int fReadLock;
private ICompositesFactory cppCF, cCF, fCF; private ICompositesFactory cppCF, cCF, fCF;
/**
* Creates an index consisting of one or more fragments.
*
* @param fragments Fragments constituting the index. If there are extended fragments,
* they are located in the array after the PDOM fragments for the same project.
* @param primaryFragmentCount The number of primary index fragments. This number may include
* extended fragments.
*/
public CIndex(IIndexFragment[] fragments, int primaryFragmentCount) { public CIndex(IIndexFragment[] fragments, int primaryFragmentCount) {
fFragments= fragments; fFragments= fragments;
fPrimaryFragmentCount= primaryFragmentCount; fPrimaryFragmentCount= primaryFragmentCount;
@ -109,7 +116,8 @@ public class CIndex implements IIndex {
IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][]; IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][];
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
try { try {
IBinding[] part = fFragments[i].findBindings(patterns, isFullyQualified, retargetFilter(linkage, filter), monitor); IBinding[] part = fFragments[i].findBindings(patterns, isFullyQualified,
retargetFilter(linkage, filter), monitor);
fragmentBindings[i] = new IIndexFragmentBinding[part.length]; fragmentBindings[i] = new IIndexFragmentBinding[part.length];
System.arraycopy(part, 0, fragmentBindings[i], 0, part.length); System.arraycopy(part, 0, fragmentBindings[i], 0, part.length);
} catch (CoreException e) { } catch (CoreException e) {
@ -171,29 +179,47 @@ public class CIndex implements IIndex {
binding= bindings[0]; binding= bindings[0];
} }
int fragCount= 0; // Maps a file location to -1 if the file belongs to an earlier index fragment,
// or to the index of the last checked index fragment plus one, if the file doesn't belong
// to any of the index fragments up to the last checked one.
HashMap<IIndexFileLocation, Integer> fileCheckCache = new HashMap<IIndexFileLocation, Integer>();
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
final IIndexFragmentName[] names = fFragments[i].findNames(binding, flags); IIndexFragment fragment = fFragments[i];
if (names.length > 0) { final IIndexFragmentName[] names = fragment.findNames(binding, flags);
result.addAll(Arrays.asList(names)); for (IIndexFragmentName name : names) {
fragCount++; IIndexFileLocation location = name.getFile().getLocation();
Integer checkState = fileCheckCache.get(location);
int checkOffset = checkState == null ? 0 : checkState.intValue();
if (checkOffset >= 0) {
for (; checkOffset < i; checkOffset++) {
IIndexFragment fragment2 = fFragments[checkOffset];
if (fragment2.getFiles(location).length != 0) {
checkOffset = -1;
break;
} }
} }
// bug 192352, files can reside in multiple fragments, remove duplicates fileCheckCache.put(location, Integer.valueOf(checkOffset));
if (fragCount > 1 || (flags & IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES) != 0) { }
HashMap<String, IIndexFile> fileMap= new HashMap<String, IIndexFile>(); if (checkOffset == i) {
for (Iterator<IIndexFragmentName> iterator = result.iterator(); iterator.hasNext();) { result.add(name);
final IIndexFragmentName name = iterator.next();
final IIndexFile file= name.getFile();
final String fileKey= name.getFile().getLocation().getURI().toString();
final IIndexFile otherFile= fileMap.get(fileKey);
if (otherFile == null) {
fileMap.put(fileKey, file);
} else if (!otherFile.equals(file)) { // same file in another fragment
iterator.remove();
} }
} }
} }
// // bug 192352, files can reside in multiple fragments, remove duplicates
// if (fragCount > 1 || (flags & IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES) != 0) {
// HashMap<String, IIndexFile> fileMap= new HashMap<String, IIndexFile>();
// for (Iterator<IIndexFragmentName> iterator = result.iterator(); iterator.hasNext();) {
// final IIndexFragmentName name = iterator.next();
// final IIndexFile file= name.getFile();
// final String fileKey= name.getFile().getLocation().getURI().toString();
// final IIndexFile otherFile= fileMap.get(fileKey);
// if (otherFile == null) {
// fileMap.put(fileKey, file);
// } else if (!otherFile.equals(file)) { // same file in another fragment
// iterator.remove();
// }
// }
// }
return result.toArray(new IIndexName[result.size()]); return result.toArray(new IIndexName[result.size()]);
} }
@ -436,8 +462,8 @@ public class CIndex implements IIndex {
IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][]; IIndexFragmentBinding[][] fragmentBindings = new IIndexFragmentBinding[fPrimaryFragmentCount][];
for (int i = 0; i < fPrimaryFragmentCount; i++) { for (int i = 0; i < fPrimaryFragmentCount; i++) {
try { try {
IBinding[] part = fFragments[i].findBindings(names, retargetFilter(linkage, filter), IBinding[] part = fFragments[i].findBindings(names,
new SubProgressMonitor(monitor, 1)); retargetFilter(linkage, filter), new SubProgressMonitor(monitor, 1));
fragmentBindings[i] = new IIndexFragmentBinding[part.length]; fragmentBindings[i] = new IIndexFragmentBinding[part.length];
System.arraycopy(part, 0, fragmentBindings[i], 0, part.length); System.arraycopy(part, 0, fragmentBindings[i], 0, part.length);
} catch (CoreException e) { } catch (CoreException e) {

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
@ -42,6 +43,7 @@ public class IndexFactory {
private static final int ADD_DEPENDENCIES = IIndexManager.ADD_DEPENDENCIES; private static final int ADD_DEPENDENCIES = IIndexManager.ADD_DEPENDENCIES;
private static final int ADD_DEPENDENT = IIndexManager.ADD_DEPENDENT; private static final int ADD_DEPENDENT = IIndexManager.ADD_DEPENDENT;
private static final int SKIP_PROVIDED = IIndexManager.SKIP_PROVIDED; private static final int SKIP_PROVIDED = IIndexManager.SKIP_PROVIDED;
private static final int ADD_EXTENSION_FRAGMENTS = IIndexManager.ADD_EXTENSION_FRAGMENTS;
private PDOMManager fPDOMManager; private PDOMManager fPDOMManager;
@ -55,6 +57,7 @@ public class IndexFactory {
boolean addDependencies= (options & ADD_DEPENDENCIES) != 0; boolean addDependencies= (options & ADD_DEPENDENCIES) != 0;
boolean addDependent= (options & ADD_DEPENDENT) != 0; boolean addDependent= (options & ADD_DEPENDENT) != 0;
boolean skipProvided= (options & SKIP_PROVIDED) != 0; boolean skipProvided= (options & SKIP_PROVIDED) != 0;
boolean addExtensionFragments= (options & ADD_EXTENSION_FRAGMENTS) != 0;
HashMap<IProject, Integer> map= new HashMap<IProject, Integer>(); HashMap<IProject, Integer> map= new HashMap<IProject, Integer>();
Collection<ICProject> selectedProjects= getProjects(projects, addDependencies, addDependent, Collection<ICProject> selectedProjects= getProjects(projects, addDependencies, addDependent,
@ -67,7 +70,7 @@ public class IndexFactory {
safeAddFragment(fragments, pdom); safeAddFragment(fragments, pdom);
if (!skipProvided) { if (!skipProvided) {
safeAddProvidedFragments(cproject, fragments); safeAddProvidedFragments(cproject, fragments, addExtensionFragments);
} }
} }
} }
@ -87,7 +90,7 @@ public class IndexFactory {
safeAddFragment(fragments, pdom); safeAddFragment(fragments, pdom);
if (!skipProvided) { if (!skipProvided) {
safeAddProvidedFragments(cproject, fragments); safeAddProvidedFragments(cproject, fragments, addExtensionFragments);
} }
} }
} }
@ -103,7 +106,7 @@ public class IndexFactory {
throw new CoreException(CCorePlugin.createStatus( throw new CoreException(CCorePlugin.createStatus(
NLS.bind(Messages.IndexFactory_errorNoSuchPDOM0, project.getElementName()))); NLS.bind(Messages.IndexFactory_errorNoSuchPDOM0, project.getElementName())));
} }
safeAddProvidedFragments(project, readOnlyFrag); safeAddProvidedFragments(project, readOnlyFrag, false);
Collection<ICProject> selectedProjects= getProjects(new ICProject[] {project}, true, false, Collection<ICProject> selectedProjects= getProjects(new ICProject[] {project}, true, false,
new HashMap<IProject, Integer>(), new Integer(1)); new HashMap<IProject, Integer>(), new Integer(1));
@ -201,19 +204,21 @@ public class IndexFactory {
} }
/** /**
* Adds ID -> IIndexFragment entries to the specified Map, for fragments provided under the * Adds ID -> IIndexFragment entries to the specified Map, for fragments provided under
* CIndex extension point for the specified ICProject * the CIndex extension point for the specified ICProject.
* @param cproject * @param cproject The project to get the provided index fragments for.
* @param fragments * @param fragments
* @param includeNonPDOMFragments
*/ */
private void safeAddProvidedFragments(ICProject cproject, Map<String, IIndexFragment> fragments) { private void safeAddProvidedFragments(ICProject cproject, Map<String, IIndexFragment> fragments,
boolean includeNonPDOMFragments) {
ICProjectDescription pd= CoreModel.getDefault().getProjectDescription(cproject.getProject(), false); ICProjectDescription pd= CoreModel.getDefault().getProjectDescription(cproject.getProject(), false);
if (pd != null) { if (pd != null) {
IndexProviderManager ipm = CCoreInternals.getPDOMManager().getIndexProviderManager(); IndexProviderManager ipm = CCoreInternals.getPDOMManager().getIndexProviderManager();
ICConfigurationDescription cfg= pd.getDefaultSettingConfiguration(); ICConfigurationDescription cfg= pd.getDefaultSettingConfiguration();
if (cfg != null) { if (cfg != null) {
try { try {
IIndexFragment[] pFragments= ipm.getProvidedIndexFragments(cfg); IIndexFragment[] pFragments= ipm.getProvidedIndexFragments(cfg, includeNonPDOMFragments);
for (IIndexFragment fragment : pFragments) { for (IIndexFragment fragment : pFragments) {
safeAddFragment(fragments, fragment); safeAddFragment(fragments, fragment);
} }

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.provider; package org.eclipse.cdt.internal.core.index.provider;
@ -64,9 +65,11 @@ import java.util.Set;
*/ */
public final class IndexProviderManager implements IElementChangedListener { public final class IndexProviderManager implements IElementChangedListener {
private static final String ELEMENT_RO_PDOM_PROVIDER= "ReadOnlyPDOMProvider"; //$NON-NLS-1$ private static final String ELEMENT_RO_PDOM_PROVIDER= "ReadOnlyPDOMProvider"; //$NON-NLS-1$
private static final String ELEMENT_RO_INDEX_FRAGMENT_PROVIDER= "ReadOnlyIndexFragmentProvider"; //$NON-NLS-1$
private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$ private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
private IIndexFragmentProvider[] allProviders; private IIndexFragmentProvider[] pdomFragmentProviders;
private IIndexFragmentProvider[] nonPDOMFragmentProviders;
private Map<ProvisionMapKey, Boolean> provisionMap; private Map<ProvisionMapKey, Boolean> provisionMap;
private Set<String> compatibleFragmentUnavailable; private Set<String> compatibleFragmentUnavailable;
private VersionRange pdomVersionRange; private VersionRange pdomVersionRange;
@ -89,14 +92,15 @@ public final class IndexProviderManager implements IElementChangedListener {
* @param pdomVersionRange * @param pdomVersionRange
*/ */
public void reset(VersionRange pdomVersionRange) { public void reset(VersionRange pdomVersionRange) {
this.allProviders= new IIndexFragmentProvider[0]; this.pdomFragmentProviders= new IIndexFragmentProvider[0];
this.provisionMap= new HashMap<ProvisionMapKey,Boolean>(); this.provisionMap= new HashMap<ProvisionMapKey, Boolean>();
this.pdomVersionRange= pdomVersionRange; this.pdomVersionRange= pdomVersionRange;
this.compatibleFragmentUnavailable= new HashSet<String>(); this.compatibleFragmentUnavailable= new HashSet<String>();
} }
public void startup() { public void startup() {
List<IIndexFragmentProvider> providers = new ArrayList<IIndexFragmentProvider>(); List<IIndexFragmentProvider> pdomProviders = new ArrayList<IIndexFragmentProvider>();
List<IIndexFragmentProvider> nonPDOMProviders = new ArrayList<IIndexFragmentProvider>();
IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint indexProviders = registry.getExtensionPoint(CCorePlugin.INDEX_UNIQ_ID); IExtensionPoint indexProviders = registry.getExtensionPoint(CCorePlugin.INDEX_UNIQ_ID);
for (IExtension extension : indexProviders.getExtensions()) { for (IExtension extension : indexProviders.getExtensions()) {
@ -106,7 +110,16 @@ public final class IndexProviderManager implements IElementChangedListener {
Object provider = element.createExecutableExtension(ATTRIBUTE_CLASS); Object provider = element.createExecutableExtension(ATTRIBUTE_CLASS);
if (provider instanceof IReadOnlyPDOMProvider) { if (provider instanceof IReadOnlyPDOMProvider) {
providers.add(new ReadOnlyPDOMProviderBridge((IReadOnlyPDOMProvider) provider)); pdomProviders.add(new ReadOnlyPDOMProviderBridge((IReadOnlyPDOMProvider) provider));
} else {
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_0,
extension.getContributor().getName()));
}
} else if (ELEMENT_RO_INDEX_FRAGMENT_PROVIDER.equals(element.getName())) {
Object provider = element.createExecutableExtension(ATTRIBUTE_CLASS);
if (provider instanceof IIndexFragmentProvider) {
nonPDOMProviders.add((IIndexFragmentProvider) provider);
} else { } else {
CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_0, CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_0,
extension.getContributor().getName())); extension.getContributor().getName()));
@ -119,7 +132,8 @@ public final class IndexProviderManager implements IElementChangedListener {
} }
CoreModel.getDefault().addElementChangedListener(this); CoreModel.getDefault().addElementChangedListener(this);
this.allProviders = providers.toArray(new IIndexFragmentProvider[providers.size()]); this.pdomFragmentProviders = pdomProviders.toArray(new IIndexFragmentProvider[pdomProviders.size()]);
this.nonPDOMFragmentProviders = nonPDOMProviders.toArray(new IIndexFragmentProvider[nonPDOMProviders.size()]);
} }
/** /**
@ -130,11 +144,16 @@ public final class IndexProviderManager implements IElementChangedListener {
* @param config * @param config
* @return the array of IIndexFragment objects for the current state * @return the array of IIndexFragment objects for the current state
*/ */
public IIndexFragment[] getProvidedIndexFragments(ICConfigurationDescription config) throws CoreException { public IIndexFragment[] getProvidedIndexFragments(ICConfigurationDescription config,
boolean includeNonPDOMFragments) throws CoreException {
Map<String, IIndexFragment> id2fragment = new HashMap<String, IIndexFragment>(); Map<String, IIndexFragment> id2fragment = new HashMap<String, IIndexFragment>();
IProject project= config.getProjectDescription().getProject(); IProject project= config.getProjectDescription().getProject();
for (IIndexFragmentProvider provider : allProviders) { IIndexFragmentProvider[][] groups = includeNonPDOMFragments ?
new IIndexFragmentProvider[][] { pdomFragmentProviders, nonPDOMFragmentProviders } :
new IIndexFragmentProvider[][] { pdomFragmentProviders };
for (IIndexFragmentProvider[] group : groups) {
for (IIndexFragmentProvider provider : group) {
try { try {
if (providesForProject(provider, project)) { if (providesForProject(provider, project)) {
IIndexFragment[] fragments= provider.getIndexFragments(config); IIndexFragment[] fragments= provider.getIndexFragments(config);
@ -152,6 +171,7 @@ public final class IndexProviderManager implements IElementChangedListener {
CCorePlugin.log(e); // move to next provider CCorePlugin.log(e); // move to next provider
} }
} }
}
// Make log entries for any fragments which have no compatible equivalents // Make log entries for any fragments which have no compatible equivalents
List<IIndexFragment> preresult= new ArrayList<IIndexFragment>(); List<IIndexFragment> preresult= new ArrayList<IIndexFragment>();
@ -176,15 +196,12 @@ public final class IndexProviderManager implements IElementChangedListener {
* @param formatID * @param formatID
*/ */
private VersionRange getCurrentlySupportedVersionRangeForFormat(String formatID) { private VersionRange getCurrentlySupportedVersionRangeForFormat(String formatID) {
/* if (PDOM.FRAGMENT_PROPERTY_VALUE_FORMAT_ID.equals(formatID)) {
* TODO - at the point we support alternate IIndexFragment implementations, this method will need
* to be altered to lookup version ranges for the contributed format via an extension point.
*/
if (!PDOM.FRAGMENT_PROPERTY_VALUE_FORMAT_ID.equals(formatID)) {
throw new IllegalArgumentException("Non-PDOM formats are currently unsupported"); //$NON-NLS-1$
}
return pdomVersionRange; return pdomVersionRange;
} }
// Version range checks do not apply to non-PDOM IIndexFragments.
return null;
}
/** /**
* Examines the candidate fragment, adding it to the map (using its fragment id as key) if * Examines the candidate fragment, adding it to the map (using its fragment id as key) if
@ -209,7 +226,8 @@ public final class IndexProviderManager implements IElementChangedListener {
Version cver= Version.parseVersion(csver); // illegal argument exception Version cver= Version.parseVersion(csver); // illegal argument exception
IIndexFragment existing= id2fragment.get(cid); IIndexFragment existing= id2fragment.get(cid);
if (getCurrentlySupportedVersionRangeForFormat(cformatID).isIncluded(cver)) { VersionRange versionRange = getCurrentlySupportedVersionRangeForFormat(cformatID);
if (versionRange == null || versionRange.isIncluded(cver)) {
if (existing != null) { if (existing != null) {
String esver= null, eformatID= null; String esver= null, eformatID= null;
existing.acquireReadLock(); existing.acquireReadLock();
@ -243,6 +261,8 @@ public final class IndexProviderManager implements IElementChangedListener {
} }
/** /**
* Adds a PDOM-based index fragment provider.
*
* <b>Note: This method should not be called for purposes other than testing</b> * <b>Note: This method should not be called for purposes other than testing</b>
* @param provider * @param provider
*/ */
@ -256,23 +276,25 @@ public final class IndexProviderManager implements IElementChangedListener {
return; return;
} }
IIndexFragmentProvider[] newAllProviders = new IIndexFragmentProvider[allProviders.length + 1]; IIndexFragmentProvider[] newAllProviders = new IIndexFragmentProvider[pdomFragmentProviders.length + 1];
System.arraycopy(allProviders, 0, newAllProviders, 0, allProviders.length); System.arraycopy(pdomFragmentProviders, 0, newAllProviders, 0, pdomFragmentProviders.length);
newAllProviders[allProviders.length] = (IIndexFragmentProvider) provider; newAllProviders[pdomFragmentProviders.length] = (IIndexFragmentProvider) provider;
allProviders = newAllProviders; pdomFragmentProviders = newAllProviders;
} }
/** /**
* Removes the specified provider by object identity * Removes the specified provider by object identity. Only a PDOM-based provider can be removed
* using this method.
*
* <b>Note: This method should not be called for purposes other than testing</b> * <b>Note: This method should not be called for purposes other than testing</b>
* @param provider * @param provider
*/ */
public void removeIndexProvider(IIndexProvider provider) { public void removeIndexProvider(IIndexProvider provider) {
ArrayUtil.remove(allProviders, provider); ArrayUtil.remove(pdomFragmentProviders, provider);
if (allProviders[allProviders.length - 1] == null) { if (pdomFragmentProviders[pdomFragmentProviders.length - 1] == null) {
IIndexFragmentProvider[] newAllProviders = new IIndexFragmentProvider[allProviders.length - 1]; IIndexFragmentProvider[] newAllProviders = new IIndexFragmentProvider[pdomFragmentProviders.length - 1];
System.arraycopy(allProviders, 0, newAllProviders, 0, allProviders.length - 1); System.arraycopy(pdomFragmentProviders, 0, newAllProviders, 0, pdomFragmentProviders.length - 1);
allProviders= newAllProviders; pdomFragmentProviders= newAllProviders;
} }
} }

View file

@ -1589,9 +1589,6 @@ public class PDOM extends PlatformObject implements IPDOM {
} }
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.index.IIndexFragment#getInlineNamespaces()
*/
public IIndexScope[] getInlineNamespaces() throws CoreException { public IIndexScope[] getInlineNamespaces() throws CoreException {
PDOMLinkage linkage = getLinkage(ILinkage.CPP_LINKAGE_ID); PDOMLinkage linkage = getLinkage(ILinkage.CPP_LINKAGE_ID);
if (linkage == null) { if (linkage == null) {

View file

@ -314,9 +314,6 @@ public class PDOMProxy implements IPDOM {
fDelegate.clearResultCache(); fDelegate.clearResultCache();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.index.IIndexFragment#getInlineNamespaces()
*/
public IIndexScope[] getInlineNamespaces() throws CoreException { public IIndexScope[] getInlineNamespaces() throws CoreException {
if (fDelegate != null) if (fDelegate != null)
return fDelegate.getInlineNamespaces(); return fDelegate.getInlineNamespaces();

View file

@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE --> <!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.cdt.core"> <schema targetNamespace="org.eclipse.cdt.core" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation> <annotation>
<appInfo> <appInfo>
<meta.schema plugin="org.eclipse.cdt.core" id="CIndex" name="CIndex"/> <meta.schema plugin="org.eclipse.cdt.core" id="CIndex" name="CIndex"/>
@ -11,10 +11,16 @@
</annotation> </annotation>
<element name="extension"> <element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType> <complexType>
<choice minOccurs="1" maxOccurs="unbounded"> <choice minOccurs="1" maxOccurs="unbounded">
<element ref="ExportProjectProvider"/> <element ref="ExportProjectProvider"/>
<element ref="ReadOnlyPDOMProvider"/> <element ref="ReadOnlyPDOMProvider"/>
<element ref="ReadOnlyIndexFragmentProvider"/>
</choice> </choice>
<attribute name="point" type="string" use="required"> <attribute name="point" type="string" use="required">
<annotation> <annotation>
@ -156,16 +162,51 @@ public class AcmeSDKProvider implements IReadOnlyPDOMProvider {
<attribute name="class" type="string" use="required"> <attribute name="class" type="string" use="required">
<annotation> <annotation>
<documentation> <documentation>
the fully qualified name of the IReadOnlyPDOMProvider implementation to register The fully qualified name of the IReadOnlyPDOMProvider implementation to register
</documentation> </documentation>
<appInfo> <appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.core.index.provider.IReadOnlyPDOMProvider"/> <meta.attribute kind="java" basedOn=":org.eclipse.cdt.core.index.provider.IReadOnlyPDOMProvider"/>
</appInfo> </appInfo>
</annotation> </annotation>
</attribute> </attribute>
</complexType> </complexType>
</element> </element>
<element name="ReadOnlyIndexFragmentProvider">
<annotation>
<documentation>
&lt;h2&gt;ReadOnlyIndexFragmentProvider&lt;/h2&gt;
&lt;p&gt;
This subelement of CIndex allows ISVs to contribute read-only index fragments to the CDT Index. This extension point imposes no limitations on how the index information is collected and stored. The index fragments may, for example, be based on data dynamically fetched from a remote server.
&lt;p&gt;
The only information needed for this extension point is the fully qualified name of a class implementing the org.eclipse.cdt.core.index.IIndexFragmentProvider interface. This class will be consulted during the eclipse session for the appropriate read-only content to add to the logical index. The logical index is accessible via the org.eclipse.core.index.IIndex API.
</documentation>
</annotation>
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
The fully qualified name of a class implementing IIndexFragmentProvider interface.
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.internal.core.index.provider.IIndexFragmentProvider"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
Index content provided by ISVs under this extension point will be accessible via the logical index org.eclipse.core.index.IIndex API
For export functionality, see package org.eclipse.cdt.core.index.export
</documentation>
</annotation>
<annotation> <annotation>
<appInfo> <appInfo>
<meta.section type="since"/> <meta.section type="since"/>
@ -184,23 +225,12 @@ public class AcmeSDKProvider implements IReadOnlyPDOMProvider {
</documentation> </documentation>
</annotation> </annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
Index content provided by ISVs under this extension point will be accessible via the logical index org.eclipse.core.index.IIndex API
For export functionality, see package org.eclipse.cdt.core.index.export
</documentation>
</annotation>
<annotation> <annotation>
<appInfo> <appInfo>
<meta.section type="implementation"/> <meta.section type="implementation"/>
</appInfo> </appInfo>
<documentation> <documentation>
[Enter information about supplied implementation of this extension point.] See subelement documentation
</documentation> </documentation>
</annotation> </annotation>
@ -209,7 +239,7 @@ For export functionality, see package org.eclipse.cdt.core.index.export
<meta.section type="copyright"/> <meta.section type="copyright"/>
</appInfo> </appInfo>
<documentation> <documentation>
Copyright (c) 2007 Symbian Software Systems and others. Copyright (c) 2007, 2011 Symbian Software Systems 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

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2009 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
@ -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.ui.callhierarchy; package org.eclipse.cdt.internal.ui.callhierarchy;
@ -23,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexFile;
import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.index.IIndexName; import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
@ -150,7 +152,7 @@ public class CHContentProvider extends AsyncTreeContentProvider {
private Object[] asyncronouslyComputeReferencedBy(CHNode parent) throws CoreException, InterruptedException { private Object[] asyncronouslyComputeReferencedBy(CHNode parent) throws CoreException, InterruptedException {
ICProject[] scope= CoreModel.getDefault().getCModel().getCProjects(); ICProject[] scope= CoreModel.getDefault().getCModel().getCProjects();
IIndex index= CCorePlugin.getIndexManager().getIndex(scope); IIndex index= CCorePlugin.getIndexManager().getIndex(scope, IIndexManager.ADD_EXTENSION_FRAGMENTS);
index.acquireReadLock(); index.acquireReadLock();
try { try {
return CHQueries.findCalledBy(this, parent, index, NPM); return CHQueries.findCalledBy(this, parent, index, NPM);
@ -161,7 +163,7 @@ public class CHContentProvider extends AsyncTreeContentProvider {
private Object[] asyncronouslyComputeRefersTo(CHNode parent) throws CoreException, InterruptedException { private Object[] asyncronouslyComputeRefersTo(CHNode parent) throws CoreException, InterruptedException {
ICProject[] scope= CoreModel.getDefault().getCModel().getCProjects(); ICProject[] scope= CoreModel.getDefault().getCModel().getCProjects();
IIndex index= CCorePlugin.getIndexManager().getIndex(scope); IIndex index= CCorePlugin.getIndexManager().getIndex(scope, IIndexManager.ADD_EXTENSION_FRAGMENTS);
index.acquireReadLock(); index.acquireReadLock();
try { try {
return CHQueries.findCalls(this, parent, index, NPM); return CHQueries.findCalls(this, parent, index, NPM);

View file

@ -56,6 +56,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexFile;
import org.eclipse.cdt.core.index.IIndexFileLocation; import org.eclipse.cdt.core.index.IIndexFileLocation;
import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.index.IIndexName; import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.core.index.IndexLocationFactory; import org.eclipse.cdt.core.index.IndexLocationFactory;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
@ -487,7 +488,8 @@ public abstract class PDOMSearchQuery implements ISearchQuery {
result.setIndexerBusy(!CCorePlugin.getIndexManager().isIndexerIdle()); result.setIndexerBusy(!CCorePlugin.getIndexManager().isIndexerIdle());
try { try {
IIndex index= CCorePlugin.getIndexManager().getIndex(projects, 0); IIndex index= CCorePlugin.getIndexManager().getIndex(projects,
IIndexManager.ADD_EXTENSION_FRAGMENTS);
try { try {
index.acquireReadLock(); index.acquireReadLock();
} catch (InterruptedException e) { } catch (InterruptedException e) {

View file

@ -71,7 +71,7 @@ public class PDOMSearchTextSelectionQuery extends PDOMSearchQuery {
return Status.OK_STATUS; return Status.OK_STATUS;
} }
} }
binding = index.findBinding(searchName); binding = ast.getIndex().findBinding(searchName);
binding= CPPTemplates.findDeclarationForSpecialization(binding); binding= CPPTemplates.findDeclarationForSpecialization(binding);
if (binding != null) { if (binding != null) {
label= labelForBinding(index, binding, label); label= labelForBinding(index, binding, label);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 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
@ -26,6 +26,7 @@ import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.model.CoreModel; 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;
@ -53,7 +54,7 @@ class THHierarchyModel {
static final int END_OF_COMPUTATION = 0; static final int END_OF_COMPUTATION = 0;
private static final ISchedulingRule RULE = new THSchedulingRule(); private static final ISchedulingRule RULE = new THSchedulingRule();
private static final Object[] NO_CHILDREN= new Object[0]; private static final Object[] NO_CHILDREN= {};
private ICElement fInput; private ICElement fInput;
private int fHierarchyKind; private int fHierarchyKind;
@ -148,7 +149,7 @@ class THHierarchyModel {
THGraph graph= new THGraph(); THGraph graph= new THGraph();
try { try {
ICProject[] scope= CoreModel.getDefault().getCModel().getCProjects(); ICProject[] scope= CoreModel.getDefault().getCModel().getCProjects();
IIndex index= CCorePlugin.getIndexManager().getIndex(scope); IIndex index= CCorePlugin.getIndexManager().getIndex(scope, IIndexManager.ADD_EXTENSION_FRAGMENTS);
index.acquireReadLock(); index.acquireReadLock();
try { try {
if (monitor.isCanceled()) if (monitor.isCanceled())