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

Thanks Markus.

I there another way to specify which files/folders should be indexed, without needing to set KEY_INDEX_ALL_FILES to "true".

It seems that IIndexManager.update(new ICElement[] {project}) only works when the corresponding files contained in the project can be indexed regarding KEY_INDEX_...
Am I right?


--
Nicolas.

Schorn, Markus wrote:
Nicolas,
try to use IndexerPreferences.set(prj,
IndexerPreferences.KEY_INDEX_ALL_FILES, "true"),
the indexer should kick in automatically.
This is not an API, however for the purpose of testing it should be
sufficient.

Markus.

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Nicolas Musset
Sent: Wednesday, July 22, 2009 3:34 PM
To: CDT General developers list.
Subject: [cdt-dev] Set property indexAllFiles
Importance: Low


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
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev