Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] exclude from build and IResourceChangeEvent

Hi

background:
When I exclude a .c file from build I get a IResourceDelta in my IResourceDeltaVisitor saying that the mycproject.cproject file has changed... that's ok..
but how do I get to know which file was excluded and from what build? It seems odd that the IResourceChangedEvent doesn't tell me about the files that have been excluded/included but only that the .cproject has changed.

THE QUESTION:
Do I have to manually visit all files in a project and their IConfiguration or is there a smarter way like getExcludedFilesChangedFromProject(IProject) or similiar?

for (IFile file : projectFiles) {
    IConfiguration configurations[] = getAllConfigurations(iProject);
    for(IConfiguration configuration : configurations) {
        // TODO: decide how to handle configurations, Debug and Release is a HACK
        if(configuration.getName().equals("Debug") || configuration.getName().equals("Release")) {
            if (!isExcluded(configuration, file)) {
                files.add(file);
            } else {
                Printer.out("file: " + file.toString() + " is Exluded in configuration: " + configuration.getName());
            }
        }
    }
}       

public boolean isExcluded(IConfiguration iConfiguration, IFile iFile) {
    ICSourceEntry [] sourceEntries = iConfiguration.getSourceEntries();
    return CDataUtil.isExcluded(iFile.getProjectRelativePath(), sourceEntries);
}

/Jimmie

Back to the top