! showtext.pvc

! $Id: showtext.pvc.pvxsrc 32450 2019-09-13 20:56:26Z fmcguirk $

 

! ** This class is written to be a "Event Pre/Post-Process" listener to print a simple

! ** message to the console the pre/post-process for every event.

 

def class "showtext"

    like "EventManagerObserver"

 

    ! ** Description to be used for tool on the Contributed Extensions / Tools Preference Page

    local theDescription$="SCT - Show message in Console"

    ! ** Register the events for this observer (both PreProcess and PostProcess)

    local theNotificationFlag=_pvxConstants'_idePrePostProcess

 

    /*

    ! ** The logic to be executed when the observer is triggered during the normal event process in the

    ! ** ProvideX event manager.  This logic will check the major and minor codes to determine the

    ! ** current event and then decide what action is to be performed.

    ! ** @param state A reference to an object of class %PvxClass(PvxState)%

     */

    function update(initPvxState)            update

end def

 

update:

enter aPvxState

    local psMajor$,psMinor$,enfState

    local procPfx$

 

    ! Get the Major/Minor codes that identify the current action

    psMajor$=aPvxState'getMajor$(), \

    psMinor$=aPvxState'getMinor$()

 

    ! Get notification state for the event

    enfState=aPvxState'getArgumentValue(_pvxConstants'_iEventNotificationFlag$)

 

    ! handle ALL events

    switch psMajor$ + "|" + psMinor$

 

    ! Build a ProvideX program

    case _pvxConstants'Incremental_Build$ + "|" + _pvxConstants'BuildType_BuildOne$

    case _pvxConstants'Incremental_Build_Alt_Exe$ + "|" + _pvxConstants'BuildType_BuildOne$

 

    ! Build a NOMADS Library

    case _pvxConstants'Incremental_Build$ + "|" + _pvxConstants'Buildtype_NomadsLIB$

    case _pvxConstants'Incremental_Build_Alt_Exe$ + "|" + _pvxConstants'Buildtype_NomadsLIB$

 

    default

 

        switch enfState

        case _pvxConstants'_idePreProcess

            procPfx$="pre"

            break

        case _pvxConstants'_idePostProcess

            procPfx$="post"

            break

        end switch

 

        ! Use request client class to write a message to the 'Console' view

        aReq=new("pvxrequestclient")

        aReq'print("ShowText: A "+procPfx$+"-process for "+psMajor$+"/"+psMinor$)

        drop object aReq

        break

    end switch

return 0

end