Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Using Label Figure as decorator
Using Label Figure as decorator [message #1816884] Sun, 10 November 2019 10:59 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 312
Registered: December 2015
Senior Member
Hi,

I want to return a Label figure as the result of a decorator expression:

public IFigure decoratorExpression(EObject context) {
final Label label = new Label("5");
label.setFont(JFaceResources.getDefaultFont());
return label;
}

but there seems to be something that I'm missing, since the label isn't drawn.

Anyone done this before?
Thanks,
Felix
Re: Using Label Figure as decorator [message #1816918 is a reply to message #1816884] Tue, 12 November 2019 08:11 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 164
Registered: October 2014
Senior Member
Hello

Difficult to know what is going just with your message but I can give some leads to understand better.

Your expression that creates the figure is called in org.eclipse.sirius.diagram.ui.tools.internal.decoration.DescribedDecorationDescriptorProvider.initializeDecorationDescriptor(Decoration, DDiagramElement, UIState, DRepresentation, Session)
and then used org.eclipse.sirius.diagram.ui.tools.internal.decoration.SiriusGenericDecorator.getDecorationFigure(DecorationDescriptor, boolean)

As a first step you could check that it is good at this point.

Best regards
Laurent


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Using Label Figure as decorator [message #1817120 is a reply to message #1816918] Fri, 15 November 2019 16:45 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 312
Registered: December 2015
Senior Member
It works if I set the figure's bounds beforehand:
 this.label = new Label(getLabelText(element));
 label.setTextAlignment(Label.RIGHT);
 label.setFont(JFaceResources.getDefaultFont());
 Rectangle bounds = label.getTextBounds();
 label.setBounds(bounds);
 return label;


Now I have a new problem: The decoration expression is not re-evaluated when the semantic element changes, neither when I click the 'refresh' button to manually refresh the diagram.

Previous Topic:trigger refresh on filter
Next Topic:Validation markers on diagram
Goto Forum:
  


Current Time: Wed Feb 26 20:40:38 GMT 2020

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

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

Back to the top