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