// diagram viewed, add to history public virtual void Add(EA.ObjectType ot, string guid) { if (ot.Equals(EA.ObjectType.otDiagram)) { EA.Diagram dia = (EA.Diagram)_rep.GetDiagramByGuid(guid); if (dia != null) { if (LPosition < 0 || L[LPosition].Guid != guid) { int position = AddEntry(ot, guid); if (position > -1) { UpdateDiagram(position, dia); } } } } if (ot.Equals(EA.ObjectType.otPackage)) { EA.Package pkg = _rep.GetPackageByGuid(guid); if (pkg != null) { // not already defined as bookmark if (this.FindIndex(pkg.PackageGUID) == -1) { int position = AddEntry(ot, guid); if (position > -1) { UpdatePackage(position, pkg); } } } } if (ot.Equals(EA.ObjectType.otElement)) { EA.Element el = _rep.GetElementByGuid(guid); if (el != null) { // not already defined as bookmark if (this.FindIndex(el.ElementGUID) == -1) { int position = AddEntry(ot, guid); if (position > -1) { UpdateElement(position, el); } } } } }
public void Remove(EA.ObjectType ot, string guid) { if (ot.Equals(EA.ObjectType.otDiagram)) { EA.Diagram dia = (EA.Diagram)_rep.GetDiagramByGuid(guid); if (dia != null) { int index = this.FindIndex(dia.DiagramGUID); if (index > -1) { L.RemoveAt(index); if (index <= LPosition) { LPosition = LPosition - 1; } } } // settings of project _settings.SetHistory(_historyType, _rep.ProjectGUID, L); } }