Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Changes to UI not being displayed
Changes to UI not being displayed [message #1018993] Thu, 14 March 2013 21:29 Go to next message
Steve Kallestad is currently offline Steve KallestadFriend
Messages: 62
Registered: March 2013
I'm sure this is a *me* problem, not an xtext problem.

I have a very basic project set up.

I wanted to update the labels that show up in the UI.

I went into the mydsl.ui project under the /src directory and edited the files and

I added a simple function:

public String text(IEObjectDescription ele){
   return ("prefix: " + ele.getName());

I *thought* this would result in things like the outline showing "prefix: " before the name, but it didn't make any change in the UI.

I did regenerate the mwe workflow and doublechecked that the regeneration did not overwrite my changes.

My question is... why didn't the change show up in the UI?

I'm sure I missed a step. Either that, or I am confused on how to change the labels.
Re: Changes to UI not being displayed [message #1019018 is a reply to message #1018993] Thu, 14 March 2013 22:33 Go to previous message
Steve Kallestad is currently offline Steve KallestadFriend
Messages: 62
Registered: March 2013

This was a me problem.

For those who like me were confused...

I had two issues:

1) I did not use @Inject
2) I didn't understand that the IEObjectDescription comes from my model.

public class MyDslLabelProvider extends DefaultEObjectLabelProvider {

	public MyDslLabelProvider (AdapterFactoryLabelProvider delegate) {
	public String text(ElementToRelabel ele){
		return "prefix" + ele.getName();

where ElementToRelabel is any of your parser rules that you set up.

i.e. if you have something like this in your .xtext:
	'entity' name=ID '{'

Then to relabel an Entity:
	public String text(Entity entity){
		return "Entity: " + entity.getName();

It will still work if you don't use @Inject, but you lose the graphical decorators on the outline.

This is useful at the moment for me to relabel some "<unnamed>" elements in my outline tree.
	public String text(UnNamedThing noname){
		return "A fixed string";

I still might potentially remove them from the tree, but for now giving them a name helps me to visualize things a bit.
Previous Topic:ImportURI for ecore models and Xbase scoping
Next Topic:Xtext Integration with GMF
Goto Forum:

Current Time: Tue Jun 02 15:49:45 GMT 2020

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

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

Back to the top