Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ProposalProvider example
ProposalProvider example [message #686135] Sun, 19 June 2011 18:00 Go to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Does anybody has an example for a proposal provider implementation. I'd
like to have the following:

..my-rule {
border-top-style: <<CTRL+SPACE>>
}


When hitting CTRL+SPACE I'd like to popup a list of styles
(none,hidden,dotted,....)

I think I have to reimplement the following method:

> @Override
> public void complete_expr(EObject model, RuleCall ruleCall,
> ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
> if( model instanceof css_generic_declaration ) {
> css_generic_declaration o = (css_generic_declaration) model;
> if( "border-top-style".equals(o.getProperty())) {
> // do something here
> }
> } else {
> super.complete_expr(model, ruleCall, context, acceptor);
> }
> }

but i have no idea what to write there.

Tom
Re: ProposalProvider example [message #686138 is a reply to message #686135] Mon, 20 June 2011 07:29 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Tom,

does this blog-post help?
http://zarnekow.blogspot.com/2011/06/customizing-content-assist-with-xtext.html

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 19.06.11 20:00, schrieb Tom Schindl:
> Hi,
>
> Does anybody has an example for a proposal provider implementation. I'd
> like to have the following:
>
> .my-rule {
> border-top-style:<<CTRL+SPACE>>
> }
>
>
> When hitting CTRL+SPACE I'd like to popup a list of styles
> (none,hidden,dotted,....)
>
> I think I have to reimplement the following method:
>
>> @Override
>> public void complete_expr(EObject model, RuleCall ruleCall,
>> ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
>> if( model instanceof css_generic_declaration ) {
>> css_generic_declaration o = (css_generic_declaration) model;
>> if( "border-top-style".equals(o.getProperty())) {
>> // do something here
>> }
>> } else {
>> super.complete_expr(model, ruleCall, context, acceptor);
>> }
>> }
>
> but i have no idea what to write there.
>
> Tom
Re: ProposalProvider example [message #686142 is a reply to message #686138] Mon, 20 June 2011 07:59 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Yes thank you very much - that's exactly what I need!

Tom

Am 20.06.11 09:29, schrieb Sebastian Zarnekow:
> Hi Tom,
>
> does this blog-post help?
> http://zarnekow.blogspot.com/2011/06/customizing-content-assist-with-xtext.html
>
>
> Regards,
> Sebastian
Previous Topic:XText in Web Text Editors
Next Topic:How to get textual dsl file from EMF model (XMI)
Goto Forum:
  


Current Time: Tue Apr 23 15:23:24 GMT 2024

Powered by FUDForum. Page generated in 0.02859 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top