【问题标题】:Saving local Enterprise Architect project settings to database server将本地 Enterprise Architect 项目设置保存到数据库服务器
【发布时间】:2022-12-18 06:36:16
【问题描述】:

是否可以将本地 Sparx Enterprise Architect 项目首选项(开始 > 首选项)保存到数据库服务器?

我们通过数据库共享项目并更改了项目的一些设置,这些设置似乎没有保存到数据库中,我怀疑它们只保存在本地 Windows 注册表中。

【问题讨论】:

    标签: enterprise-architect


    【解决方案1】:

    EA 中有两种类型的首选项:

    用户偏好

    • 通过访问开始|外观 |喜好
    • 这些设置中的大部分都存储在注册表中:电脑HKEY_CURRENT_USERSoftwareSparx SystemsEA400EAOPTIONS

    模型偏好

    • 通过访问设置 |型号 |选项
    • 这些设置存储在存储库本身中。

    EA 不支持开箱即用地在模型级别设置用户设置。

    使用 EA-Matic 的解决方案

    EA-Matic 是我自己写的免费开源插件。
    它支持执行脚本作为对EA_FileOpen()等事件的反应 下面的脚本用于确保存储库的每个用户都具有这些相同的设置。

    它主要检查许多注册表值,并在需要时更新它们。因为 EA 只在启动时读取注册表,所以脚本在更新设置后关闭 EA,要求用户重新启动它。

    '[path=ProjectsEA-Matic Scripts]
    '[group=EA-Matic]
    option explicit
    
    !INC Local Scripts.EAConstants-VBScript
    
    '
    ' Script Name: Fix Mandatory User Settings
    ' Author: Geert Bellekens
    ' Purpose: Check the mandatory user settings in the registry and set them correctly if needed
    ' Date: 2019-11-05
    '
    
    'EA-Matic
    
    const REG_SZ = "REG_SZ"
    const REG_DWORD = "REG_DWORD"
    const REG_BINARY = "REG_BINARY"
    
    function fixSettings
        dim regPath
        Dim regkey
        dim regValue
        dim existingValue
        'place in the registry that contains all of the user settings
        regPath = "HKEY_CURRENT_USERSoftwareSparx SystemsEA400EAOPTIONS"
        'get the EA version
        dim eaVersion
        eaVersion = Repository.LibraryVersion
        
        dim settingsValid
        settingsValid = true
        'Fontname13 is only relevant for V15
        if eaVersion > 1300 then
            settingsValid = settingsValid AND validateRegValue(regPath, "FONTNAME13","Arial", REG_SZ)
        else
            settingsValid = settingsValid AND validateRegValue(regPath, "FONTNAME","Arial", REG_SZ)
        end if
        settingsValid = settingsValid AND validateRegValue(regPath, "SAVE_CLIP_FRAME","1", REG_DWORD)
        settingsValid = settingsValid AND validateRegValue(regPath, "PRINT_IMAGE_FRAME","1", REG_DWORD)
        settingsValid = settingsValid AND validateRegValue(regPath, "SAVE_IMAGE_FRAME","1", REG_DWORD)
        settingsValid = settingsValid AND validateRegValue(regPath, "SORT_FEATURES","0", REG_DWORD)
        settingsValid = settingsValid AND validateRegValue(regPath, "ALLOW_DUPLICATE_TAGS","1", REG_DWORD)
        
        if not settingsValid then
            msgbox "Mandatory user settings have been corrected." & vbNewLine & "Please restart EA",vbOKOnly+vbExclamation,"Corrected mandatory user settings!" 
            Repository.Exit
        end if
            
    end function
    
    function validateRegValue(regPath, regKey, regValue, regType)
        Dim shell
        ' Create the Shell object
        Set shell = CreateObject("WScript.Shell")
        dim existingValue
        on error resume next
        'read registry value
        existingValue = shell.RegRead(regPath & regkey)
        'if the key doesn't exist then RegRead throws an error
        If Err.Number <> 0 Then
            existingValue = ""
            Err.Clear
        end if
        on error goto 0
        'check the value in the registry with the desired value
        if Cstr(existingValue) <> regValue then
            'write the correct value to the registry
            shell.RegWrite regPath & regkey, regValue, regType
            'return false
            validateRegValue = false
        else
            'value was already OK, return true
            validateRegValue = true
        end if
    end function
    
    function EA_FileOpen()
         fixSettings
    end function
    

    【讨论】:

      【解决方案2】:

      对于注册表中的设置,EA400可通过命令行选项进行配置:/regkey:注册表键名

      【讨论】:

        【解决方案3】:

        v16.1 是应该为它添加了一个解决方案。 见https://sparxsystems.com/forums/smf/index.php/topic,47385.0.html

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多