Bug 133386 - Photran-based patch for superficial multilanguage support
Summary: Photran-based patch for superficial multilanguage support
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.1   Edit
Assignee: Doug Schaefer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-03-27 11:43 EST by Jeffrey Overbey CLA
Modified: 2020-11-03 14:48 EST (History)
6 users (show)

See Also:


Attachments
Photran-based patch for superficial multilanguage support (20.46 KB, patch)
2006-03-27 11:44 EST, Jeffrey Overbey CLA
no flags Details | Diff
Revised patch (3/27/06) (18.02 KB, patch)
2006-03-27 16:12 EST, Jeffrey Overbey CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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