Search code examples
add-inenterprise-architect

Enteprise Architect element MiscData(0) change (PDATA1)


I guess it's a simple question, but i still couldn't figure out how can i change the PDATA1/MiscData(0) property of an element via Add-In (and not by SQL Update). The problem is that the documentation says the MiscData is read-only.

Basically i am trying to make a hyper-link on a diagram with the help of an Add-In. I create a simple Text typed EA.Element, then an EA.DiagramObject, connect them via ElementID and i need this Text typed object to point to an exact diagram.

What i know is that a hyper-link is a Text typed object with PDATA1 filled in with the wanted diagram's ID. The created element's Notes is already filled with a valid hyperlink's value like: packageName : diagramName.

I'm interested in any other ways to make a working hyper-link with the help of an Add-In.

Thanks in advance for the answer!

Tamas


Solution

  • You need to call

    Repository.Execute("UPDATE t_object set PDATA1 ...")
    

    Execute is an undocumented but ever since working last resort. Nobody knows why MiscData is r/o.

    In oder to make the changes visible on the diagram you need to call

    Repository.ReloadDiagram (diagram.DiagramID)
    

    Since EA will eventually pop-up a save-window for modified diagrams you should eventually call

    Repository.SaveDiagram (diagram.DiagramID)
    

    prior to the reload.

    Important note: You need to remember that the Execute bypasses the API. If you have diagram changes and call Execute on diagram objects they need to be saved before. EA only updates all changed diagram objects in the database when the whole diagram is saved (manually or via SaveDiagram).