Book a Demo

Author Topic: parameters.Refresh doesn't work?  (Read 8508 times)

PY

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
  • I love Python
    • View Profile
parameters.Refresh doesn't work?
« on: September 12, 2007, 12:13:09 am »
Hello all,

using automation interface some parameters are being added to some methods in a given Element under my model.

After that in project browser all that updated methods look having same parameter (and only one), whats is wrong.  I have to double click on the method opening the properties window and then click on "Edit Parameters" to see the real quantity and name of the parameters. after that a "Save" is necessary to finally see the changes in Project Browser.

it seems just a Refresh Problem to me, but I am already using on my Python-code :

           # refresh all
           theMethod.Parameters.Refresh
           theMethod.Update

and just in case I am refreshing now the parent Element:
           # refresh all
           theElement.Methods.Refresh
           theElement.Update

but the problem is still there.

what can I do? I am using EA 7.0.814

thanks for any help in advance,

Regards,

Pablo

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #1 on: September 12, 2007, 02:42:25 pm »
Perhaps try calling Repository.AdviseElementChange(elementID) after making your changes.  This informs EA that it should refresh information for this element in all relevant views.

If that doesn't work, perhaps try calling Repository.RefreshModelView(packageID).  Pass in the ID of the Package containing the element you are dealing with.

HTH

PY

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
  • I love Python
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #2 on: September 14, 2007, 06:03:17 am »
hello,

thanks for your answer, but I think I have a bigger problem here:

I am passing the element and repository as references through my python application. the methods you mentioned require the IDs of that element and repository.. how can I get the ID to pass in? sorry if this is trivial, but so far I searched I haven found any answer.

thanks again for any info in advance.

Best Regards,

Pablo

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #3 on: September 14, 2007, 06:26:11 am »
Pablo,

The ParentID propety of either a method or an attribute should give you the ElementID of the owning element.

David
No, you can't have it!

PY

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
  • I love Python
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #4 on: September 14, 2007, 07:28:43 am »
Hi,

I did as you suggested but still I get no updated information in Project Browser :(

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #5 on: September 14, 2007, 10:14:03 am »
Quote
Hi,

I did as you suggested but still I get no updated information in Project Browser :(

Pablo,

Just to be sure...

You've called Repository.AdviseElementChange(theMethod.ParentID) and you've tried calling Repository.RefreshModelView() with the ID of the package that contains the parent element.

Is that correct?

David
No, you can't have it!

PY

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
  • I love Python
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #6 on: September 14, 2007, 11:22:42 am »
yes,
I did try both:
                       self.Repository.AdviseElementChange(theMethod.ParentID)

first only this , then with the following:              
        self.Repository.RefreshModelView(self.theBasePackage_ID)

where Repository and PackageID were defined before.

Regards,

Pablo
« Last Edit: September 16, 2007, 10:19:08 pm by PY »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #7 on: September 14, 2007, 02:07:57 pm »
OK Pablo,

Let's try this - some strong medicine, but perhaps we'll find out what's actually going wrong here.

Try calling Repository.RefreshModelView(0) to force the entire model to refresh. [Note that the parameter is the number zero, not a string or a variable.]

Whether or not that works, try Repository.RefreshOpenDiagrams(<FullReload>). [FullReload is a boolean parameter. Try both values - false refreshed the diagram display, true will force the diagrams to be repopulated from the repository.

You might also want to take a look at the value of Repository.BatchAppend. If this is true, then EA will not perform (all) updates after each element; that won't happen until you toggle this value or restart EA.

Take a look at Repository.EnableUIUpdates. Setting this to false will block new elements (etc.) from showing up as they are added through automation. This is not likely the cause, since RefreshModelView is supposed to do the updates.

Last, look at the value of Repository.EnableCache. I'm not sure whether this has any relevance at all, but it might provide a data point if nothing else shows promise.

Please let me know what (if anything) changes.

David
No, you can't have it!

PY

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
  • I love Python
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #8 on: September 17, 2007, 05:38:30 am »
hi David,


Quote
OK Pablo,

Try calling Repository.RefreshModelView(0) to force the entire model to refresh. [Note that the parameter is the number zero, not a string or a variable.]

--> no change at all

Whether or not that works, try Repository.RefreshOpenDiagrams(<FullReload>). [FullReload is a boolean parameter. Try both values - false refreshed the diagram display, true will force the diagrams to be repopulated from the repository.

--> using any of them causes an error and EA must close, even running in background (not opened at all) (how can I add here a screenshot?)

finally, calling:
self.Repository.RefreshModelView(0)
print "\n Repository.BatchAppend:",self.Repository.BatchAppend
print "\n Repository.EnableUIUpdates:", self.Repository.EnableUIUpdates
print "\n Repository.EnableCache:", self.Repository.EnableCache
                       #self.Repository.RefreshOpenDiagrams(False)

I get:
Repository.BatchAppend: False

Repository.EnableUIUpdates: True

Repository.EnableCache: False

[img src=file:///D:/work/.../eaerror.gif][/img]

what is the problem at all??

thanks again for any help.

Best Regards,

Pablo
« Last Edit: September 17, 2007, 07:38:40 am by PY »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: parameters.Refresh doesn't work?
« Reply #9 on: September 17, 2007, 08:27:18 am »
Pablo,

Well, I'm stumped. In particular, the crash when you tried RefreshOpenDiagrams has me concerned.

Time to report this directly to Sparx. Do this via the Report a Bug link below the Support link at the bottom of any forum page. Please include the title of this thread, and paste in the URL. This will help the Sparx folks to see what's led to this point.

Please also let us know what Sparx has to say. This will keep the rest of us users in the loop.

The good news is that Sparx is quite good about handling these situations. They release new builds once every 2-4 weeks or so.

David
No, you can't have it!