Bug 133386

Summary: Photran-based patch for superficial multilanguage support
Product: [Tools] CDT Reporter: Jeffrey Overbey <com-eclipse-dot-org>
Component: cdt-coreAssignee: Doug Schaefer <cdtdoug>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: beth, com-eclipse-dot-org, dinglis, leo.treggiari, mikhail.sennikovskiy, mschorn.eclipse
Version: 3.1Keywords: contributed
Target Milestone: 3.1   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/171714
Whiteboard:
Attachments:
Description Flags
Photran-based patch for superficial multilanguage support
none
Revised patch (3/27/06) bjorn.freeman-benson: iplog+

Description Jeffrey Overbey CLA 2006-03-27 11:43:23 EST
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
Comment 1 Jeffrey Overbey CLA 2006-03-27 11:44:50 EST
Created attachment 36996 [details]
Photran-based patch for superficial multilanguage support
Comment 2 Doug Schaefer CLA 2006-03-27 13:15:38 EST
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 3 Jeffrey Overbey CLA 2006-03-27 16:11:16 EST
Comment on attachment 36996 [details]
Photran-based patch for superficial multilanguage support

Replaced with 3/27 patch
Comment 4 Jeffrey Overbey CLA 2006-03-27 16:12:46 EST
Created attachment 37020 [details]
Revised patch (3/27/06)

Thanks Doug.  Please see the revised patch.
Comment 5 Doug Schaefer CLA 2006-03-29 11:19:04 EST
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.
Comment 6 Jeffrey Overbey CLA 2006-03-29 11:25:24 EST
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.
Comment 7 David Inglis CLA 2006-03-30 09:22:21 EST
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.
Comment 8 David Inglis CLA 2006-03-30 09:27:56 EST
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.
> 

Comment 9 Jeffrey Overbey CLA 2006-03-30 11:32:10 EST
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...
Comment 10 Eclipse Genie CLA 2020-11-03 14:48:10 EST
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/171714