mscEditor.tcl 1.98 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
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 {} {
25 26
		## Ticket mantis 0000625
        return [list statusBar dialogBoxOnError]
Jerome Legrand's avatar
Jerome Legrand committed
27 28 29 30 31 32 33
    }

    proc saveCurrentFile {} {
        return "false"
    }
    
    proc mscEditor { args } {
34
		## Ticket mantis 0000625
Jerome Legrand's avatar
Jerome Legrand committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
        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 {
55
                    set errNumb [catch { exec msce.py -o "$mscfile" 2>@1 &} msg ]
Jerome Legrand's avatar
Jerome Legrand committed
56 57 58
                }
            } else {
                set errNumb -1
59
                set msg [list "the file $mscfile does not exist" ]
Jerome Legrand's avatar
Jerome Legrand committed
60 61 62 63 64 65 66
            }
        }
        
        return [list $errNumb $msg]
    } 
    
}