Book a Demo

Author Topic: How to unlock element table without lock-option in element context menu  (Read 22296 times)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to unlock element table without lock-option in element context menu
« Reply #15 on: March 30, 2018, 06:22:41 am »
My 2 cent: get professional help. I would not let a rookie repair the brakes of my car.

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: How to unlock element table without lock-option in element context menu
« Reply #16 on: April 03, 2018, 10:00:36 pm »
I tried to Enable Security, but EA asks for an authorization key, which I don't have. I also couldn't insert one: the OK-button stays inactive. I think our ICT-supplier does have that key, because yesterday they used one when we were trying to solve another issue with EA.

Next I ran the script on the three locked table and one table that isn't locked. It returned Waar (True) on the three locked tables and Onwaar (False) on the unlocked table. So it must be the kind of unusual lock you were mentioning in your post.

Do you know how to unlock that kind of lock?

Hello again,


Sorry I've been away for a few days -- Easter is a four-and-a-half day weekend in Sweden. :)

I have good news for you.
The locks I was talking about appear to have changed their behaviour some time between EA 11.1 and 13.5. I'm pretty sure they didn't use to be displayed with exclamation marks in the project browser, and that's what's got everyone on the forum confused -- myself included.

I have now verified that in 13.5 these locks are in fact always shown with red exclamation marks in the project browser. This is the case even in a project without user security, and even if you yourself are the user who has locked them. I would surmise that with this kind of lock, EA does not track which user has locked what, so there are only two possibilities -- locked or unlocked, red mark or none.
By contrast, when using EA's user security functionality, packages and elements locked by you (that is, the user running this instance of EA) are shown with blue exclamation marks, and those locked by someone else are shown with red ones. Elements which are not locked by anyone have no exclamation mark at all.
In both cases, locks are semi-permanent: they survive the session, and are not automatically released when you exit EA or close the project. They must be released explicitly.

Enabling user security requires a special key, which is available from the registered user section on Sparx' web site. You will have received login credentials for this site when you bought your license. Unfortunately, however, EA's licenses are essentially in two parts: usage and support. The usage portion is perpetual, meaning the license does not expire and you can keep using EA forever. The support portion, which is what these login credentials give you access to, requires annual renewals. It covers all upgrades released in that year (including major-version releases), as well as the user security key and several other things as well. So if you have allowed your one-year support license to expire, you can't get hold of the key required to enable user security.

But I'm including all that merely for completeness. You don't actually need the user security key, because user security is not at play here.
What's happened is simply that someone has applied these locks and then forgotten about it.

If there are only a few of these locks, the simplest solution is as follows.
For locked elements and packages:
  • Locate a locked element (or package) in the project browser.
  • Right-click and select "Find in All Diagrams" or hit Ctrl-U. If the element is only in one diagram, it opens; otherwise, you're presented with a list. Open any diagram in that list.1
  • Locate the element in the diagram.
  • Right-click the element in the diagram. About a quarter way from the bottom of the context menu, there's an item "Lock Element..." It should be ticked; select it to unlock the element.
1 If there are no results at all, the selected element/package is not shown in any diagrams. For these, simply create a temporary diagram of any type (except sequence or timing), drag the elements/packages into the diagram, unlock them and delete the diagram.

For locked diagrams:
Simply open the diagram and right-click an empty area in it. Again about a quarter way from the bottom of the context menu, the item "Lock Diagram" should be ticked. Select it to unlock the diagram.

If there are many locks in your project, create a project browser VBScript called "Release Locks" with the enclosed contents. Run it once on each root node in the project browser, then restart EA to make sure the GUI is completely refreshed.

Please note that while I'm as confident as I can be in my diagnosis, this is all done remotely and I can't offer any guarantees or accept any responsibility for things going wrong. Make sure you have a full backup of your project before you make any changes to it.

Hope this helps,


/Uffe


Code: (VBScript) [Select]
option explicit

!INC Local Scripts.EAConstants-VBScript

sub UnlockElement(element)
if (element.Locked) then
element.Locked = false
element.Update()
end if

dim diagram as EA.Diagram
for each diagram in element.Diagrams
UnlockDiagram diagram
next
element.Diagrams.Refresh()

dim child as EA.Element
for each child in element.Elements
UnlockElement child
next
element.Elements.Refresh()

for each child in element.EmbeddedElements
UnlockElement child
next
element.EmbeddedElements.Refresh()
end sub

sub UnlockPackage(package)
UnlockElement package.Element

dim diagram as EA.Diagram
for each diagram in package.Diagrams
UnlockDiagram diagram
next
package.Diagrams.Refresh()

dim element as EA.Element
for each element in package.Elements
UnlockElement element
next
package.Elements.Refresh()

dim child as EA.Package
for each child in package.Packages
UnlockPackage child
next
package.Packages.Refresh()
end sub

sub UnlockDiagram(diagram)
if diagram.IsLocked then
diagram.IsLocked = false
diagram.Update()
end if
end sub

sub OnProjectBrowserScript()
dim treeSelectedType
treeSelectedType = Repository.GetTreeSelectedItemType()
Repository.EnsureOutputVisible("Script")

select case treeSelectedType
case otElement
dim element as EA.Element
set element = Repository.GetTreeSelectedObject()
UnlockElement element
Session.Output "Done."
case otPackage
dim package as EA.Package
set package = Repository.GetTreeSelectedObject()
UnlockPackage package
Session.Output "Done."
case otDiagram
dim diagram as EA.Diagram
set diagram = Repository.GetTreeSelectedObject()
UnlockDiagram diagram
Session.Output "Done."
case else
Session.Prompt "This script does not support items of this type.", promptOK
end select
end sub

OnProjectBrowserScript
My theories are always correct, just apply them to the right reality.