mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +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");
|
fail("Unable to create project");
|
||||||
|
|
||||||
indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
||||||
indexManager.reset();
|
//indexManager.reset();
|
||||||
|
|
||||||
TypeCacheManager typeCacheManager = TypeCacheManager.getInstance();
|
TypeCacheManager typeCacheManager = TypeCacheManager.getInstance();
|
||||||
typeCacheManager.setProcessTypeCacheEvents(false);
|
typeCacheManager.setProcessTypeCacheEvents(false);
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class SourceIndexerTests extends TestCase implements IIndexChangeListener
|
||||||
fail("Unable to create project"); //$NON-NLS-1$
|
fail("Unable to create project"); //$NON-NLS-1$
|
||||||
|
|
||||||
indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
||||||
indexManager.reset();
|
//indexManager.reset();
|
||||||
//Get the indexer used for the test project
|
//Get the indexer used for the test project
|
||||||
sourceIndexer = (SourceIndexer) indexManager.getIndexerForProject(testProject);
|
sourceIndexer = (SourceIndexer) indexManager.getIndexerForProject(testProject);
|
||||||
sourceIndexer.addIndexChangeListener(this);
|
sourceIndexer.addIndexChangeListener(this);
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class FileBasePluginTest extends TestCase {
|
||||||
|
|
||||||
private void initialize(Class aClassName){
|
private void initialize(Class aClassName){
|
||||||
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
||||||
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
workspace = ResourcesPlugin.getWorkspace();
|
workspace = ResourcesPlugin.getWorkspace();
|
||||||
|
|
|
@ -45,7 +45,7 @@ abstract public class BaseTestFramework extends TestCase {
|
||||||
static protected SourceIndexer sourceIndexer;
|
static protected SourceIndexer sourceIndexer;
|
||||||
{
|
{
|
||||||
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
||||||
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
workspace = ResourcesPlugin.getWorkspace();
|
workspace = ResourcesPlugin.getWorkspace();
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
||||||
typeCacheManager.setProcessTypeCacheEvents(false);
|
typeCacheManager.setProcessTypeCacheEvents(false);
|
||||||
|
|
||||||
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
|
||||||
indexManager.reset();
|
//indexManager.reset();
|
||||||
|
|
||||||
sourceIndexer = (SourceIndexer) CCorePlugin.getDefault().getCoreModel().getIndexManager().getIndexerForProject(project);
|
sourceIndexer = (SourceIndexer) CCorePlugin.getDefault().getCoreModel().getIndexManager().getIndexerForProject(project);
|
||||||
sourceIndexer.addIndexChangeListener( this );
|
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();
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
workspace = ResourcesPlugin.getWorkspace();
|
workspace = ResourcesPlugin.getWorkspace();
|
||||||
|
|
|
@ -51,9 +51,6 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
final AutomatedIntegrationSuite suite = new AutomatedIntegrationSuite();
|
final AutomatedIntegrationSuite suite = new AutomatedIntegrationSuite();
|
||||||
|
|
||||||
//TODO: BOG take this out once TypeCache issues resolved
|
|
||||||
disableIndexUpgrades();
|
|
||||||
|
|
||||||
// Add all success tests
|
// Add all success tests
|
||||||
suite.addTest(CDescriptorTests.suite());
|
suite.addTest(CDescriptorTests.suite());
|
||||||
//suite.addTest(GCCErrorParserTests.suite());
|
//suite.addTest(GCCErrorParserTests.suite());
|
||||||
|
@ -80,12 +77,4 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
||||||
return suite;
|
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
|
2005-03-13 Bogdan Gheorghe
|
||||||
Added support for new indexer framework
|
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
|
2005-03-12 Bogdan Gheorghe
|
||||||
Restructured indexer framework to allow for multiple indexers in a workspace.
|
Restructured indexer framework to allow for multiple indexers in a workspace.
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,8 @@ public class IndexManager extends JobManager{
|
||||||
//Upgrade index version
|
//Upgrade index version
|
||||||
private boolean upgradeIndexEnabled = false;
|
private boolean upgradeIndexEnabled = false;
|
||||||
private int upgradeIndexProblems = 0;
|
private int upgradeIndexProblems = 0;
|
||||||
private boolean upgradeProjects = true;
|
|
||||||
|
|
||||||
|
private ReadWriteMonitor monitor = new ReadWriteMonitor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an indexer only on request
|
* Create an indexer only on request
|
||||||
|
@ -96,36 +96,75 @@ public class IndexManager extends JobManager{
|
||||||
/**
|
/**
|
||||||
* Flush current state
|
* Flush current state
|
||||||
*/
|
*/
|
||||||
public void reset() {
|
public synchronized void reset() {
|
||||||
super.reset();
|
super.reset();
|
||||||
|
|
||||||
initializeIndexersMap();
|
initializeIndexersMap();
|
||||||
this.indexerMap = new HashMap(5);
|
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);
|
*/
|
||||||
|
private void initializeIndexerID() {
|
||||||
// Try to load one for the project
|
IProject[] projects = CCorePlugin.getWorkspace().getRoot().getProjects();
|
||||||
if (indexerID == null) {
|
//Make sure that all projects are added to the indexer map and updated
|
||||||
indexerID = loadIndexerIDFromCDescriptor(project);
|
//where neccesary
|
||||||
|
for (int i=0; i<projects.length; i++){
|
||||||
|
try {
|
||||||
|
initializeIndexer(projects[i]);
|
||||||
|
} catch (CoreException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
|
|
||||||
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){
|
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;
|
ICDTIndexer indexer = null;
|
||||||
indexer = (ICDTIndexer) indexerMap.get(project);
|
indexer = (ICDTIndexer) indexerMap.get(project);
|
||||||
|
|
||||||
|
@ -344,37 +386,21 @@ public class IndexManager extends JobManager{
|
||||||
indexerID = (String) project.getSessionProperty(indexerIDKey);
|
indexerID = (String) project.getSessionProperty(indexerIDKey);
|
||||||
} catch (CoreException e) {}
|
} catch (CoreException e) {}
|
||||||
|
|
||||||
if (indexerID == null){
|
//Any persisted indexders would have been loaded in the initialization
|
||||||
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;
|
|
||||||
|
|
||||||
//Create the indexer and store it
|
//Create the indexer and store it
|
||||||
indexer = getIndexer(indexerID);
|
indexer = getIndexer(indexerID);
|
||||||
indexerMap.put(project,indexer);
|
indexerMap.put(project,indexer);
|
||||||
|
|
||||||
|
monitor.exitRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
return indexer;
|
return indexer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param project
|
* @param project
|
||||||
*/
|
*/
|
||||||
private void doSourceIndexerUpgrade(IProject project) {
|
private synchronized void doSourceIndexerUpgrade(IProject project) {
|
||||||
ICDescriptor descriptor = null;
|
ICDescriptor descriptor = null;
|
||||||
Element rootElement = null;
|
Element rootElement = null;
|
||||||
IProject newProject = null;
|
IProject newProject = null;
|
||||||
|
@ -429,7 +455,7 @@ public class IndexManager extends JobManager{
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String doProjectUpgrade(IProject project) {
|
private synchronized String doProjectUpgrade(IProject project) {
|
||||||
ICDescriptor descriptor = null;
|
ICDescriptor descriptor = null;
|
||||||
Element rootElement = null;
|
Element rootElement = null;
|
||||||
IProject newProject = null;
|
IProject newProject = null;
|
||||||
|
@ -562,18 +588,9 @@ protected ICDTIndexer getIndexer(String indexerId) {
|
||||||
while (i.hasNext()){
|
while (i.hasNext()){
|
||||||
IProject tempProject = (IProject) i.next();
|
IProject tempProject = (IProject) i.next();
|
||||||
ICDTIndexer indexer = (ICDTIndexer) indexerMap.get(tempProject);
|
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;
|
IIncludeEntry include = (IIncludeEntry)entry;
|
||||||
|
|
||||||
IPath basePath = include.getBasePath();
|
IPath basePath = include.getBasePath();
|
||||||
basePath = varManager.resolvePath(basePath);
|
if (varManager != null)
|
||||||
|
basePath = varManager.resolvePath(basePath);
|
||||||
|
|
||||||
IPath includePath = include.getIncludePath();
|
IPath includePath = include.getIncludePath();
|
||||||
includePath = varManager.resolvePath(includePath);
|
if (varManager != null)
|
||||||
|
includePath = varManager.resolvePath(includePath);
|
||||||
|
|
||||||
return CoreModel.newIncludeEntry(resourcePath, basePath, includePath,
|
return CoreModel.newIncludeEntry(resourcePath, basePath, includePath,
|
||||||
include.isSystemInclude(), include.getExclusionPatterns(), include.isExported());
|
include.isSystemInclude(), include.getExclusionPatterns(), include.isExported());
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ContentAssistTests extends TestCase {
|
||||||
static FileManager fileManager;
|
static FileManager fileManager;
|
||||||
static boolean disabledHelpContributions = false;
|
static boolean disabledHelpContributions = false;
|
||||||
{
|
{
|
||||||
(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
workspace = ResourcesPlugin.getWorkspace();
|
workspace = ResourcesPlugin.getWorkspace();
|
||||||
|
|
Loading…
Add table
Reference in a new issue