Issue deleting element from a list with multiple items [message #1707824] |
Wed, 09 September 2015 14:29 |
Luis De Bello Messages: 95 Registered: January 2015 |
Member |
|
|
Hi guys,
I am trying to delete the last element from my model but after deleting the last element I thought that the "new last element" would be without the comma but does is not happening
MultipleKeyValuePairObj:
{MultipleKeyValuePairObj} "{" (elements+=KeyValuePair ("," elements+= KeyValuePair?)*)? "}";
Example:
Initial State:
{
Field01: "SimpleValue01",
Field02: "SimpleValue02"
}
Expected Final State:
{
Field01: "SimpleValue01"
}
Current Final State:
{
Field01: "SimpleValue01",
}
Current code to remove last element
public void process(XtextResource state) throws Exception {
EObject eObject = state.getEObject(uriFragment);
EObject eContainer = eObject.eContainer();
if (eContainer instanceof MultipleKeyValuePairObj) {
MultipleKeyValuePairObj multipleKeyValuePairObj = (MultipleKeyValuePairObj) eContainer;
EList< KeyValuePair> elements = multipleKeyValuePairObj.getElements();
elements.remove(eObject);
}
}
Do you have any idea or tip to solve my issue?
Thanks in advance
Best regards,
Luis
[Updated on: Wed, 09 September 2015 14:31] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02772 seconds