mscEditor.tcl 1.9 KB
Newer Older
Jerome Legrand's avatar
Jerome Legrand committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
package provide mscEditor 0.1 

lappend auto_path .
namespace eval mscEditor {
    
    # Graphical name of the operation
    proc getLabel {} {
        return "Launch MSC editor"
    }
    
    # Name of the application this script can be used with
    # shall be either InterfaceView or DeploymentView
    proc getApplication {} {
        return "InterfaceView"
    }
    
    # Names of  the object this script can be used on
    proc getApplyTo {} {
        return [list {"ProvidedInterface"}]
    }
    
    # List of way to manage output in the Framework
    # Could be an empty list or one or both of 'dialogBox' and 'statusBar'
    proc getOutputManagement {} {
        return [list "statusBar"]
    }

    proc saveCurrentFile {} {
        return "false"
    }
    
    proc mscEditor { args } {
        set errNumb -1
        set msg "msc editor has not been executed"

        set mscfile ""
        set selection [Object::getAttribute "interfaceview" "selection"]
        if {$selection != ""} {
            set MSCFilesName "TASTE_IV_Properties-MSCFiles"
            
            set mscFiles [Object::getAttribute $selection $MSCFilesName]
            set mscfile [lindex $mscFiles 0]
        }

        if {$mscfile != ""} {
            if {[file exists $mscfile]} {
                set platform [ToolsOthers::getPlateform]
                set mscfile [file nativename $mscfile]
                if {$platform == "windows" } {
                    #dputs "msce.py -o $mscfile"
                    #set errNumb [catch { exec {*}[auto_execok $::installationPath/config/externalTools/test.bat] $aadlFilePath $aadlId } msg ]
                } else {
                    set errNumb [catch { exec msce.py -o "$mscfile" &} msg ]
                }
            } else {
                set errNumb -1
                set msg "the file $mscfile does not exist"
            }
        }
        
        return [list $errNumb $msg]
    } 
    
}