Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Set property indexAllFiles

Hi.

In order to run a test, I need to set the property KEY_INDEX_ALL_FILES to true. I try doing so, but apparently it does not work since PDOM did not contains the expected entries:

   private boolean forceIndexAllFiles() throws CModelException {
       // get the preferences
       IPreferencesService prefService = Platform.getPreferencesService();
Preferences[] prefs = {new ProjectScope(fProject.getProject()).getNode(CCorePlugin.PLUGIN_ID).node("indexer")};

       String restore = prefService.get("indexAllFiles", "false", prefs);
       prefs[0].put("indexAllFiles", "true");

       return restore.equalsIgnoreCase("true");
   }

And then, I force the indexer to index the project again:

       // Get the name of the project
       String projectName = fProject.getName();

       // Retrieve the CProject
       ICProject cproject = CCorePlugin.getDefault().getCoreModel()
       .getCModel().getCProject(projectName);

       // If no CProject can be found, there is no need to continue
       assertNotNull(cproject);

       IIndexManager indexManager = CCorePlugin.getIndexManager();
       if (indexManager.isProjectIndexed(cproject)) {
indexManager.setIndexerId(cproject, IIndexManager.ID_FAST_INDEXER);
       }
       indexManager.reindex(cproject);

if (!indexManager.isIndexerIdle() || indexManager.isIndexerSetupPostponed(cproject)) { indexManager.joinIndexer(IIndexManager.FOREVER, new NullProgressMonitor());
       }

I think that I may have to tell the Indexer that the property has changed, but I don't know how.

I'm running this test with CDT 4.0.

--
Nicolas


Back to the top