mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 22:35:43 +02:00
Fix for Bugs # 87978, 87982, 87993
This commit is contained in:
parent
bd9022596d
commit
a936f8db56
12 changed files with 90 additions and 74 deletions
|
@ -112,7 +112,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
fail("Unable to create project");
|
||||
|
||||
indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
||||
indexManager.reset();
|
||||
//indexManager.reset();
|
||||
|
||||
TypeCacheManager typeCacheManager = TypeCacheManager.getInstance();
|
||||
typeCacheManager.setProcessTypeCacheEvents(false);
|
||||
|
|
|
@ -111,7 +111,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
|||
fail("Unable to create project"); //$NON-NLS-1$
|
||||
|
||||
indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
||||
indexManager.reset();
|
||||
//indexManager.reset();
|
||||
//Get the indexer used for the test project
|
||||
sourceIndexer = (SourceIndexer) indexManager.getIndexerForProject(testProject);
|
||||
sourceIndexer.addIndexChangeListener(this);
|
||||
|
|
|
@ -96,7 +96,7 @@ public class FileBasePluginTest extends TestCase {
|
|||
|
||||
private void initialize(Class aClassName){
|
||||
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
||||
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
monitor = new NullProgressMonitor();
|
||||
|
||||
workspace = ResourcesPlugin.getWorkspace();
|
||||
|
|
|
@ -45,7 +45,7 @@ abstract public class BaseTestFramework extends TestCase {
|
|||
static protected SourceIndexer sourceIndexer;
|
||||
{
|
||||
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
||||
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
monitor = new NullProgressMonitor();
|
||||
|
||||
workspace = ResourcesPlugin.getWorkspace();
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
typeCacheManager.setProcessTypeCacheEvents(false);
|
||||
|
||||
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
||||
indexManager.reset();
|
||||
//indexManager.reset();
|
||||
|
||||
sourceIndexer = (SourceIndexer) CCorePlugin.getDefault().getCoreModel().getIndexManager().getIndexerForProject(project);
|
||||
sourceIndexer.addIndexChangeListener( this );
|
||||
|
|
|
@ -58,7 +58,7 @@ public class BaseSearchTest extends TestCase implements ICSearchConstants {
|
|||
|
||||
{
|
||||
|
||||
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
monitor = new NullProgressMonitor();
|
||||
|
||||
workspace = ResourcesPlugin.getWorkspace();
|
||||
|
|
|
@ -51,9 +51,6 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
|||
public static Test suite() {
|
||||
final AutomatedIntegrationSuite suite = new AutomatedIntegrationSuite();
|
||||
|
||||
//TODO: BOG take this out once TypeCache issues resolved
|
||||
disableIndexUpgrades();
|
||||
|
||||
// Add all success tests
|
||||
suite.addTest(CDescriptorTests.suite());
|
||||
//suite.addTest(GCCErrorParserTests.suite());
|
||||
|
@ -79,13 +76,5 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
|||
|
||||
return suite;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static void disableIndexUpgrades() {
|
||||
CCorePlugin.getDefault().getCoreModel().getIndexManager().disableUpgrades();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-03-14 Bogdan Gheorghe
|
||||
Added a NPE check to path entry manager
|
||||
|
||||
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
|
||||
|
||||
2005-03-13 Bogdan Gheorghe
|
||||
Added support for new indexer framework
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2005-03-14 Bogdan Gheorghe
|
||||
Added update code for old indexer projects
|
||||
|
||||
2005-03-12 Bogdan Gheorghe
|
||||
Restructured indexer framework to allow for multiple indexers in a workspace.
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ public class IndexManager extends JobManager{
|
|||
//Upgrade index version
|
||||
private boolean upgradeIndexEnabled = false;
|
||||
private int upgradeIndexProblems = 0;
|
||||
private boolean upgradeProjects = true;
|
||||
|
||||
|
||||
private ReadWriteMonitor monitor = new ReadWriteMonitor();
|
||||
|
||||
/**
|
||||
* Create an indexer only on request
|
||||
*/
|
||||
|
@ -96,36 +96,75 @@ public class IndexManager extends JobManager{
|
|||
/**
|
||||
* Flush current state
|
||||
*/
|
||||
public void reset() {
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
|
||||
initializeIndexersMap();
|
||||
this.indexerMap = new HashMap(5);
|
||||
try{
|
||||
monitor.enterWrite();
|
||||
initializeIndexerID();
|
||||
} finally {
|
||||
monitor.exitWrite();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public synchronized String getIndexerID(IProject project) throws CoreException {
|
||||
//See if there's already one associated with the resource for this session
|
||||
String indexerID = (String) project.getSessionProperty(indexerIDKey);
|
||||
|
||||
// Try to load one for the project
|
||||
if (indexerID == null) {
|
||||
indexerID = loadIndexerIDFromCDescriptor(project);
|
||||
}
|
||||
|
||||
// There is nothing persisted for the session, or saved in a file so
|
||||
// create a build info object
|
||||
if (indexerID != null) {
|
||||
project.setSessionProperty(indexerIDKey, indexerID);
|
||||
}
|
||||
else{
|
||||
//Hmm, no persisted indexer value. Could be an old project - need to run project
|
||||
//update code here
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void initializeIndexerID() {
|
||||
IProject[] projects = CCorePlugin.getWorkspace().getRoot().getProjects();
|
||||
//Make sure that all projects are added to the indexer map and updated
|
||||
//where neccesary
|
||||
for (int i=0; i<projects.length; i++){
|
||||
try {
|
||||
initializeIndexer(projects[i]);
|
||||
} catch (CoreException e) {}
|
||||
}
|
||||
|
||||
return indexerID;
|
||||
}
|
||||
|
||||
private ICDTIndexer initializeIndexer(IProject project) throws CoreException {
|
||||
|
||||
ICDTIndexer indexer = null;
|
||||
indexer = (ICDTIndexer) indexerMap.get(project);
|
||||
|
||||
if (indexer == null){
|
||||
String indexerID = null;
|
||||
try {
|
||||
//Indexer has not been created yet for this session
|
||||
//Check to see if the indexer has been set in a session property
|
||||
indexerID = (String) project.getSessionProperty(indexerIDKey);
|
||||
} catch (CoreException e) {}
|
||||
|
||||
if (indexerID == null){
|
||||
try{
|
||||
//Need to load the indexer from descriptor
|
||||
indexerID = loadIndexerIDFromCDescriptor(project);
|
||||
} catch (CoreException e){}
|
||||
}
|
||||
|
||||
//Make sure that we have an indexer ID
|
||||
if (indexerID == null) {
|
||||
//No persisted info on file? Must be old project - run temp. upgrade
|
||||
indexerID = doProjectUpgrade(project);
|
||||
doSourceIndexerUpgrade(project);
|
||||
}
|
||||
|
||||
//If we're asking for the null indexer,return null
|
||||
if (indexerID == null ||
|
||||
indexerID.equals(nullIndexerID))
|
||||
return null;
|
||||
|
||||
//Create the indexer and store it
|
||||
indexer = getIndexer(indexerID);
|
||||
indexerMap.put(project,indexer);
|
||||
|
||||
}
|
||||
return indexer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -332,7 +371,10 @@ public class IndexManager extends JobManager{
|
|||
}
|
||||
|
||||
public synchronized ICDTIndexer getIndexerForProject(IProject project){
|
||||
|
||||
//Make sure we're not updating list
|
||||
monitor.enterRead();
|
||||
//All indexers that were previously persisted should have been loaded at
|
||||
//this point
|
||||
ICDTIndexer indexer = null;
|
||||
indexer = (ICDTIndexer) indexerMap.get(project);
|
||||
|
||||
|
@ -344,37 +386,21 @@ public class IndexManager extends JobManager{
|
|||
indexerID = (String) project.getSessionProperty(indexerIDKey);
|
||||
} catch (CoreException e) {}
|
||||
|
||||
if (indexerID == null){
|
||||
try{
|
||||
//Need to load the indexer from descriptor
|
||||
indexerID = loadIndexerIDFromCDescriptor(project);
|
||||
} catch (CoreException e){}
|
||||
}
|
||||
|
||||
//Make sure that we have an indexer ID
|
||||
if (indexerID == null && upgradeProjects) {
|
||||
//No persisted info on file? Must be old project - run temp. upgrade
|
||||
indexerID = doProjectUpgrade(project);
|
||||
doSourceIndexerUpgrade(project);
|
||||
}
|
||||
|
||||
//If we're asking for the null indexer,return null
|
||||
if (indexerID == null ||
|
||||
indexerID.equals(nullIndexerID))
|
||||
return null;
|
||||
|
||||
//Any persisted indexders would have been loaded in the initialization
|
||||
//Create the indexer and store it
|
||||
indexer = getIndexer(indexerID);
|
||||
indexerMap.put(project,indexer);
|
||||
|
||||
monitor.exitRead();
|
||||
}
|
||||
|
||||
return indexer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
*/
|
||||
private void doSourceIndexerUpgrade(IProject project) {
|
||||
private synchronized void doSourceIndexerUpgrade(IProject project) {
|
||||
ICDescriptor descriptor = null;
|
||||
Element rootElement = null;
|
||||
IProject newProject = null;
|
||||
|
@ -429,7 +455,7 @@ public class IndexManager extends JobManager{
|
|||
/**
|
||||
* @return
|
||||
*/
|
||||
private String doProjectUpgrade(IProject project) {
|
||||
private synchronized String doProjectUpgrade(IProject project) {
|
||||
ICDescriptor descriptor = null;
|
||||
Element rootElement = null;
|
||||
IProject newProject = null;
|
||||
|
@ -562,18 +588,9 @@ protected ICDTIndexer getIndexer(String indexerId) {
|
|||
while (i.hasNext()){
|
||||
IProject tempProject = (IProject) i.next();
|
||||
ICDTIndexer indexer = (ICDTIndexer) indexerMap.get(tempProject);
|
||||
indexer.notifyIdle(idlingTime);
|
||||
if (indexer != null)
|
||||
indexer.notifyIdle(idlingTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void disableUpgrades() {
|
||||
upgradeProjects = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1542,10 +1542,12 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
|||
IIncludeEntry include = (IIncludeEntry)entry;
|
||||
|
||||
IPath basePath = include.getBasePath();
|
||||
basePath = varManager.resolvePath(basePath);
|
||||
if (varManager != null)
|
||||
basePath = varManager.resolvePath(basePath);
|
||||
|
||||
IPath includePath = include.getIncludePath();
|
||||
includePath = varManager.resolvePath(includePath);
|
||||
if (varManager != null)
|
||||
includePath = varManager.resolvePath(includePath);
|
||||
|
||||
return CoreModel.newIncludeEntry(resourcePath, basePath, includePath,
|
||||
include.isSystemInclude(), include.getExclusionPatterns(), include.isExported());
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ContentAssistTests extends TestCase {
|
|||
static FileManager fileManager;
|
||||
static boolean disabledHelpContributions = false;
|
||||
{
|
||||
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
monitor = new NullProgressMonitor();
|
||||
|
||||
workspace = ResourcesPlugin.getWorkspace();
|
||||
|
|
Loading…
Add table
Reference in a new issue