Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Sprotty » Sprotty from Graphical Change to Text (xtext theia sprotty dsl)
Sprotty from Graphical Change to Text [message #1832337] Wed, 16 September 2020 14:46 Go to next message
Cagdas Yetim is currently offline Cagdas YetimFriend
Messages: 1
Registered: September 2020
Junior Member
I created a simple dsl, and connected it with theia and Sprotty Server.(sprotty in Theia) What I did not understand is, trace of Attribute.

Change from text to graphic works good, but if I change text of a label (which is a STRING in DSL) it doesn't affect to text.

sprotty version is 0.8.0

dsl -->
Point:
	'point' name=ID
	'{'
		('description:' description=STRING)?
		'abbreviation:' abbreviation=STRING
	'}'
;


theia -->
export class RuleLabel extends SLabel implements EditableLabel {
    hasFeature(feature: symbol): boolean {
        return feature === editLabelFeature || super.hasFeature(feature);
    }
}

@injectable()
export class RuleLabelView implements SLabelView {
    render(label: Readonly<RuleLabel>, context: RenderingContext): VNode {
        const vnode = 
            <text class-sprotty-label={true}>
                {label.text}
            </text>;
        const subType = getSubType(label);
        if (subType)
            setAttr(vnode, 'class', subType);
        return vnode;
    }
}

register in theia
configureModelElement(context, 'label:rule', RuleLabel, RuleLabelView);

Sprotty graphic generator -->
def SModelElement createPoint(Point point, extension Context context){
		val theId = idCache.uniqueId('point_' + point.name)
		(new SNode[
			id = theId
			children = #[
				(new SLabel[
					id= theId + '.description'
					type = 'label:rule'
					text = point.description
					layoutOptions = new LayoutOptions [
						VGap = 1.0
					]
				]).trace(point, RulePackage.Literals.POINT__DESCRIPTION, -1)
			]
			layout = 'vbox'
			layoutOptions = new LayoutOptions [
				paddingTop = 10.0
				paddingBottom = 10.0
				paddingLeft = 10.0
				paddingRight = 10.0
			]
		]).traceAndMark(point,context)
	}

Can somebody help to me please ? what am I doing wrong ?

[Updated on: Thu, 17 September 2020 13:30]

Report message to a moderator

Re: Sprotty from Graphical Change to Text [message #1832543 is a reply to message #1832337] Mon, 21 September 2020 06:17 Go to previous message
Miro Spönemann is currently offline Miro SpönemannFriend
Messages: 74
Registered: March 2015
Location: Kiel, Germany
Member

That's hard to say, you should investigate with a debugger. The build listener added by DiagramUpdater should be triggered by the text change:

https://github.com/eclipse/sprotty-server/blob/5d6c6c25e7d5d7ded5c19fc6282a1a45137154ac/org.eclipse.sprotty.xtext/src/main/java/org/eclipse/sprotty/xtext/ls/DiagramUpdater.xtend#L59-L61

You should check what happens there after you edit a label.
Previous Topic:Integrating Sprotty-server into existing Spring application?
Next Topic:Sprotty Server: Tracing Attributes only knowing their name
Goto Forum:
  


Current Time: Fri Sep 24 05:47:18 GMT 2021

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

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

Back to the top