Book a Demo

Author Topic: How to delete attribute(-s) from element properly?  (Read 4746 times)

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
How to delete attribute(-s) from element properly?
« on: November 11, 2011, 10:36:25 pm »
Hi everybody!

I delete attribute for an element using this code

" element.Attributes.Delete(i)"

i is index of attribute.

attribute is deleted but it is still shown in the tree view of Project Browser.

How can I fix this?

P.S. When I reopen the project attribute disappears from Project Browser.

Thank you!
« Last Edit: November 11, 2011, 10:38:52 pm by bachristus »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to delete attribute(-s) from element prope
« Reply #1 on: November 12, 2011, 12:43:36 am »
Try a refresh or reload (search the repository object for the appropriate one).

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to delete attribute(-s) from element prope
« Reply #2 on: November 12, 2011, 01:42:04 am »
There's also a operation on Repository that tells it something has changed: AdviseElementChange (long ObjectID), but that doesn't seem to work all of the time.
Selecting something else, and then again selecting the element in question might also help ShowInProjectView (object Item)

Geert

Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: How to delete attribute(-s) from element prope
« Reply #3 on: November 14, 2011, 08:03:15 pm »
There is also a method:

DeleteAt (short index, boolean Refresh)

Try using:

DeleteAt (i, true)

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: How to delete attribute(-s) from element prope
« Reply #4 on: November 15, 2011, 12:03:26 am »
I fixed the problem using this.repository.RefreshModelView(element.PackageID);

Other ways you guys suggested did not worked. Thank you for help  :)
« Last Edit: November 15, 2011, 12:05:33 am by bachristus »