Book a Demo

Author Topic: No change of Time Line after modification visible  (Read 3191 times)

dagraf

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
No change of Time Line after modification visible
« on: January 14, 2009, 09:08:21 pm »
Hi,

I have the following problem: I manipulate a Time Line of a Time Diagram with manipulation the RunState attribute of this element.

This all works quite good, but there is no change of the Time Line in the diagram although the element is updated and refreshed and the diagram also.  :o

The change is not visible until I open the properties of the Time Line and close it. This even works if I chancel the properties dialog.

Can somebody tell me how it is possible to force a visible change from the Add-In.

Here is a part of my
Code: [Select]
private void createTiming(EA.Repository repository, string elementGUID, string[,] array, int length)
{
    EA.Element element = (EA.Element) repository.GetElementByGuid(elementGUID);

    /* Creat runstate from the schedule of the string array */
    string runstate = "";
    for (int i = 0; i < length; i++)
    {
        runstate = runstate + "@VAR;Variable=" + array[i, colIndex2 - 1] + ";Value=" + array[i, colIndex1 - 1] + ";Op==;@ENDVAR;";
    }

    /* Copy created runstate to clipboard */
    // Forms.Clipboard.SetData(Forms.DataFormats.StringFormat, runstate);

    /* Replace old RunSpace */
    element.RunState = runstate;
    element.Name = element.Name + '§';

    /* Update element... */
    if(!element.Update())
    {
        // Error
        return;
    }
    /* ... and refresh it */
    element.Refresh();
    
    EA.Package package = repository.GetPackageByID(element.PackageID);
    EA.Collection diagrams = package.Diagrams;

    for (short i = 0; i < diagrams.Count ; i++)
    {
        EA.Diagram diagram = (EA.Diagram)diagrams.GetAt(i);
        if ("Timing" == diagram.Type)
        {
            /* Update diagram */
            if (!diagram.Update())
            {
                // Error
                return;
            }
            break;
        }
    }
}

Thanks for your help!  :)

Thomas Loeffler

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: No change of Time Line after modification visi
« Reply #1 on: January 24, 2009, 10:46:50 pm »
Hi,

I am missing the
  package.elements.Refresh()
in your code example as shown in the help for "add and manage elements".

Nevertheless the refresh mechanism from automation interfaces seems to be a little buggy (using EA 7.1 build 834). The only thing worked always is a
  repos.RefreshModelView(p.PackageID);
I made a menu entry for my addin, so I can call it if necessary. The method has the side-effect that all diagram windows are reopened which is very disturbing if used after each modification.

What I observed is not cleanly reproducible. I tried to change/set the stereotype of a class and applied the Update and Refresh for the appropriate instances (or lets say: as shown in the help file).
Result: sometimes it works, sometimes not.
E.g. if no diagram is open, then the project tree is not refreshed (reproducible).
if a diagram containing the changed class is opened, then the project tree is refreshed in most cases. But sometimes the project tree is not refreshed whereas the diagram is refreshed always.
In all cases clicking around sometimes shows "missing" stereotype.

On the other hand: if I add attributes through automation interface as shown in the help, neither the diagram representation nor the project tree is refreshed ... in most cases, but sometimes it is.

So I am sorry that I do not have a real solution, but may be there is some statement from sparx systems later?

Best Regards

Thomas Loeffler

dagraf

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: No change of Time Line after modification visi
« Reply #2 on: January 26, 2009, 05:45:16 pm »
Hi,

I tried both, package.elements.Refresh() and  Repository.RefreshModelView(PackageID) but it is still only updated if I open the properties of a TimeLine and close it again.

I think this is a bug of timing diagrams... What is the meaning of Sparx?  ;)

Regards,
Daniel  :)