Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: SomersetGraham on March 16, 2010, 02:32:57 am
-
Hi everyone
For a given element I want to discover if a diagram exists for a given name and if so replace it with a new one of that name
What I am doing is the following, it works BUT I get a warning dialog in EA stating that the underlying model data is out of date and to press OK to do a refresh. Doing so results in the model that I want, but obvouisly I dont want the dialog to appear.
What have I missed
Graham
short diagramIndex = 0;
foreach (EA.Diagram diag in CurrentlySelectedElement.Diagrams)
{
if (diag.Name == CurrentlySelectedElement.Name + " xxxx")
{
CurrentlySelectedElement.Diagrams.DeleteAt(diagramIndex, true);
CurrentlySelectedElement.Diagrams.Refresh();
CurrentlySelectedElement.Update();
break;
}
diagramIndex++;
}
EA.Diagram newDiagram = (EA.Diagram)
CurrentlySelectedElement.Diagrams.AddNew
(CurrentlySelectedElement.Name + "
xxxx", "Analysis");
newDiagram.DiagramObjects.Refresh();
newDiagram.Update();
CurrentlySelectedElement.Diagrams.Refresh();
CurrentlySelectedElement.Update();
Repository.OpenDiagram(newDiagram.DiagramID);
-
Graham,
Look for refresh/reload funtionality in (i think) the Repository class.
I'm guessing that should help in your case.
Geert
-
Thanks Geert
Working well now thanks
Graham