0

Desired behaviour:

Once a user makes a change in the model, my EA add-in is supposed to flag the model as 'dirty'. This allows to conditionally export to another format on closing the file as in if dirty then do export.

A change could be any kind of modification of the appearance or logical structure of the model.

So far, I'm setting a boolean value dirty to true in the EA_OnNotifyContextItemModified event and it seems to work on some simple testing. However, I find the documentation on that event slightly unclear. What is a 'context item' exactly? Is it simply any model element that is selected in the EA GUI?

Are there any better options to notice user changes?

Benjamin4991
  • 123
  • 7

2 Answers2

1

No, there aren't. The context item is whatever has been in the focus upon the action. EA will tell you what kind of thing that is by passing the specific context item as a parameter.

EA is a strange tool. However, once you get used to the strangeness you can quite well make it a useful tool. I also dream of a better world, but it has not come yet.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
-2

I noticed that simply adding an element, package or diagram to the project tree without dragging it on a diagram or editing it in a diagram view will not cause the EA_OnNotifyContextItemModified event to fire.

To notify the add-in of an addition of any of the likes to the model, the dirty flag should be updated on EA_OnPreNewElement, EA_OnPreNewPackage and EA_OnPreNewDiagram as well.

Benjamin4991
  • 123
  • 7