Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Getting a list of binaries before workbench has loaded


A plugin I'm developing at one point uses the CDT to get the list of binaries in C/C++ projects in the workspace. The problem is, with this code snippet:

ICProject [] projs = CoreModel.getDefault().getCModel().getCProjects();
IBinary [] bins = null;
for (ICProject p : projs) {
  IBinaryContainer cont = p.getBinaryContainer();
  bins = p.getBinaryContainer().getBinaries();

The plugin has a TreeViewer widget which will eventually run this snippet. The problem is when eclipse starts and the TreeViewer is first being populated, the call to getBinaries() fails and returns no elements - when there are. After the workbench has loaded and this snippet is run again, the correct information is gathered.

Looking into the CDT source, it seems to be in org.eclipse.cdt.internal.core.model.CElement.getElementInfo(...) that there isn't any information at the time of the call, so a new CElementInfo is created (which obviously doesn't have the information I need).

So my question is, is there a hook or specific time that I would have to wait to call this snippet to be able to get the information I need? When does the CDT parse the projects for their binaries? Any other ideas?

Thanks in advance,

Kent Sebastian

Back to the top