Re: Modifying Content assist, and notifying linking service [message #58608] |
Tue, 14 July 2009 15:55 |
Eclipse User |
|
|
|
Hi Durga,
as this is a TMF related question, I added the right newsgroup to the
recipients of this reply.
You actually had the right idea: Your problem is not only related to
content assist but to the linking stage, too. Xtext has a special
service that solves the somewhat complicated task of collecting all
referable objects. It is the IScopeProvider.
What you actually have to do is to implement a custom scope provider
service, that will create an IScope based on the content of your repository.
If you have any further questions regarding the scope provider
interface, please don't hesitate to ask them in the TMF newsgroup.
Regards,
Sebastian
Am 14.07.2009 12:57 Uhr, schrieb Durga Prasana Sahoo:
> Hi All
>
> I want to modify/enhance my tmf editor's content assist in a manner
> specific to my requirements.
>
> Actually, I have a grammar, that I'm using in fragements for managing
> model elements.It's like, I have a navigation view that shows the
> various model elements in the repository and when one clicks on any
> particular element, I invoke the editor that shows up the code for that
> particular element, instead of showing the concrete model for the entire
> model.
>
> So, I need to somehow modify the content assist, So as to show the list
> of possible elements that can be crossreferenced from the repository,
> while editing the code for any particular attribute of an element.
>
> ____________________________________________________________ _______________
> public void complete[TypeName]_[FeatureName](
> EObject model, Assignment assignment, ContentAssistContext context,
> ICompletionProposalAcceptor acceptor) {
> // clients may override
> }
>
> public void complete_[RuleName](
> EObject model, RuleCall ruleCall, ContentAssistContext context,
> ICompletionProposalAcceptor acceptor) {
> // clients may override
> }
> ____________________________________________________________ _______________
>
> I was going through the XText docs, and it seems if I can redefine the
> above prototype methods in EdificeProposalProvider.java('Edifice' is my
> grammar),
> then I can possibly get the names of possible elements in repository
> while invoking content assist for an attribute.
>
> Cud anyone pls tell me how to feed in the list of valid elements that
> can be crossreferenced for an attribute.
>
> ____________________________________________________________ _______________
>
> say, I have an (of kind MessageType){Object[] objs} array(this means
> that there are actually objects of type MessageType in the repository
> which can be crossreferenced).
> and I want to feed in the names of these objects for the content assist of
> attrib input/output of Operation:
>
> Operation returns refn_staticstructure::Operation:
> 'Operation' id=STRING ':' name=STRING '{'
> //parent attrib(s)
> 'doc:' documentation=STRING';'
> //class specific attributes
> ('input:' input=[refn_staticstructure::MessageType])? ';'
> ('output:' output=[refn_staticstructure::MessageType])? ';'
> 'throwsExceptions:' (throwsExceptions+=OperationException)* ';'
> '}'
>
> ;
>
> ____________________________________________________________ ________________
>
>
> how do I modify:
>
> public void completeOperation_input(
> EObject model, Assignment assignment, ContentAssistContext context,
> ICompletionProposalAcceptor acceptor) {
>
> //code snippet to feed in the names of valid crossreferenceable objects ??
>
> }
>
>
> Any suggestions
>
> ____________________________________________________________ ________________
>
>
> In addition to it, I need 2 somehow transmit this information to the
> default
> linking service that indeed doesn't know that these elements can indeed
> be crossreferenced, and avoid showing error marks.
>
> (Since every time an element from repository view is invoked, I create a
> concrete model file pertaining to that element from the repository.xml
> using XPand2, So the entire concrete model is actually split into multiple
> <element_name>.edifice files).
>
> any advice??
> :)
>
>
> Thanks.
>
> Durga
>
|
|
|
Powered by
FUDForum. Page generated in 0.02851 seconds