From 1feac1a80ae37ea8d80e23da5760e202aa65b498 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 17 Jul 2011 18:27:36 -0700 Subject: [PATCH] Bug 351271 - Unused header will be removed from index when saved. Fix without API changes. --- .../parser/org/eclipse/cdt/core/index/IIndexManager.java | 8 -------- .../org/eclipse/cdt/internal/core/pdom/PDOMManager.java | 4 +++- .../src/org/eclipse/cdt/internal/ui/editor/CEditor.java | 4 +++- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java index e1f77cc0472..6455d741557 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java @@ -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 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java index 53bbedadd8e..496142cc0ae 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java @@ -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; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index 7d92162159d..21420fc4577 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -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 },