Hi Susinda,

We have tested the emf model. It correctly adds the new element as a child
of the correct selectedNode. The problem occurs only in the graphical model.

Thanks,


On Wed, Apr 23, 2014 at 12:38 PM, Susinda Perera <[email protected]> wrote:

> Might be selectedNode is wrong, when there are list of nodes when you
> mouse click and select, it may sometimes selects the upper node or parent
> node.
>
>
>
>
> On Wed, Apr 23, 2014 at 9:27 AM, Gayan Yalpathwala <[email protected]>wrote:
>
>> Hi,
>>
>> I am adding new elements to existing tree nodes of input and output trees
>> and encounter a wrong placing issue for newly added tree elements. The
>> following code snippet is used to add a new element to a tree node.
>>
>> EObject object = ((Node) selectedEP.getModel()).getElement();
>> // Used to identify the selected resource of the model
>> TreeNode selectedNode = (TreeNode) object;
>>
>> // Configure the new element by setting default values
>> Element elementNew = DataMapperFactory.eINSTANCE.createElement();
>> elementNew.setName(NEW_FIELD_ID);
>> elementNew.setLevel(selectedNode.getLevel() + 1);
>> elementNew.setSchemaDataType(SchemaDataType.STRING);
>>
>> AddCommand addCmd = new AddCommand(((GraphicalEditPart)
>> selectedEP).getEditingDomain(),
>> selectedNode, DataMapperPackage.Literals.TREE_NODE__ELEMENT, elementNew,
>> 0);
>> if (addCmd.canExecute()) {
>> ((GraphicalEditPart) selectedEP).getEditingDomain().getCommandStack()
>> .execute(addCmd);
>> }
>>
>> This successfully adds the new element as a child of the selected
>> editpart in the emf model, yet graphically displays above the selected
>> editpart (not under the selected editpart).
>>
>> (Here, a NewField is added to NewRecord)
>>
>> Another thing to note here is that when a new field is added to an
>> imported tree node like sfRecord, it is correctly added under the exact
>> sfRecord node. Any thoughts on this?
>>
>> Thanks,​
>>
>> --
>> *Gayan Kaushalya Yalpathwala*
>>  Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 71 8682704 <http://asia14.wso2con.com/>
>>
>>  <http://asia14.wso2con.com/>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Susinda Perera*
> Software Engineer
> Mobile:(+94)716049075
>
> WSO2 Inc. http://wso2.com/
> Tel : 94 11 214 5345 Fax :94 11 2145300
>
>


-- 
*Gayan Kaushalya Yalpathwala*
 Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94 71 8682704 <http://asia14.wso2con.com/>

<http://asia14.wso2con.com/>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to