The Meta-Environment API

term-editor-actions.tb

Go to the documentation of this file.
00001 #ifndef __TERM_EDITOR_ACTIONS__
00002 #define __TERM_EDITOR_ACTIONS__
00003 
00004 #include <module-manager.tb>
00005 #include <term-editor-utils.tb>
00006 #include <sdf-namespace.h>
00007 
00008 process EditorEditTermAction(EditorId : session-id) is
00009 let
00010   ModuleId : module-id
00011 in
00012   GetModuleId(EditorId, ModuleId?)
00013   . EditTermAction(ModuleId)
00014 endlet
00015 
00016 process EditTermAction(ModuleId : module-id) is
00017 let
00018   Cancel: bool,
00019   ErrorMessage: str,
00020   Filename: str,
00021   Modulename: str,
00022   Pid: int,
00023   Sid: session-id
00024 in
00025   MM-GetAttribute(ModuleId, SDF_NAMESPACE, "name", Modulename?)
00026   . PromptForFile("Edit Term", [], Modulename, Cancel?, Filename?)
00027   .  
00028   if equal(Cancel, true) then
00029     tau
00030   else
00031     create(EditTerm(Filename, ModuleId, true), Pid?)
00032     .
00033     (
00034       rec-msg(term-editor-started(Filename, ModuleId, Sid?))
00035       . create(CleanupEditTerm(Sid), Pid?)
00036     +
00037       rec-msg(term-editor-not-started(Filename, ModuleId, ErrorMessage?))
00038       . printf("error: %s\n", ErrorMessage)
00039     )
00040   fi
00041 endlet
00042 
00043 process DumpTermParsetreeAction(EditorId : session-id) is
00044 let
00045   Cancel: bool,
00046   Filename : str,
00047   ModuleId : module-id,
00048   Path : str
00049 in
00050   GetModuleId(EditorId, ModuleId?)
00051   . GetPath(EditorId, Filename?)
00052   . PromptForFileWithExtension("Export Term Parsetree", [], ".pt", Cancel?, Path?)
00053   .
00054   if equal(Cancel, true) then
00055     tau
00056   else
00057     DumpTermParsetree(ModuleId, Filename, Path)
00058   fi
00059 endlet
00060 
00061 process DumpTermFocusAction(EditorId : session-id) is
00062 let
00063   Cancel: bool,
00064   Path: str
00065 in
00066   PromptForFileWithExtension("Export Focus Parsetree", [], ".pt", Cancel?, Path?)
00067   .
00068   if equal(Cancel, true) then
00069     tau
00070   else
00071     DumpTermFocusParsetree(EditorId, Path)
00072   fi
00073 endlet
00074 
00075 #endif /* __TERM_EDITOR_ACTIONS__ */

Generated on Fri Sep 12 13:09:47 2008 for sdf-meta by  doxygen 1.4.6