mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 14:15:23 +02:00
Bug 351271 - Unused header will be removed from index when saved. Fix
without API changes.
This commit is contained in:
parent
fc4ef1bc10
commit
1feac1a80a
3 changed files with 6 additions and 10 deletions
|
@ -97,14 +97,6 @@ public interface IIndexManager extends IPDOMManager {
|
|||
*/
|
||||
public final static int FORCE_INDEX_INCLUSION= 0x20;
|
||||
|
||||
/**
|
||||
* Causes files previously included in the index due to FORCE_INDEX_INCLUSION to loose
|
||||
* their index inclusion privilege. The files included only due to FORCE_INDEX_INCLUSION,
|
||||
* will be removed from the index.
|
||||
* @since 5.4
|
||||
*/
|
||||
public final static int RESET_INDEX_INCLUSION= 0x40;
|
||||
|
||||
/**
|
||||
* Returns the index for the given project.
|
||||
* @param project the project to get the index for
|
||||
|
|
|
@ -115,6 +115,8 @@ import com.ibm.icu.text.MessageFormat;
|
|||
*/
|
||||
public class PDOMManager implements IWritableIndexManager, IListener {
|
||||
private static final String TRACE_INDEXER_SETUP = CCorePlugin.PLUGIN_ID + "/debug/indexer/setup"; //$NON-NLS-1$
|
||||
// Temporary hack to avoid API changes.
|
||||
private static final int RESET_INDEX_INCLUSION = IIndexManager.FORCE_INDEX_INCLUSION << 1;
|
||||
|
||||
private final class PCL implements IPreferenceChangeListener {
|
||||
private ICProject fProject;
|
||||
|
@ -1377,7 +1379,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((options & IIndexManager.RESET_INDEX_INCLUSION) != 0) {
|
||||
if ((options & RESET_INDEX_INCLUSION) != 0) {
|
||||
for (ICElement element : filesAndFolders) {
|
||||
if (element instanceof ITranslationUnit) {
|
||||
ITranslationUnit tu = (ITranslationUnit) element;
|
||||
|
|
|
@ -1253,6 +1253,8 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
|||
}
|
||||
|
||||
private static class IndexUpdateRequestorJob extends Job {
|
||||
// Temporary hack to avoid API changes.
|
||||
private static final int RESET_INDEX_INCLUSION = IIndexManager.FORCE_INDEX_INCLUSION << 1;
|
||||
private final ITranslationUnit tuToAdd;
|
||||
private final ITranslationUnit tuToReset;
|
||||
|
||||
|
@ -1274,7 +1276,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
|||
IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||
if (tuToReset != null) {
|
||||
indexManager.update(new ICElement[] { tuToReset },
|
||||
IIndexManager.RESET_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS);
|
||||
RESET_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS);
|
||||
}
|
||||
if (tuToAdd != null) {
|
||||
indexManager.update(new ICElement[] { tuToAdd },
|
||||
|
|
Loading…
Add table
Reference in a new issue