Community
Participate
Working Groups
I attached a patch which is basically equivalent to what I proposed at the CDT Developers' Summit last fall. Some identifiers have changed--it extends ILanguage and LanguageManager now--but it is otherwise the same. Essentially, this allows us to supply our own model builder and have its elements show up in the Outline and Make Projects views. For now, Photran's ILanguage will return null for all of the getTranslationUnit methods in ILanguage; so far that doesn't seem to be a problem. Hopefully later we'll integrate properly into the PDOM... Jeff Overbey
Created attachment 36996 [details] Photran-based patch for superficial multilanguage support
Thanks Jeff. Looks pretty good. I have a few requests, though, to start. - Move IContributed* to the org.eclipse.cdt.core.model package (i.e. no need for a separate package). - Change the parameter in ILanguage.createModelBulider to be ITranslationUnit instead of TranslationUnit which is an interal class. I'm not sure how that will impact your code. - Instead of getting the baseImageDescriptor from the ICElement, which is a non-UI class, you should probably create an adapter to get a UI class and get the image descriptor that way. That'll reduce the crazy casts you've got going there.
Comment on attachment 36996 [details] Photran-based patch for superficial multilanguage support Replaced with 3/27 patch
Created attachment 37020 [details] Revised patch (3/27/06) Thanks Doug. Please see the revised patch.
I have committed the new patch. I am a bit concerned about the setter in ITranslationUnit. I'm not sure it fits there since it isn't intended to be used by general clients of this interface. But we can revisit it when we do an API review of the CModel for CDT 4.0.
Thanks for your help. We are obviously nowhere near a "complete" (or "good") API for language integration (our FortranElement hierarchy is a great example of what a hack looks like), but this is a tremendous help for us Photran folk.
I noticed this change that went in for contributed model elements and I'm curious how this works for more then one contribution within the model since only one adapter factory can provide the interfaces for a given interface. Seems to me that this need some type of language registry with a delegating presentation mechanism, kinda like the debug model.
BTW, I'm specifically referring to the image provider class. (In reply to comment #7) > I noticed this change that went in for contributed model elements and I'm > curious how this works for more then one contribution within the model since > only one adapter factory can provide the interfaces for a given interface. > Seems to me that this need some type of language registry with a delegating > presentation mechanism, kinda like the debug model. >
Good point. In Photran, we don't register an adapter factory; we just implement getAdapter on the new elements directly. We can get away with that since we dumped all the CDT integration stuff--core and UI--in a single plug-in. (From Photran's perspective, the CModel is just infrastructure to get the eye candy we want, so all of this is UI for us. For now, anyway...) But that's a pretty idiosyncratic approach. Your point stands...
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/171714