Suppose you have a class that represents your application. It has a method that checks if the string returned by VERSION( ) contains the word "Runtime" to determine whether the application is being run in the IDE workbench or as a compiled application:

function isRuntime()

return ("RUNTIME" $ upper(version())) 

In the method that terminates the application, you either quit or restore the IDE workbench (by calling other methods in the class not shown here):

function shutdown()

if this.isRuntime() 

quit 

else 

this.unloadProcFiles() 

this.restoreWorkbench() 

this.unhookGlobalErrorHandler() 

endif