mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Fix for 97281: [CTags Indexer] requires the project to be closed/opened to work
This commit is contained in:
parent
fa4497f2fa
commit
0d77c8e7e2
2 changed files with 16 additions and 14 deletions
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.index.ICDTIndexer;
|
||||||
import org.eclipse.cdt.core.index.IIndexChangeListener;
|
import org.eclipse.cdt.core.index.IIndexChangeListener;
|
||||||
import org.eclipse.cdt.core.index.IIndexStorage;
|
import org.eclipse.cdt.core.index.IIndexStorage;
|
||||||
import org.eclipse.cdt.core.index.IndexChangeEvent;
|
import org.eclipse.cdt.core.index.IndexChangeEvent;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.parser.util.ObjectSet;
|
import org.eclipse.cdt.core.parser.util.ObjectSet;
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||||
|
@ -428,8 +429,21 @@ public class DOMSourceIndexer extends AbstractCExtension implements ICDTIndexer
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICDTIndexer.COMPILATION_UNIT:
|
case ICDTIndexer.COMPILATION_UNIT:
|
||||||
|
//if the element has changed check to see if file is header, if it is don't schedule for index - update dependencies will
|
||||||
|
//take care of it.
|
||||||
|
//otherwise just schedule element for index
|
||||||
|
boolean shouldAddFile=false;
|
||||||
IFile file = (IFile) delta.getResource();
|
IFile file = (IFile) delta.getResource();
|
||||||
this.addSource(file, project.getFullPath());
|
|
||||||
|
if (delta.getKind()==IResourceDelta.CHANGED){
|
||||||
|
if (CoreModel.isValidSourceUnitName(project, file.getName()))
|
||||||
|
shouldAddFile=true;
|
||||||
|
} else {
|
||||||
|
shouldAddFile = true;
|
||||||
|
}
|
||||||
|
if (shouldAddFile){
|
||||||
|
this.addSource(file, project.getFullPath());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -618,19 +618,7 @@ public class DeltaProcessor {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICElement.C_UNIT:
|
case ICElement.C_UNIT:
|
||||||
//if the element has changed check to see if file is header, if it is don't schedule for index - update dependencies will
|
indexManager.addResourceEvent(element.getCProject().getProject(),delta, ICDTIndexer.COMPILATION_UNIT);
|
||||||
//take care of it.
|
|
||||||
//otherwise just schedule element for index
|
|
||||||
boolean shouldAddFile=false;
|
|
||||||
IProject project = element.getCProject().getProject();
|
|
||||||
if (elementHasChanged){
|
|
||||||
if (CoreModel.isValidSourceUnitName(project, element.getElementName()))
|
|
||||||
shouldAddFile=true;
|
|
||||||
} else {
|
|
||||||
shouldAddFile = true;
|
|
||||||
}
|
|
||||||
if (shouldAddFile)
|
|
||||||
indexManager.addResourceEvent(project,delta, ICDTIndexer.COMPILATION_UNIT);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue