Transforms Permanently deleted user Created November 04, 2009 08:04 Hi, EverybodyCan anybody show me example how to use left/right transforms?Thanks in advance!
Hi, Oleg
Here is eaxmple of right transform witch converit expression to array acces expression, when ones type '[' symbol.
side transform actions arrayAccess
right transformed node: Expression tag: default_ //transforms array into array access expression
condition : (operationContext, scope, model, sourceNode)->boolean {
return coerce(sourceNode.type :< concept = ArrayType as a).isNotNull && !(sourceNode.isInstanceOf(GenericNewExpression));
}
common initializer :
<no common variables>
....................................
<no common initializer>
actions :
add custom items (output concept: ArrayAccessExpression)
simple item
matching text
[
description text
array access
icon
<default>
type
<default>
do transform (operationContext, scope, model, sourceNode, pattern)->node< > {
node<ArrayAccessExpression> result = model.new node(ArrayAccessExpression , <no prototype>);
sourceNode.replace with(result);
result.array.set(sourceNode);
return result;
}
Also you can find a lot of examles in baseLanguage -> actions -> in folder sideTransforms
Regards,
Evgeny Kurbatsky.
I tried to write a test program which must replace node with "Concept1" concept when I type in "[[", but it is not works :-)
What I do incorrect? Project in attachment.
Attachment(s):
Test.zip
It works.
Try try to type somthing in RootConcept: [[abc|]].
Then place cursor at the end of the cell: [[abc]]|.
Type "[[".
You will get: [[no val]]. You old node of Concept1 was replaced with new node of Concept1.
Exactly!
Thanks, Evgeny!