keep connections consistent [message #519140] |
Sun, 07 March 2010 01:49 |
daniele Mising name Messages: 48 Registered: July 2009 |
Member |
|
|
I'm sure that the solution is in this forum... but I can't find it. Maybe I found the wrong words... However, here is my new problem:
I have this piece of ecore_diagram
(if image isn't visible.. http://img11.imageshack.us/img11/2752/helpgz.png)
and an example of the relative omm
<OPUS:Map>
<contiene xsi:type="OPUS:PuntoDiStoccaggio" PKNome="Buf_nnn" >
<giacenze quantita="10" relativa_all_item="//@ha_item.0"/>
</contiene>
<ha_item nome="PF_1" pds_default="//@contiene.0"/>
</OPUS:Map>
PuntoDiStoccaggio is visible on the editor (it has his EditPart) while item not.
If I change the name of the item (ha_item nome="PF_2"), I want that PuntoDiStoccaggio sees immediately the changes, as if i delete the item, i want that the connection with PuntoDiStoccaggio will delete automatically. But it's not so.
How could I do?
Thanks for the time you're wasting for me.
[Updated on: Sun, 07 March 2010 01:54] Report message to a moderator
|
|
|
|
|
|
|
|
Re: keep connections consistent [message #519608 is a reply to message #519386] |
Tue, 09 March 2010 13:11 |
daniele Mising name Messages: 48 Registered: July 2009 |
Member |
|
|
I found my shit.
when I changed an ITEM, I did
Quote: |
public void change_item (Item old_item, Item new_item) {
BasicEList list = new BasicEList();
list.addAll(map.getHa_Item());
for (int i=0; i < list.size(); i++){
if (list.get(i) == old_item)
/* -----> */ { list.set(i, new_item) } // <---------
}
EditingDomain editingDomain = this.getEditingDomain();
EReference feature = OPUS.OPUSPackage.eINSTANCE.getMap_Ha_item();
editingDomain.getCommandStack().execute(
SetCommand.create(editingDomain, map, feature , list) );
}
|
of course list.set(i) REMOVE the element at i, and put a new one...
so is the solution create a write transaction for each attribute of an item, writing directly the new attributes? something like that
Quote: | EReference feature = XXX.XXXPackage.eINSTANCE.getItem_Ha_fornitore();
editingDomain.getCommandStack().execute(
SetCommand.create(editingDomain, item_i, feature , item_nuovo.getHa_fornitore()) );
feature = XXX.XXXPackagePackage.eINSTANCE.getItem_Ha_bom();
editingDomain.getCommandStack().execute(
SetCommand.create(editingDomain, item_i, feature , item_nuovo.getHa_bom()) );
feature = XXX.XXXPackageSPackage.eINSTANCE.getItem_Ha_path_item();
editingDomain.getCommandStack().execute(
SetCommand.create(editingDomain, item_i, feature , item_nuovo.getHa_path_item()) );
...
|
it's quite tedious..
[Updated on: Tue, 09 March 2010 13:18] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04202 seconds