Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem with content assist icons
Problem with content assist icons [message #646715] Thu, 30 December 2010 11:54 Go to next message
Chandramouli  is currently offline Chandramouli Friend
Messages: 6
Registered: June 2010
Junior Member
Hi

I have defined grammar like below

Poller:
'Poller' name=ID '{'
((
'directory' directory=STRING
('append' append=Boolean)?
'}';

Here, 'directory' is mandatory and 'append' is optional.
I want to have different icons for them.
I tried extending DefaultEObjectLabelProvider. But it provides option only for 'Poller' like this:

String image(Poller p) {
return "poller.gif";
}

How to do this for 'directory' and 'append' properties?
Re: Problem with content assist icons [message #646717 is a reply to message #646715] Thu, 30 December 2010 12:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13322
Registered: July 2009
Senior Member
Hi,

it is an EObjectLabelProvider and no a EStructuralFeatureLabelProvider.

btw. the properties don't appear in the outline at all so why do you want them to have an icon? or did you change the MyDslTransformer?

or do you want to have different icons for append/non append Pollers?
then just ask the Poller for it's property.

Update: just read it is about content assist:

create your own completion rule and therein invoke

createCompletionProposal(proposal, displayString, image, contentAssistContext);


~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 30 December 2010 12:13]

Report message to a moderator

Re: Problem with content assist icons [message #646779 is a reply to message #646717] Fri, 31 December 2010 04:38 Go to previous messageGo to next message
Chandramouli  is currently offline Chandramouli Friend
Messages: 6
Registered: June 2010
Junior Member
Thanks Christian.

But if I implement createCompletionProposal, it is invoked after the attribute name is entered i.e., when the attribute value needs to be entered.

But I am able to get the control by implementing doCreateProposal method.

Is there any way to know if the attribute is mandatory or optional at runtime?

Otherwise I'll need to hardcode the attribute names.


Re: Problem with content assist icons [message #1339679 is a reply to message #646779] Wed, 07 May 2014 19:58 Go to previous message
Markus Duft is currently offline Markus DuftFriend
Messages: 148
Registered: February 2013
Senior Member
for anybody else searching for a solution, it seems to work to implement this in the normal label provider

def image(Keyword kw) {
    switch(kw) {
        case myGrammarAccess.someAccess.myKeyword_1_1: "myimg.png"
        default: null
    }
}


this leaves all icons the same except for the one keyword's...

[Updated on: Wed, 07 May 2014 19:58]

Report message to a moderator

Previous Topic:serializing: how to?
Next Topic:How to change the namespace separator ?
Goto Forum:
  


Current Time: Tue Jan 28 16:28:05 GMT 2020

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

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

Back to the top