logical cMainFunctionEdit :: ErrorLookup ( )
{
  CTX_Project        *proj_ctx        = GetProjectContext();
  PropertyHandle     *prophdl         = GetPropertyHandle();    
  NString             command;
  NBuffer             buffer;
  logical             term            = NO;
BEGINSEQ
  if ( !prophdl->GetInstanceContext() )             ERROR
  if ( prophdl->ExecuteInstanceAction("GetProjectPath","ERC_Batch") )
    SetupOutput("Error providing command path\n",NO);
  else
  {
    command = prophdl->GetActionResult();
    command += "ShowErrors.bat";
    command += ' ';
    command += prophdl->GetString("sys_ident");
    ExecuteCommand(command,buffer,YES,NO);
    SetupOutput(buffer,YES);
  }


RECOVER
  term = YES;
ENDSEQ
  return(term);
}
logical cMainFunctionEdit :: Link ( )
{
  CTX_Project        *proj_ctx        = GetProjectContext();
  PropertyHandle     *prophdl         = GetPropertyHandle();    
  NBuffer             comp_out;
  int32               curidx          = UNDEF;
  int32               rc              = ERIC;
  logical             reserve_project = YES;
  logical             term            = NO;
BEGINSEQ
//  if ( (curidx = StartClassAction(YES,reserve_project)) == ERIC) 
//                                                     ERROR
  SetupOutput("",YES);
  if ( Compile() )                                   ERROR
  SetupOutput("...Link executable ...\n",NO);
  
  if ( prophdl->ExecuteInstanceAction("GetLinkCommand",NULL) )
    SetupOutput("Error: providing link command\n",NO);
  else
  {
    rc = ExecuteCommand(prophdl->GetActionResult(),comp_out,YES,NO);
    SetupOutput(comp_out,NO);
  }


RECOVER
  term = YES;
ENDSEQ
//  StopClassAction(reserve_project,curidx);
  return(term);
}
logical cMainFunctionEdit :: Compile ( )
{
  CTX_Project        *proj_ctx        = GetProjectContext();
  PropertyHandle     *prophdl         = GetPropertyHandle();    
  NBuffer             comp_out;
  int32               curidx          = UNDEF;
  int32               rc              = ERIC;
  logical             reserve_project = YES;
  logical             term            = NO;
BEGINSEQ
//  if ( (curidx = StartClassAction(YES,reserve_project)) == ERIC) 
//                                                     ERROR
  SetupOutput("...Creating source code file ...",NO);
  if ( prophdl->ExecuteExpression(GetRESDB(),"SourceCode()").IsValid() )
    SetupOutput("...  done.\n",NO);
  else
  {
    SetupOutput("...  terminated with errors, compile not started\n",NO);
    ERROR
  }
  
  if ( prophdl->ExecuteInstanceAction("GetCompileCommand",NULL) )
    SetupOutput("Error: providing compile command\n",NO);
  else
  {
    rc = ExecuteCommand(prophdl->GetActionResult(),comp_out,YES,NO);
    SetupOutput(comp_out,NO);
    if ( !rc && strstr(comp_out,"ERROR") )
      rc = ERIC;
      
    if ( rc )
    {
      *prophdl->GPH("req_compile") = (char*)(rc ? "CPS_failed" : "CPS_ready");
      term = YES;
    }
    prophdl->ExecuteInstanceAction("SetupModLevel",NULL);
  }


RECOVER
  term = YES;
ENDSEQ
//  StopClassAction(reserve_project,curidx);
  return(term);
}
int8 cTableEditor :: DoBeforeDrop ( )
{
  char                    executed      = NO;
  PropertyHandle        * attr_ph       = NULL;
  PropertyHandle        * field_ph      = NULL;
  PropertyHandle        * parent        = NULL;
  char                  * prop_path;
  NString                 field_opts    = "";
  char                  * field_name    = NULL;
  CTX_Control           * field_context = NULL;
BEGINSEQ
  PropertyHandle    *drop_ph    = GetDropPropertyHandle();
  char              *drop_txt   = GetDropText();
  DPoint             drop_pos   = GetDropPosition();
  int                drop_index = GetDropIndex();
  logical            is_local   = IsLocalDrop();

  if ( is_local )                                    ERROR
  
  field_opts += drop_txt;
  field_opts += ",";
  field_opts += drop_index;
  
  prop_path = GetPropertyHandle()->GetPropertyPath();
  parent    = GetPropertyHandle()->GetParentProperty();
  if ( !strcmp(prop_path,"ADK_StyleAction.columns") )
    parent->ExecuteInstanceAction("AddColumn", field_opts);
  else if ( !strcmp(prop_path,"ADK_StyleAction.regions") )
    parent->ExecuteInstanceAction("AddRegion", field_opts);
  executed = YES;

  ExecuteAction("Refresh", ACT_Function);
RECOVER
  return CTX_Control::DoBeforeDrop();
ENDSEQ
  return(executed);
}