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

Removed unnecessary changes against master

This commit is contained in:
Andrew Gvozdev 2011-12-17 07:03:20 -05:00
parent bbec91c5bc
commit 2559c118ec
4 changed files with 134 additions and 199 deletions

View file

@ -75,7 +75,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
final static Class DP4= Providers.Dummy4.class; final static Class DP4= Providers.Dummy4.class;
final static Class DP5= Providers.Dummy5.class; final static Class DP5= Providers.Dummy5.class;
final static Class[] DPS= new Class[] {DP4, DP2, DP1, DP3, DP5}; final static Class[] DPS= new Class[] {DP4, DP2, DP1, DP3, DP5};
/* /*
* Fictional compatibility ranges for testing * Fictional compatibility ranges for testing
*/ */
@ -83,9 +83,9 @@ public class IndexProviderManagerTest extends IndexTestBase {
final static VersionRange VERSION_401= new VersionRange("[36,37]"); final static VersionRange VERSION_401= new VersionRange("[36,37]");
final static VersionRange VERSION_405= new VersionRange("[37,39]"); final static VersionRange VERSION_405= new VersionRange("[37,39]");
final static VersionRange VERSION_502= new VersionRange("[89,91]"); final static VersionRange VERSION_502= new VersionRange("[89,91]");
final CCorePlugin core= CCorePlugin.getDefault(); final CCorePlugin core= CCorePlugin.getDefault();
public IndexProviderManagerTest() { public IndexProviderManagerTest() {
super("IndexProviderManagerTest"); super("IndexProviderManagerTest");
} }
@ -106,11 +106,11 @@ public class IndexProviderManagerTest extends IndexTestBase {
IndexProviderManager ipm= ((PDOMManager)CCorePlugin.getIndexManager()).getIndexProviderManager(); IndexProviderManager ipm= ((PDOMManager)CCorePlugin.getIndexManager()).getIndexProviderManager();
ipm.reset(); ipm.startup(); ipm.reset(); ipm.startup();
} }
public void testProvider_SimpleLifeCycle_200958() throws Exception { public void testProvider_SimpleLifeCycle_200958() throws Exception {
for (Class element : DPS) for (Class element : DPS)
DPT.reset(element); DPT.reset(element);
List cprojects = new ArrayList(), expectedTrace = new ArrayList(); List cprojects = new ArrayList(), expectedTrace = new ArrayList();
try { try {
for(int i=0; i<3; i++) { for(int i=0; i<3; i++) {
@ -137,7 +137,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
public void testProvider_OverDeleteAndAdd() throws Exception { public void testProvider_OverDeleteAndAdd() throws Exception {
DPT.reset(DP1); DPT.reset(DP1);
List expectedTrace = new ArrayList(); List expectedTrace = new ArrayList();
ICProject cproject = null; ICProject cproject = null;
try { try {
@ -180,7 +180,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
File newLocation = CProjectHelper.freshDir(); File newLocation = CProjectHelper.freshDir();
IProjectDescription description = cproject.getProject().getDescription(); IProjectDescription description = cproject.getProject().getDescription();
description.setLocationURI(newLocation.toURI()); description.setLocationURI(newLocation.toURI());
cproject.getProject().move(description, IResource.FORCE | IResource.SHALLOW, new NullProgressMonitor()); cproject.getProject().move(description, IResource.FORCE | IResource.SHALLOW, new NullProgressMonitor());
index = CCorePlugin.getIndexManager().getIndex(cproject); index = CCorePlugin.getIndexManager().getIndex(cproject);
assertEquals(expectedTrace, DPT.getProjectsTrace(DP1)); assertEquals(expectedTrace, DPT.getProjectsTrace(DP1));
@ -190,19 +190,19 @@ public class IndexProviderManagerTest extends IndexTestBase {
} }
} }
} }
public void testVersioning_IncompatibleIgnored() throws Exception { public void testVersioning_IncompatibleIgnored() throws Exception {
IndexProviderManager ipm= ((PDOMManager)CCorePlugin.getIndexManager()).getIndexProviderManager(); IndexProviderManager ipm= ((PDOMManager)CCorePlugin.getIndexManager()).getIndexProviderManager();
ICProject cproject = null; ICProject cproject = null;
try { try {
cproject= CProjectHelper.createCCProject("IndexFactoryConfigurationUsageTest", IPDOMManager.ID_NO_INDEXER); cproject= CProjectHelper.createCCProject("IndexFactoryConfigurationUsageTest", IPDOMManager.ID_NO_INDEXER);
IProject project= cproject.getProject(); IProject project= cproject.getProject();
MockState mockState = new MockState(cproject); MockState mockState = new MockState(cproject);
mockState.setConfig(MockState.REL_V1_ID); mockState.setConfig(MockState.REL_V1_ID);
IIndexProvider provider1= new IIndexFragmentProvider() { IIndexProvider provider1= new IIndexFragmentProvider() {
IIndexFragment[] fragments= new IIndexFragment[] { IIndexFragment[] fragments= new IIndexFragment[] {
new MockPDOM("contentID.contentA", "36"), new MockPDOM("contentID.contentA", "36"),
@ -211,11 +211,9 @@ public class IndexProviderManagerTest extends IndexTestBase {
new MockPDOM("contentID.bar", "91"), new MockPDOM("contentID.bar", "91"),
new MockPDOM("contentID.baz", "89") new MockPDOM("contentID.baz", "89")
}; };
@Override
public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) { public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) {
return fragments; return fragments;
} }
@Override
public boolean providesFor(ICProject project) throws CoreException { public boolean providesFor(ICProject project) throws CoreException {
return true; return true;
} }
@ -225,22 +223,20 @@ public class IndexProviderManagerTest extends IndexTestBase {
new MockPDOM("contentID.baz", "90"), new MockPDOM("contentID.baz", "90"),
new MockPDOM("contentID.contentA", "38"), new MockPDOM("contentID.contentA", "38"),
}; };
@Override
public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) { public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) {
return fragments; return fragments;
} }
@Override
public boolean providesFor(ICProject project) throws CoreException { public boolean providesFor(ICProject project) throws CoreException {
return true; return true;
} }
}; };
CCorePlugin.getIndexManager().joinIndexer(8000, npm()); // ensure IPM is called only once under test conditions CCorePlugin.getIndexManager().joinIndexer(8000, npm()); // ensure IPM is called only once under test conditions
setExpectedNumberOfLoggedNonOKStatusObjects(3); // foo, bar and baz have no compatible fragments available setExpectedNumberOfLoggedNonOKStatusObjects(3); // foo, bar and baz have no compatible fragments available
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(), true); 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);
@ -250,19 +246,19 @@ public class IndexProviderManagerTest extends IndexTestBase {
} }
} }
} }
public void testVersioning_NoCompatibleVersionsFound() throws Exception { public void testVersioning_NoCompatibleVersionsFound() throws Exception {
IndexProviderManager ipm= ((PDOMManager)CCorePlugin.getIndexManager()).getIndexProviderManager(); IndexProviderManager ipm= ((PDOMManager)CCorePlugin.getIndexManager()).getIndexProviderManager();
ICProject cproject = null; ICProject cproject = null;
try { try {
cproject= CProjectHelper.createCCProject("IndexFactoryConfigurationUsageTest", IPDOMManager.ID_NO_INDEXER); cproject= CProjectHelper.createCCProject("IndexFactoryConfigurationUsageTest", IPDOMManager.ID_NO_INDEXER);
IProject project= cproject.getProject(); IProject project= cproject.getProject();
MockState mockState = new MockState(cproject); MockState mockState = new MockState(cproject);
mockState.setConfig(MockState.REL_V1_ID); mockState.setConfig(MockState.REL_V1_ID);
IIndexProvider provider1= new IIndexFragmentProvider() { IIndexProvider provider1= new IIndexFragmentProvider() {
IIndexFragment[] fragments= new IIndexFragment[] { IIndexFragment[] fragments= new IIndexFragment[] {
new MockPDOM("contentID.contentA", "36"), new MockPDOM("contentID.contentA", "36"),
@ -271,11 +267,9 @@ public class IndexProviderManagerTest extends IndexTestBase {
new MockPDOM("contentID.bar", "91"), new MockPDOM("contentID.bar", "91"),
new MockPDOM("contentID.baz", "89") new MockPDOM("contentID.baz", "89")
}; };
@Override
public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) { public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) {
return fragments; return fragments;
} }
@Override
public boolean providesFor(ICProject project) throws CoreException { public boolean providesFor(ICProject project) throws CoreException {
return true; return true;
} }
@ -284,22 +278,20 @@ public class IndexProviderManagerTest extends IndexTestBase {
IIndexFragment[] fragments= new IIndexFragment[] { IIndexFragment[] fragments= new IIndexFragment[] {
new MockPDOM("contentID.contentA", "41"), new MockPDOM("contentID.contentA", "41"),
}; };
@Override
public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) { public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) {
return fragments; return fragments;
} }
@Override
public boolean providesFor(ICProject project) throws CoreException { public boolean providesFor(ICProject project) throws CoreException {
return true; return true;
} }
}; };
CCorePlugin.getIndexManager().joinIndexer(8000, npm()); // ensure IPM is called only once under test conditions CCorePlugin.getIndexManager().joinIndexer(8000, npm()); // ensure IPM is called only once under test conditions
setExpectedNumberOfLoggedNonOKStatusObjects(1); // contentA has no compatible fragments available setExpectedNumberOfLoggedNonOKStatusObjects(1); // contentA has no compatible fragments available
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(), true); 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);
@ -311,7 +303,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
} }
} }
} }
private void assertFragmentPresent(String id, String version, IIndexFragment[] fragments) throws Exception { private void assertFragmentPresent(String id, String version, IIndexFragment[] fragments) throws Exception {
for (IIndexFragment candidate : fragments) { for (IIndexFragment candidate : fragments) {
String cid= null, csver= null; String cid= null, csver= null;
@ -327,49 +319,49 @@ public class IndexProviderManagerTest extends IndexTestBase {
} }
fail("Fragment matching (id="+id+",version="+version+") was not present"); fail("Fragment matching (id="+id+",version="+version+") was not present");
} }
public void testIndexFactoryConfigurationUsage() throws Exception { public void testIndexFactoryConfigurationUsage() throws Exception {
IIndex index; IIndex index;
ICProject cproject = null; ICProject cproject = null;
// Modifying the .project file triggers an indexer job, suppress that: // Modifying the .project file triggers an indexer job, suppress that:
DeltaAnalyzer.sSuppressPotentialTUs= true; DeltaAnalyzer.sSuppressPotentialTUs= true;
try { try {
cproject = CProjectHelper.createCCProject("IndexFactoryConfigurationUsageTest", IPDOMManager.ID_NO_INDEXER); cproject = CProjectHelper.createCCProject("IndexFactoryConfigurationUsageTest", IPDOMManager.ID_NO_INDEXER);
IProject project= cproject.getProject(); IProject project= cproject.getProject();
ICProjectDescription pd= core.getProjectDescription(project); ICProjectDescription pd= core.getProjectDescription(project);
ICConfigurationDescription cfg1= newCfg(pd, "project", "config1"); ICConfigurationDescription cfg1= newCfg(pd, "project", "config1");
ICConfigurationDescription cfg2= newCfg(pd, "project", "config2"); ICConfigurationDescription cfg2= newCfg(pd, "project", "config2");
core.setProjectDescription(project, pd); core.setProjectDescription(project, pd);
index= CCorePlugin.getIndexManager().getIndex(cproject); index= CCorePlugin.getIndexManager().getIndex(cproject);
CCorePlugin.getIndexManager().joinIndexer(8000, npm()); CCorePlugin.getIndexManager().joinIndexer(8000, npm());
DPT.reset(DP1); DPT.reset(DP1);
changeConfigRelations(project, ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE); changeConfigRelations(project, ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE);
assertEquals(0, DPT.getProjectsTrace(DP1).size()); assertEquals(0, DPT.getProjectsTrace(DP1).size());
assertEquals(0, DPT.getCfgsTrace(DP1).size()); assertEquals(0, DPT.getCfgsTrace(DP1).size());
changeActiveConfiguration(project, cfg1); changeActiveConfiguration(project, cfg1);
DPT.reset(DP1); DPT.reset(DP1);
index= CCorePlugin.getIndexManager().getIndex(cproject); index= CCorePlugin.getIndexManager().getIndex(cproject);
assertEquals(0, DPT.getProjectsTrace(DP1).size()); assertEquals(0, DPT.getProjectsTrace(DP1).size());
assertEquals(1, DPT.getCfgsTrace(DP1).size()); assertEquals(1, DPT.getCfgsTrace(DP1).size());
assertEquals("project.config1", ((ICConfigurationDescription)DPT.getCfgsTrace(DP1).get(0)).getId()); assertEquals("project.config1", ((ICConfigurationDescription)DPT.getCfgsTrace(DP1).get(0)).getId());
changeActiveConfiguration(project, cfg2); changeActiveConfiguration(project, cfg2);
DPT.reset(DP1); DPT.reset(DP1);
index= CCorePlugin.getIndexManager().getIndex(cproject); index= CCorePlugin.getIndexManager().getIndex(cproject);
assertEquals(0, DPT.getProjectsTrace(DP1).size()); assertEquals(0, DPT.getProjectsTrace(DP1).size());
assertEquals(1, DPT.getCfgsTrace(DP1).size()); assertEquals(1, DPT.getCfgsTrace(DP1).size());
assertEquals("project.config2", ((ICConfigurationDescription)DPT.getCfgsTrace(DP1).get(0)).getId()); assertEquals("project.config2", ((ICConfigurationDescription)DPT.getCfgsTrace(DP1).get(0)).getId());
DPT.reset(DP1); DPT.reset(DP1);
changeConfigRelations(project, ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT); changeConfigRelations(project, ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT);
assertEquals(0, DPT.getProjectsTrace(DP1).size()); assertEquals(0, DPT.getProjectsTrace(DP1).size());
assertEquals(0, DPT.getCfgsTrace(DP1).size()); assertEquals(0, DPT.getCfgsTrace(DP1).size());
changeActiveConfiguration(project, cfg1); changeActiveConfiguration(project, cfg1);
DPT.reset(DP1); DPT.reset(DP1);
index= CCorePlugin.getIndexManager().getIndex(cproject); index= CCorePlugin.getIndexManager().getIndex(cproject);
@ -377,7 +369,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
assertEquals(1, DPT.getCfgsTrace(DP1).size()); assertEquals(1, DPT.getCfgsTrace(DP1).size());
// should still be config2, as the change in active configuration does not matter // should still be config2, as the change in active configuration does not matter
assertEquals("project.config2", ((ICConfigurationDescription)DPT.getCfgsTrace(DP1).get(0)).getId()); assertEquals("project.config2", ((ICConfigurationDescription)DPT.getCfgsTrace(DP1).get(0)).getId());
changeActiveConfiguration(project, cfg2); changeActiveConfiguration(project, cfg2);
DPT.reset(DP1); DPT.reset(DP1);
index= CCorePlugin.getIndexManager().getIndex(cproject); index= CCorePlugin.getIndexManager().getIndex(cproject);
@ -392,7 +384,7 @@ public class IndexProviderManagerTest extends IndexTestBase {
} }
} }
} }
public void testGetProvidedFragments() throws Exception { public void testGetProvidedFragments() throws Exception {
ICProject cproject= CProjectHelper.createCProject("IndexProviderManagerTest", "bin", IPDOMManager.ID_NO_INDEXER); ICProject cproject= CProjectHelper.createCProject("IndexProviderManagerTest", "bin", IPDOMManager.ID_NO_INDEXER);
@ -499,20 +491,20 @@ public class IndexProviderManagerTest extends IndexTestBase {
} }
} }
} }
private ICConfigurationDescription newCfg(ICProjectDescription des, String project, String config) throws CoreException { private ICConfigurationDescription newCfg(ICProjectDescription des, String project, String config) throws CoreException {
CDefaultConfigurationData data= new CDefaultConfigurationData(project+"."+config, project+" "+config+" name", null); CDefaultConfigurationData data= new CDefaultConfigurationData(project+"."+config, project+" "+config+" name", null);
data.initEmptyData(); data.initEmptyData();
return des.createConfiguration(CCorePlugin.DEFAULT_PROVIDER_ID, data); return des.createConfiguration(CCorePlugin.DEFAULT_PROVIDER_ID, data);
} }
private void changeActiveConfiguration(IProject project, ICConfigurationDescription cfg) throws CoreException { private void changeActiveConfiguration(IProject project, ICConfigurationDescription cfg) throws CoreException {
ICProjectDescription pd= core.getProjectDescription(project); ICProjectDescription pd= core.getProjectDescription(project);
pd.setActiveConfiguration(pd.getConfigurationById(cfg.getId())); pd.setActiveConfiguration(pd.getConfigurationById(cfg.getId()));
core.setProjectDescription(project, pd); core.setProjectDescription(project, pd);
CCorePlugin.getIndexManager().joinIndexer(8000, npm()); CCorePlugin.getIndexManager().joinIndexer(8000, npm());
} }
private void changeConfigRelations(IProject project, int option) throws CoreException { private void changeConfigRelations(IProject project, int option) throws CoreException {
ICProjectDescription pd= core.getProjectDescription(project); ICProjectDescription pd= core.getProjectDescription(project);
pd.setConfigurationRelations(option); pd.setConfigurationRelations(option);
@ -528,7 +520,6 @@ class MockStateIndexProvider implements IIndexProvider {
this.targetProject = cproject; this.targetProject = cproject;
} }
@Override
public boolean providesFor(ICProject cproject) throws CoreException { public boolean providesFor(ICProject cproject) throws CoreException {
return this.targetProject.equals(cproject); return this.targetProject.equals(cproject);
} }
@ -537,7 +528,7 @@ class MockStateIndexProvider implements IIndexProvider {
class MockStateIndexFragmentProvider extends MockStateIndexProvider implements IIndexFragmentProvider { class MockStateIndexFragmentProvider extends MockStateIndexProvider implements IIndexFragmentProvider {
private boolean invert; private boolean invert;
final IIndexFragment[] fragments; final IIndexFragment[] fragments;
public void invert() { public void invert() {
invert = !invert; invert = !invert;
} }
@ -551,7 +542,6 @@ class MockStateIndexFragmentProvider extends MockStateIndexProvider implements I
} }
} }
@Override
public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) throws CoreException { public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) throws CoreException {
int index = MockState.states.indexOf(config.getId()); int index = MockState.states.indexOf(config.getId());
index = invert ? (fragments.length-1)-index : index; index = invert ? (fragments.length-1)-index : index;
@ -574,201 +564,146 @@ class MockConfig implements ICConfigurationDescription {
this.project= project; this.project= project;
} }
@Override
public String getId() { public String getId() {
return id; return id;
} }
@Override
public ICConfigExtensionReference create(String extensionPoint, public ICConfigExtensionReference create(String extensionPoint,
String extension) throws CoreException { String extension) throws CoreException {
return null; return null;
} }
@Override
public ICExternalSetting createExternalSetting(String[] languageIDs, public ICExternalSetting createExternalSetting(String[] languageIDs,
String[] contentTypeIds, String[] extensions, String[] contentTypeIds, String[] extensions,
ICSettingEntry[] entries) throws WriteAccessException { ICSettingEntry[] entries) throws WriteAccessException {
return null; return null;
} }
@Override
public ICFileDescription createFileDescription(IPath path, public ICFileDescription createFileDescription(IPath path,
ICResourceDescription base) throws CoreException, ICResourceDescription base) throws CoreException,
WriteAccessException { WriteAccessException {
return null; return null;
} }
@Override
public ICFolderDescription createFolderDescription(IPath path, public ICFolderDescription createFolderDescription(IPath path,
ICFolderDescription base) throws CoreException, ICFolderDescription base) throws CoreException,
WriteAccessException { WriteAccessException {
return null; return null;
} }
@Override
public ICConfigExtensionReference[] get(String extensionPointID) { public ICConfigExtensionReference[] get(String extensionPointID) {
return null; return null;
} }
@Override
public ICBuildSetting getBuildSetting() { public ICBuildSetting getBuildSetting() {
return null; return null;
} }
@Override
public String getBuildSystemId() { public String getBuildSystemId() {
return null; return null;
} }
@Override
public ICdtVariablesContributor getBuildVariablesContributor() { public ICdtVariablesContributor getBuildVariablesContributor() {
return null; return null;
} }
@Override
public CConfigurationData getConfigurationData() { public CConfigurationData getConfigurationData() {
return null; return null;
} }
@Override
public String getDescription() { public String getDescription() {
return null; return null;
} }
@Override
public ICExternalSetting[] getExternalSettings() { public ICExternalSetting[] getExternalSettings() {
return null; return null;
} }
@Override
public ICFileDescription[] getFileDescriptions() { public ICFileDescription[] getFileDescriptions() {
return null; return null;
} }
@Override
public ICFolderDescription[] getFolderDescriptions() { public ICFolderDescription[] getFolderDescriptions() {
return null; return null;
} }
@Override
public ICProjectDescription getProjectDescription() { public ICProjectDescription getProjectDescription() {
return CoreModel.getDefault().getProjectDescription(project); return CoreModel.getDefault().getProjectDescription(project);
} }
@Override
public Map getReferenceInfo() { public Map getReferenceInfo() {
return null; return null;
} }
@Override
public ICResourceDescription getResourceDescription(IPath path, public ICResourceDescription getResourceDescription(IPath path,
boolean exactPath) { boolean exactPath) {
return null; return null;
} }
@Override
public ICResourceDescription[] getResourceDescriptions() { public ICResourceDescription[] getResourceDescriptions() {
return null; return null;
} }
@Override
public ICFolderDescription getRootFolderDescription() {return null;} public ICFolderDescription getRootFolderDescription() {return null;}
@Override
public Object getSessionProperty(QualifiedName name) {return null;} public Object getSessionProperty(QualifiedName name) {return null;}
@Override
public ICSourceEntry[] getSourceEntries() {return null;} public ICSourceEntry[] getSourceEntries() {return null;}
@Override
public ICTargetPlatformSetting getTargetPlatformSetting() {return null;} public ICTargetPlatformSetting getTargetPlatformSetting() {return null;}
@Override
public boolean isActive() {return false;} public boolean isActive() {return false;}
@Override
public boolean isModified() {return false;} public boolean isModified() {return false;}
@Override
public boolean isPreferenceConfiguration() {return false;} public boolean isPreferenceConfiguration() {return false;}
@Override
public void remove(ICConfigExtensionReference ext) throws CoreException {} public void remove(ICConfigExtensionReference ext) throws CoreException {}
@Override
public void remove(String extensionPoint) throws CoreException {} public void remove(String extensionPoint) throws CoreException {}
@Override
public void removeExternalSetting(ICExternalSetting setting) throws WriteAccessException {} public void removeExternalSetting(ICExternalSetting setting) throws WriteAccessException {}
@Override
public void removeExternalSettings() throws WriteAccessException {} public void removeExternalSettings() throws WriteAccessException {}
@Override
public void removeResourceDescription(ICResourceDescription des) public void removeResourceDescription(ICResourceDescription des)
throws CoreException, WriteAccessException {} throws CoreException, WriteAccessException {}
@Override
public void setActive() throws WriteAccessException {} public void setActive() throws WriteAccessException {}
@Override
public void setConfigurationData(String buildSystemId, public void setConfigurationData(String buildSystemId,
CConfigurationData data) throws WriteAccessException {} CConfigurationData data) throws WriteAccessException {}
@Override
public void setDescription(String des) throws WriteAccessException {} public void setDescription(String des) throws WriteAccessException {}
@Override
public void setName(String name) throws WriteAccessException {} public void setName(String name) throws WriteAccessException {}
@Override
public void setReferenceInfo(Map<String, String> refs) throws WriteAccessException {} public void setReferenceInfo(Map<String, String> refs) throws WriteAccessException {}
@Override
public void setSessionProperty(QualifiedName name, Object value) {} public void setSessionProperty(QualifiedName name, Object value) {}
@Override
public void setSourceEntries(ICSourceEntry[] entries) throws CoreException, public void setSourceEntries(ICSourceEntry[] entries) throws CoreException,
WriteAccessException {} WriteAccessException {}
@Override
public ICSettingObject[] getChildSettings() {return null;} public ICSettingObject[] getChildSettings() {return null;}
@Override
public ICConfigurationDescription getConfiguration() {return null;} public ICConfigurationDescription getConfiguration() {return null;}
@Override
public String getName() {return null;} public String getName() {return null;}
@Override
public ICSettingContainer getParent() {return null;} public ICSettingContainer getParent() {return null;}
@Override
public int getType() {return 0;} public int getType() {return 0;}
@Override
public boolean isReadOnly() {return false;} public boolean isReadOnly() {return false;}
@Override
public boolean isValid() {return false;} public boolean isValid() {return false;}
@Override
public ICStorageElement getStorage(String id, boolean create) throws CoreException { public ICStorageElement getStorage(String id, boolean create) throws CoreException {
return null; return null;
} }
@Override
public ICStorageElement importStorage(String id, ICStorageElement storage) { public ICStorageElement importStorage(String id, ICStorageElement storage) {
return null; return null;
} }
@Override
public void removeStorage(String id) throws CoreException { public void removeStorage(String id) throws CoreException {
} }
@Override
public ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus) { public ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus) {
return null; return null;
} }
@Override
public String[] getExternalSettingsProviderIds() { public String[] getExternalSettingsProviderIds() {
return null; return null;
} }
@Override
public void setExternalSettingsProviderIds(String[] ids) {} public void setExternalSettingsProviderIds(String[] ids) {}
@Override
public void updateExternalSettingsProviders(String[] ids) {} public void updateExternalSettingsProviders(String[] ids) {}
@Override
public ICSourceEntry[] getResolvedSourceEntries() { public ICSourceEntry[] getResolvedSourceEntries() {
return null; return null;
} }
@Override
public CConfigurationStatus getConfigurationStatus() { public CConfigurationStatus getConfigurationStatus() {
return CConfigurationStatus.CFG_STATUS_OK; return CConfigurationStatus.CFG_STATUS_OK;
} }
@Override
public void setReadOnly(boolean readOnly, boolean keepModify) {} public void setReadOnly(boolean readOnly, boolean keepModify) {}
} }
/* /*
@ -801,12 +736,12 @@ class MockState {
class MockPDOM extends EmptyIndexFragment { class MockPDOM extends EmptyIndexFragment {
String id; String id;
String version; String version;
MockPDOM(String id, String version) { MockPDOM(String id, String version) {
this.id= id; this.id= id;
this.version= version; this.version= version;
} }
@Override @Override
public String getProperty(String propertyName) throws CoreException { public String getProperty(String propertyName) throws CoreException {
if(IIndexFragment.PROPERTY_FRAGMENT_ID.equals(propertyName)) { if(IIndexFragment.PROPERTY_FRAGMENT_ID.equals(propertyName)) {
@ -820,9 +755,9 @@ class MockPDOM extends EmptyIndexFragment {
} }
return null; return null;
} }
@Override @Override
public String toString() { public String toString() {
return "[Mock index fragment "+id+"."+System.identityHashCode(this)+"]"; return "[Mock index fragment "+id+"."+System.identityHashCode(this)+"]";
} }
} }

View file

@ -147,12 +147,12 @@ public class PDOMManager implements IWritableIndexManager, IListener {
private final PDOMIndexerJob fIndexerJob; private final PDOMIndexerJob fIndexerJob;
private IPDOMIndexerTask fCurrentTask; private IPDOMIndexerTask fCurrentTask;
private int fSourceCount, fHeaderCount, fTickCount; private int fSourceCount, fHeaderCount, fTickCount;
private final LinkedList<Runnable> fChangeEvents= new LinkedList<Runnable>(); private final LinkedList<Runnable> fChangeEvents= new LinkedList<Runnable>();
private final Job fNotificationJob; private final Job fNotificationJob;
private final AtomicMultiSet<IIndexFileLocation> fFilesIndexedUnconditionlly= new AtomicMultiSet<IIndexFileLocation>(); private final AtomicMultiSet<IIndexFileLocation> fFilesIndexedUnconditionlly= new AtomicMultiSet<IIndexFileLocation>();
/** /**
* Stores mapping from pdom to project, used to serialize creation of new pdoms. * Stores mapping from pdom to project, used to serialize creation of new pdoms.
*/ */
@ -160,7 +160,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
private Map<File, ICProject> fFileToProject= new HashMap<File, ICProject>(); private Map<File, ICProject> fFileToProject= new HashMap<File, ICProject>();
private ListenerList fChangeListeners= new ListenerList(); private ListenerList fChangeListeners= new ListenerList();
private ListenerList fStateListeners= new ListenerList(); private ListenerList fStateListeners= new ListenerList();
private IndexChangeEvent fIndexChangeEvent= new IndexChangeEvent(); private IndexChangeEvent fIndexChangeEvent= new IndexChangeEvent();
private IndexerStateEvent fIndexerStateEvent= new IndexerStateEvent(); private IndexerStateEvent fIndexerStateEvent= new IndexerStateEvent();
@ -170,17 +170,17 @@ public class PDOMManager implements IWritableIndexManager, IListener {
private final ICProjectDescriptionListener fProjectDescriptionListener; private final ICProjectDescriptionListener fProjectDescriptionListener;
private final JobChangeListener fJobChangeListener; private final JobChangeListener fJobChangeListener;
private final IPreferenceChangeListener fPreferenceChangeListener; private final IPreferenceChangeListener fPreferenceChangeListener;
private IndexFactory fIndexFactory= new IndexFactory(this); private IndexFactory fIndexFactory= new IndexFactory(this);
private IndexProviderManager fIndexProviderManager = new IndexProviderManager(); private IndexProviderManager fIndexProviderManager = new IndexProviderManager();
/** /**
* Serializes creation of new indexer, when acquiring the lock you are * Serializes creation of new indexer, when acquiring the lock you are
* not allowed to hold a lock on fPDOMs. * not allowed to hold a lock on fPDOMs.
*/ */
private Map<ICProject, IndexUpdatePolicy> fUpdatePolicies= new HashMap<ICProject, IndexUpdatePolicy>(); private Map<ICProject, IndexUpdatePolicy> fUpdatePolicies= new HashMap<ICProject, IndexUpdatePolicy>();
private Set<String> fClosingProjects= new HashSet<String>(); private Set<String> fClosingProjects= new HashSet<String>();
private Map<IProject, PCL> fPrefListeners= new HashMap<IProject, PCL>(); private Map<IProject, PCL> fPrefListeners= new HashMap<IProject, PCL>();
private List<IndexerSetupParticipant> fSetupParticipants= new ArrayList<IndexerSetupParticipant>(); private List<IndexerSetupParticipant> fSetupParticipants= new ArrayList<IndexerSetupParticipant>();
private Set<ICProject> fPostponedProjects= new HashSet<ICProject>(); private Set<ICProject> fPostponedProjects= new HashSet<ICProject>();
@ -188,7 +188,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
private boolean fInShutDown; private boolean fInShutDown;
boolean fTraceIndexerSetup; boolean fTraceIndexerSetup;
public PDOMManager() { public PDOMManager() {
PDOM.sDEBUG_LOCKS= "true".equals(Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/index/locks")); //$NON-NLS-1$//$NON-NLS-2$ PDOM.sDEBUG_LOCKS= "true".equals(Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/index/locks")); //$NON-NLS-1$//$NON-NLS-2$
addIndexerSetupParticipant(new WaitForRefreshJobs()); addIndexerSetupParticipant(new WaitForRefreshJobs());
@ -204,7 +204,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
fIndexerJob= new PDOMIndexerJob(this); fIndexerJob= new PDOMIndexerJob(this);
fNotificationJob= createNotifyJob(); fNotificationJob= createNotifyJob();
} }
public Job startup() { public Job startup() {
fInShutDown= false; fInShutDown= false;
Job postStartupJob= new Job(CCorePlugin.getResourceString("CCorePlugin.startupJob")) { //$NON-NLS-1$ Job postStartupJob= new Job(CCorePlugin.getResourceString("CCorePlugin.startupJob")) { //$NON-NLS-1$
@ -219,10 +219,10 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
}; };
postStartupJob.setSystem(true); postStartupJob.setSystem(true);
return postStartupJob; return postStartupJob;
} }
/** /**
* Called from a job after plugin start. * Called from a job after plugin start.
*/ */
protected void postStartup() { protected void postStartup() {
@ -234,7 +234,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
adjustCacheSize(); adjustCacheSize();
updatePathCanonicalizationStrategy(); updatePathCanonicalizationStrategy();
fIndexProviderManager.startup(); fIndexProviderManager.startup();
fTraceIndexerSetup= String.valueOf(true).equals(Platform.getDebugOption(TRACE_INDEXER_SETUP)); fTraceIndexerSetup= String.valueOf(true).equals(Platform.getDebugOption(TRACE_INDEXER_SETUP));
final CoreModel model = CoreModel.getDefault(); final CoreModel model = CoreModel.getDefault();
ResourcesPlugin.getWorkspace().addResourceChangeListener(fCModelListener, IResourceChangeEvent.POST_BUILD); ResourcesPlugin.getWorkspace().addResourceChangeListener(fCModelListener, IResourceChangeEvent.POST_BUILD);
@ -268,7 +268,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
fTaskQueue.clear(); fTaskQueue.clear();
jobToCancel= fIndexerJob; jobToCancel= fIndexerJob;
} }
if (jobToCancel != null) { if (jobToCancel != null) {
assert !Thread.holdsLock(fTaskQueue); assert !Thread.holdsLock(fTaskQueue);
jobToCancel.cancelJobs(null, false); jobToCancel.cancelJobs(null, false);
@ -290,7 +290,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
reindexAll(); reindexAll();
} }
} }
protected void adjustCacheSize() { protected void adjustCacheSize() {
IPreferencesService prefs = Platform.getPreferencesService(); IPreferencesService prefs = Platform.getPreferencesService();
int cachePct= prefs.getInt(CCorePlugin.PLUGIN_ID, CCorePreferenceConstants.INDEX_DB_CACHE_SIZE_PCT, 10, null); int cachePct= prefs.getInt(CCorePlugin.PLUGIN_ID, CCorePreferenceConstants.INDEX_DB_CACHE_SIZE_PCT, 10, null);
@ -313,7 +313,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
/** /**
* Returns the pdom for the project. * Returns the pdom for the project.
* @throws CoreException * @throws CoreException
*/ */
public IPDOM getPDOM(ICProject project) throws CoreException { public IPDOM getPDOM(ICProject project) throws CoreException {
@ -327,9 +327,9 @@ public class PDOMManager implements IWritableIndexManager, IListener {
return pdom; return pdom;
} }
} }
/** /**
* Returns the pdom for the project. The call to the method may cause * Returns the pdom for the project. The call to the method may cause
* opening the database. In case there is a version mismatch the data * opening the database. In case there is a version mismatch the data
* base is cleared, in case it does not exist it is created. In any * base is cleared, in case it does not exist it is created. In any
* case a pdom ready to use is returned. * case a pdom ready to use is returned.
@ -390,7 +390,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
pdom.setASTFilePathResolver(new ProjectIndexerInputAdapter(project, false)); pdom.setASTFilePathResolver(new ProjectIndexerInputAdapter(project, false));
pdom.addListener(this); pdom.addListener(this);
fFileToProject.put(dbFile, project); fFileToProject.put(dbFile, project);
fProjectToPDOM.put(rproject, pdom); fProjectToPDOM.put(rproject, pdom);
if (pdomProxy instanceof PDOMProxy) { if (pdomProxy instanceof PDOMProxy) {
@ -438,7 +438,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
public void setDefaultIndexerId(String indexerId) { public void setDefaultIndexerId(String indexerId) {
IndexerPreferences.setDefaultIndexerId(indexerId); IndexerPreferences.setDefaultIndexerId(indexerId);
} }
@Override @Override
public String getIndexerId(ICProject project) { public String getIndexerId(ICProject project) {
IProject prj= project != null ? project.getProject() : null; IProject prj= project != null ? project.getProject() : null;
@ -451,7 +451,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
IndexerPreferences.set(prj, IndexerPreferences.KEY_INDEXER_ID, indexerId); IndexerPreferences.set(prj, IndexerPreferences.KEY_INDEXER_ID, indexerId);
CCoreInternals.savePreferences(prj, IndexerPreferences.getScope(prj) == IndexerPreferences.SCOPE_PROJECT_SHARED); CCoreInternals.savePreferences(prj, IndexerPreferences.getScope(prj) == IndexerPreferences.SCOPE_PROJECT_SHARED);
} }
protected void onPreferenceChange(ICProject cproject, PreferenceChangeEvent event) { protected void onPreferenceChange(ICProject cproject, PreferenceChangeEvent event) {
if (IndexerPreferences.KEY_UPDATE_POLICY.equals(event.getKey())) { if (IndexerPreferences.KEY_UPDATE_POLICY.equals(event.getKey())) {
changeUpdatePolicy(cproject); changeUpdatePolicy(cproject);
@ -482,17 +482,17 @@ public class PDOMManager implements IWritableIndexManager, IListener {
private void changeIndexer(ICProject cproject) throws CoreException { private void changeIndexer(ICProject cproject) throws CoreException {
assert !Thread.holdsLock(fProjectToPDOM); assert !Thread.holdsLock(fProjectToPDOM);
// if there is no indexer, don't touch the preferences. // if there is no indexer, don't touch the preferences.
IPDOMIndexer oldIndexer= getIndexer(cproject); IPDOMIndexer oldIndexer= getIndexer(cproject);
if (oldIndexer == null) { if (oldIndexer == null) {
return; return;
} }
IProject prj= cproject.getProject(); IProject prj= cproject.getProject();
String newid= IndexerPreferences.get(prj, IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER); String newid= IndexerPreferences.get(prj, IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER);
Properties props= IndexerPreferences.getProperties(prj); Properties props= IndexerPreferences.getProperties(prj);
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=359485 // Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=359485
synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) { synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) {
synchronized (fUpdatePolicies) { synchronized (fUpdatePolicies) {
@ -519,7 +519,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
enqueue(new PDOMRebuildTask(indexer)); enqueue(new PDOMRebuildTask(indexer));
} }
}} }}
if (oldIndexer != null) { if (oldIndexer != null) {
stopIndexer(oldIndexer); stopIndexer(oldIndexer);
} }
@ -546,26 +546,26 @@ public class PDOMManager implements IWritableIndexManager, IListener {
void createIndexer(ICProject project, IProgressMonitor pm) throws InterruptedException { void createIndexer(ICProject project, IProgressMonitor pm) throws InterruptedException {
final IProject prj= project.getProject(); final IProject prj= project.getProject();
final String name = prj.getName(); final String name = prj.getName();
if (fTraceIndexerSetup) if (fTraceIndexerSetup)
System.out.println("Indexer: Creation for project " + name); //$NON-NLS-1$ System.out.println("Indexer: Creation for project " + name); //$NON-NLS-1$
assert !Thread.holdsLock(fProjectToPDOM); assert !Thread.holdsLock(fProjectToPDOM);
try { try {
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=359485 // Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=359485
synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) { synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) {
synchronized (fUpdatePolicies) { synchronized (fUpdatePolicies) {
if (fClosingProjects.contains(name)) { if (fClosingProjects.contains(name)) {
if (fTraceIndexerSetup) if (fTraceIndexerSetup)
System.out.println("Indexer: Aborting setup (1) for closing project " + name + " [1]"); //$NON-NLS-1$ //$NON-NLS-2$ System.out.println("Indexer: Aborting setup (1) for closing project " + name + " [1]"); //$NON-NLS-1$ //$NON-NLS-2$
return; return;
} }
WritablePDOM pdom= getOrCreatePDOM(project); WritablePDOM pdom= getOrCreatePDOM(project);
Properties props= IndexerPreferences.getProperties(prj); Properties props= IndexerPreferences.getProperties(prj);
IPDOMIndexer indexer= newIndexer(getIndexerId(project), props); IPDOMIndexer indexer= newIndexer(getIndexerId(project), props);
IndexUpdatePolicy policy= createPolicy(project); IndexUpdatePolicy policy= createPolicy(project);
boolean rebuild= boolean rebuild=
pdom.isClearedBecauseOfVersionMismatch() || pdom.isClearedBecauseOfVersionMismatch() ||
pdom.isCreatedFromScratch() || pdom.isCreatedFromScratch() ||
policy.isInitialRebuildRequested(); policy.isInitialRebuildRequested();
@ -593,7 +593,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
pdom.releaseReadLock(); pdom.releaseReadLock();
} }
if (resume) { if (resume) {
if (fTraceIndexerSetup) if (fTraceIndexerSetup)
System.out.println("Indexer: Resuming for project " + name); //$NON-NLS-1$ System.out.println("Indexer: Resuming for project " + name); //$NON-NLS-1$
enqueue(new PDOMUpdateTask(indexer, enqueue(new PDOMUpdateTask(indexer,
@ -612,7 +612,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) { synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) {
synchronized (fUpdatePolicies) { synchronized (fUpdatePolicies) {
if (fClosingProjects.contains(name)) { if (fClosingProjects.contains(name)) {
if (fTraceIndexerSetup) if (fTraceIndexerSetup)
System.out.println("Indexer: Aborting setup for closing project " + name + " [2]"); //$NON-NLS-1$ //$NON-NLS-2$ System.out.println("Indexer: Aborting setup for closing project " + name + " [2]"); //$NON-NLS-1$ //$NON-NLS-2$
return; return;
} }
@ -626,13 +626,13 @@ public class PDOMManager implements IWritableIndexManager, IListener {
IPDOMIndexerTask task= null; IPDOMIndexerTask task= null;
if (operation.wasSuccessful()) { if (operation.wasSuccessful()) {
if (fTraceIndexerSetup) if (fTraceIndexerSetup)
System.out.println("Indexer: Imported shared index for project " + name); //$NON-NLS-1$ System.out.println("Indexer: Imported shared index for project " + name); //$NON-NLS-1$
task= new PDOMUpdateTask(indexer, task= new PDOMUpdateTask(indexer,
IIndexManager.UPDATE_CHECK_TIMESTAMPS | IIndexManager.UPDATE_CHECK_CONTENTS_HASH); IIndexManager.UPDATE_CHECK_TIMESTAMPS | IIndexManager.UPDATE_CHECK_CONTENTS_HASH);
} else { } else {
if (fTraceIndexerSetup) if (fTraceIndexerSetup)
System.out.println("Indexer: Rebuiding for project " + name); //$NON-NLS-1$ System.out.println("Indexer: Rebuiding for project " + name); //$NON-NLS-1$
task= new PDOMRebuildTask(indexer); task= new PDOMRebuildTask(indexer);
} }
enqueue(task); enqueue(task);
@ -644,7 +644,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
} }
} }
private IPDOMIndexer newIndexer(String indexerId, Properties props) throws CoreException { private IPDOMIndexer newIndexer(String indexerId, Properties props) throws CoreException {
IPDOMIndexer indexer = null; IPDOMIndexer indexer = null;
// Look up in extension point // Look up in extension point
@ -659,14 +659,14 @@ public class PDOMManager implements IWritableIndexManager, IListener {
indexer.setProperties(props); indexer.setProperties(props);
} catch (CoreException e) { } catch (CoreException e) {
CCorePlugin.log(e); CCorePlugin.log(e);
} }
break; break;
} }
} }
} }
// Unknown index, default to the null one // Unknown index, default to the null one
if (indexer == null) if (indexer == null)
indexer = new PDOMNullIndexer(); indexer = new PDOMNullIndexer();
return indexer; return indexer;
@ -700,7 +700,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
fIndexerJob.schedule(); fIndexerJob.schedule();
} }
} }
private void getReferencingProjects(IProject prj, HashSet<IProject> result) { private void getReferencingProjects(IProject prj, HashSet<IProject> result) {
LinkedList<IProject> projectsToSearch= new LinkedList<IProject>(); LinkedList<IProject> projectsToSearch= new LinkedList<IProject>();
projectsToSearch.add(prj); projectsToSearch.add(prj);
@ -731,7 +731,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
return result; return result;
} }
void cancelledIndexerJob(boolean byManager) { void cancelledIndexerJob(boolean byManager) {
synchronized (fTaskQueue) { synchronized (fTaskQueue) {
fCurrentTask= null; fCurrentTask= null;
@ -743,7 +743,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
} }
} }
@Override @Override
public boolean isIndexerIdle() { public boolean isIndexerIdle() {
return Job.getJobManager().find(this).length == 0; return Job.getJobManager().find(this).length == 0;
@ -753,19 +753,19 @@ public class PDOMManager implements IWritableIndexManager, IListener {
final String name = cproject.getProject().getName(); final String name = cproject.getProject().getName();
if (fTraceIndexerSetup) { if (fTraceIndexerSetup) {
System.out.println("Indexer: Adding new project " + name); //$NON-NLS-1$ System.out.println("Indexer: Adding new project " + name); //$NON-NLS-1$
} }
synchronized (fUpdatePolicies) { synchronized (fUpdatePolicies) {
fClosingProjects.remove(name); fClosingProjects.remove(name);
} }
setupProject(cproject); setupProject(cproject);
} }
void setupProject(final ICProject cproject) { void setupProject(final ICProject cproject) {
if (fInShutDown) if (fInShutDown)
return; return;
synchronized (fProjectQueue) { synchronized (fProjectQueue) {
fProjectQueue.add(cproject); fProjectQueue.add(cproject);
} }
@ -804,7 +804,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (indexer != null && indexer.getID().equals(IPDOMManager.ID_NO_INDEXER)) { if (indexer != null && indexer.getID().equals(IPDOMManager.ID_NO_INDEXER)) {
return; return;
} }
if (added.length > 0 || changed.length > 0 || removed.length > 0) { if (added.length > 0 || changed.length > 0 || removed.length > 0) {
synchronized (fUpdatePolicies) { synchronized (fUpdatePolicies) {
IndexUpdatePolicy policy= createPolicy(project); IndexUpdatePolicy policy= createPolicy(project);
@ -835,7 +835,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
public void preDeleteProject(ICProject cproject) { public void preDeleteProject(ICProject cproject) {
preRemoveProject(cproject, true); preRemoveProject(cproject, true);
} }
public void preCloseProject(ICProject cproject) { public void preCloseProject(ICProject cproject) {
@ -848,8 +848,8 @@ public class PDOMManager implements IWritableIndexManager, IListener {
final IProject rproject= cproject.getProject(); final IProject rproject= cproject.getProject();
final String name = rproject.getName(); final String name = rproject.getName();
if (fTraceIndexerSetup) if (fTraceIndexerSetup)
System.out.println("Indexer: Removing project " + name + "; delete=" + delete); //$NON-NLS-1$ //$NON-NLS-2$ System.out.println("Indexer: Removing project " + name + "; delete=" + delete); //$NON-NLS-1$ //$NON-NLS-2$
IPDOMIndexer indexer; IPDOMIndexer indexer;
synchronized (fUpdatePolicies) { synchronized (fUpdatePolicies) {
@ -896,12 +896,12 @@ public class PDOMManager implements IWritableIndexManager, IListener {
job.setSystem(true); job.setSystem(true);
job.schedule(); job.schedule();
} }
synchronized (fUpdatePolicies) { synchronized (fUpdatePolicies) {
fUpdatePolicies.remove(cproject); fUpdatePolicies.remove(cproject);
} }
} }
void removeProject(ICProject cproject, ICElementDelta delta) { void removeProject(ICProject cproject, ICElementDelta delta) {
synchronized (fProjectToPDOM) { synchronized (fProjectToPDOM) {
IProject rproject= cproject.getProject(); IProject rproject= cproject.getProject();
@ -921,7 +921,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
policy.clearTUs(); policy.clearTUs();
policy.setIndexer(null); policy.setIndexer(null);
} }
} }
} }
cancelIndexerJobs(indexer); cancelIndexerJobs(indexer);
} }
@ -937,13 +937,13 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
jobToCancel= fIndexerJob; jobToCancel= fIndexerJob;
} }
if (jobToCancel != null) { if (jobToCancel != null) {
assert !Thread.holdsLock(fTaskQueue); assert !Thread.holdsLock(fTaskQueue);
jobToCancel.cancelJobs(indexer, true); jobToCancel.cancelJobs(indexer, true);
} }
} }
private void reindexAll() { private void reindexAll() {
ICProject[] cProjects; ICProject[] cProjects;
try { try {
@ -958,7 +958,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
@Override @Override
public void reindex(final ICProject project) { public void reindex(final ICProject project) {
Job job= new Job(Messages.PDOMManager_notifyJob_label) { Job job= new Job(Messages.PDOMManager_notifyJob_label) {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
IPDOMIndexer indexer= null; IPDOMIndexer indexer= null;
@ -999,7 +999,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
public void removeIndexChangeListener(IIndexChangeListener listener) { public void removeIndexChangeListener(IIndexChangeListener listener) {
fChangeListeners.remove(listener); fChangeListeners.remove(listener);
} }
@Override @Override
public void addIndexerStateListener(IIndexerStateListener listener) { public void addIndexerStateListener(IIndexerStateListener listener) {
fStateListeners.add(listener); fStateListeners.add(listener);
@ -1029,7 +1029,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
notify.setSystem(true); notify.setSystem(true);
return notify; return notify;
} }
private void scheduleNotification(Runnable notify) { private void scheduleNotification(Runnable notify) {
if (fInShutDown) if (fInShutDown)
return; return;
@ -1079,12 +1079,12 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (fChangeListeners.isEmpty()) { if (fChangeListeners.isEmpty()) {
return; return;
} }
ICProject project; ICProject project;
synchronized (fProjectToPDOM) { synchronized (fProjectToPDOM) {
project = fFileToProject.get(pdom.getPath()); project = fFileToProject.get(pdom.getPath());
} }
if (project != null) { if (project != null) {
final ICProject finalProject= project; final ICProject finalProject= project;
Runnable notify= new Runnable() { Runnable notify= new Runnable() {
@ -1145,10 +1145,10 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
} }
} }
int getMonitorMessage(PDOMIndexerJob job, int currentTicks, int base) { int getMonitorMessage(PDOMIndexerJob job, int currentTicks, int base) {
assert !Thread.holdsLock(fTaskQueue); assert !Thread.holdsLock(fTaskQueue);
int sourceCount, sourceEstimate, headerCount, tickCount, tickEstimate; int sourceCount, sourceEstimate, headerCount, tickCount, tickEstimate;
String detail= null; String detail= null;
synchronized (fTaskQueue) { synchronized (fTaskQueue) {
@ -1175,14 +1175,14 @@ public class PDOMManager implements IWritableIndexManager, IListener {
detail= PDOMIndexerJob.sMonitorDetail; detail= PDOMIndexerJob.sMonitorDetail;
} }
} }
String msg= MessageFormat.format(Messages.PDOMManager_indexMonitorDetail, new Object[] { String msg= MessageFormat.format(Messages.PDOMManager_indexMonitorDetail, new Object[] {
new Integer(sourceCount), new Integer(sourceEstimate), new Integer(sourceCount), new Integer(sourceEstimate),
new Integer(headerCount)}); new Integer(headerCount)});
if (detail != null) { if (detail != null) {
msg += ": " + detail; //$NON-NLS-1$ msg += ": " + detail; //$NON-NLS-1$
} }
job.subTask(msg); job.subTask(msg);
if (tickCount > 0 && tickCount <= tickEstimate) { if (tickCount > 0 && tickCount <= tickEstimate) {
int newTick= tickCount*base/tickEstimate; int newTick= tickCount*base/tickEstimate;
@ -1218,7 +1218,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
public IIndex getIndex(ICProject[] projects, int options) throws CoreException { public IIndex getIndex(ICProject[] projects, int options) throws CoreException {
return fIndexFactory.getIndex(projects, options); return fIndexFactory.getIndex(projects, options);
} }
/** /**
* Exports the project PDOM to the specified location, rewriting locations with * Exports the project PDOM to the specified location, rewriting locations with
* the specified location converter. * the specified location converter.
@ -1255,7 +1255,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
// overwrite internal location representations // overwrite internal location representations
final WritablePDOM newPDOM = new WritablePDOM(targetLocation, pdom.getLocationConverter(), getLinkageFactories()); final WritablePDOM newPDOM = new WritablePDOM(targetLocation, pdom.getLocationConverter(), getLinkageFactories());
newPDOM.acquireWriteLock(); newPDOM.acquireWriteLock();
try { try {
newPDOM.rewriteLocations(newConverter); newPDOM.rewriteLocations(newConverter);
@ -1275,7 +1275,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
/** /**
* Resets the pdom for the project with the provided stream. * Resets the pdom for the project with the provided stream.
* @throws CoreException * @throws CoreException
* @throws OperationCanceledException in case the thread was interrupted * @throws OperationCanceledException in case the thread was interrupted
* @since 4.0 * @since 4.0
@ -1294,11 +1294,11 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
if (version > PDOM.getMaxSupportedVersion()) { if (version > PDOM.getMaxSupportedVersion()) {
final IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, 0, CCorePlugin.getResourceString("PDOMManager.unsupportedHigherVersion"), null); //$NON-NLS-1$ final IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, 0, CCorePlugin.getResourceString("PDOMManager.unsupportedHigherVersion"), null); //$NON-NLS-1$
throw new CoreException(status); throw new CoreException(status);
} }
if ( !PDOM.isSupportedVersion( version ) ) { if ( !PDOM.isSupportedVersion( version ) ) {
final IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, 0, CCorePlugin.getResourceString("PDOMManager.unsupportedVersion"), null); //$NON-NLS-1$ final IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, 0, CCorePlugin.getResourceString("PDOMManager.unsupportedVersion"), null); //$NON-NLS-1$
throw new CoreException(status); throw new CoreException(status);
} }
byte[] buffer= new byte[2048]; byte[] buffer= new byte[2048];
int read; int read;
@ -1308,7 +1308,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} finally { } finally {
out.close(); out.close();
} }
WritablePDOM pdom= (WritablePDOM) getPDOM(project); WritablePDOM pdom= (WritablePDOM) getPDOM(project);
try { try {
pdom.acquireWriteLock(); pdom.acquireWriteLock();
@ -1323,7 +1323,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
pdom.releaseWriteLock(); pdom.releaseWriteLock();
} }
} }
@Override @Override
public void export(ICProject project, String location, int options, IProgressMonitor monitor) throws CoreException { public void export(ICProject project, String location, int options, IProgressMonitor monitor) throws CoreException {
TeamPDOMExportOperation operation= new TeamPDOMExportOperation(project); TeamPDOMExportOperation operation= new TeamPDOMExportOperation(project);
@ -1331,7 +1331,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
operation.setOptions(options); operation.setOptions(options);
operation.run(monitor); operation.run(monitor);
} }
/** /**
* Write metadata appropriate for a project pdom * Write metadata appropriate for a project pdom
* @param pdom the pdom to write to * @param pdom the pdom to write to
@ -1362,7 +1362,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
for (Map.Entry<ICProject, List<ICElement>> entry : projectsToElements.entrySet()) { for (Map.Entry<ICProject, List<ICElement>> entry : projectsToElements.entrySet()) {
ICProject project = entry.getKey(); ICProject project = entry.getKey();
List<ICElement> filesAndFolders = entry.getValue(); List<ICElement> filesAndFolders = entry.getValue();
update(project, filesAndFolders, options); update(project, filesAndFolders, options);
} }
} }
@ -1389,14 +1389,14 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} else if (contains(element, other)) { } else if (contains(element, other)) {
set.set(j, element); set.set(j, element);
continue allElements; continue allElements;
} }
} }
set.add(element); set.add(element);
} }
} }
return result; return result;
} }
private boolean contains(final ICElement a, ICElement b) { private boolean contains(final ICElement a, ICElement b) {
if (a.equals(b)) { if (a.equals(b)) {
return true; return true;
@ -1493,7 +1493,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (fPostponedProjects.contains(project)) { if (fPostponedProjects.contains(project)) {
setupProject(project); setupProject(project);
} }
} }
} }
@Override @Override
@ -1512,7 +1512,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
} }
} }
/** /**
* @param project * @param project
* @return whether the specified project has been registered. If a project has * @return whether the specified project has been registered. If a project has
@ -1522,7 +1522,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
public boolean isProjectRegistered(ICProject project) { public boolean isProjectRegistered(ICProject project) {
return getIndexer(project) != null; return getIndexer(project) != null;
} }
/** /**
* @param cproject the project to check * @param cproject the project to check
* @return whether the content in the project fragment of the specified project's index * @return whether the content in the project fragment of the specified project's index
@ -1532,7 +1532,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
public boolean isProjectContentSynced(ICProject cproject) throws CoreException { public boolean isProjectContentSynced(ICProject cproject) throws CoreException {
if (!"true".equals(IndexerPreferences.get(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, null))) //$NON-NLS-1$ if (!"true".equals(IndexerPreferences.get(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, null))) //$NON-NLS-1$
return true; // no check performed in this case return true; // no check performed in this case
Set<ITranslationUnit> sources= new HashSet<ITranslationUnit>(); Set<ITranslationUnit> sources= new HashSet<ITranslationUnit>();
cproject.accept(new TranslationUnitCollector(sources, null, new NullProgressMonitor())); cproject.accept(new TranslationUnitCollector(sources, null, new NullProgressMonitor()));
@ -1558,7 +1558,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
return true; return true;
} }
private boolean isSubjectToIndexing(ILanguage language) { private boolean isSubjectToIndexing(ILanguage language) {
final int linkageID=language.getLinkageID(); final int linkageID=language.getLinkageID();
for (int id : IDS_FOR_LINKAGES_TO_INDEX) { for (int id : IDS_FOR_LINKAGES_TO_INDEX) {
@ -1580,7 +1580,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
private static boolean areSynchronized(Set<IIndexFileLocation> trail, IIndex index, IResource resource, IIndexFileLocation location) throws CoreException { private static boolean areSynchronized(Set<IIndexFileLocation> trail, IIndex index, IResource resource, IIndexFileLocation location) throws CoreException {
if (!trail.contains(location)) { if (!trail.contains(location)) {
trail.add(location); trail.add(location);
IIndexFile[] file= index.getFiles(location); IIndexFile[] file= index.getFiles(location);
// pre-includes may be listed twice (191989) // pre-includes may be listed twice (191989)
@ -1606,7 +1606,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} }
} }
} }
return true; return true;
} }

View file

@ -653,9 +653,9 @@
<extension-point id="templateProcessTypes" name="%templateProcessTypes.name" schema="schema/templateProcessTypes.exsd"/> <extension-point id="templateProcessTypes" name="%templateProcessTypes.name" schema="schema/templateProcessTypes.exsd"/>
<extension-point id="templateAssociations" name="%templateAssociations.name" schema="schema/templateAssociations.exsd"/> <extension-point id="templateAssociations" name="%templateAssociations.name" schema="schema/templateAssociations.exsd"/>
<extension-point id="ScannerInfoProvider2" name="%scannerInfoProvider2.name" schema="schema/ScannerInfoProvider2.exsd"/> <extension-point id="ScannerInfoProvider2" name="%scannerInfoProvider2.name" schema="schema/ScannerInfoProvider2.exsd"/>
<extension-point id="EFSExtensionProvider" name="EFSExtensionProvider" schema="schema/EFSExtensionProvider.exsd"/> <extension-point id="EFSExtensionProvider" name="%efsExtensionProvider.name" schema="schema/EFSExtensionProvider.exsd"/>
<extension-point id="RefreshExclusionFactory" name="%refreshExclusionFactory.name" schema="schema/RefreshExclusionFactory.exsd"/>
<extension-point id="LanguageSettingsProvider" name="%LanguageSettingsProvider.name" schema="schema/LanguageSettingsProvider.exsd"/> <extension-point id="LanguageSettingsProvider" name="%LanguageSettingsProvider.name" schema="schema/LanguageSettingsProvider.exsd"/>
<extension-point id="RefreshExclusionFactory" name="Refresh Exclusion Factory" schema="schema/RefreshExclusionFactory.exsd"/>
<extension-point id="UNCPathConverter" name="%uncPathConverter.name" schema="schema/UNCPathConverter.exsd"/> <extension-point id="UNCPathConverter" name="%uncPathConverter.name" schema="schema/UNCPathConverter.exsd"/>
<extension <extension

View file

@ -713,7 +713,7 @@ outer:
* @return URI * @return URI
* @since 5.1 * @since 5.1
*/ */
public URI toURI(IPath path) { private URI toURI(IPath path) {
// try { // try {
URI baseURI = getWorkingDirectoryURI(); URI baseURI = getWorkingDirectoryURI();
String uriString = path.toString(); String uriString = path.toString();