anchor.diff:      Engine.Files.Current.Group.Category.EnumMenuItems(@AddMenuItem);
     end;
   
  -  with aTendency do
  +  with Engine.CurrentTendency do
  +  begin
  +    MessagesTabs.PageItem[WatchesGrid].Visible := capDebug in Capabilities;
  +    MessagesTabs.PageItem[CallStackGrid].Visible := capTrace in Capabilities;
  +    MessagesTabs.PageItem[MessagesGrid].Visible := capErrors in Capabilities;
  +  end;
  +end;
  +
  +procedure TMainForm.UpdateActions;
  +begin
  +  with Engine.CurrentTendency do
     begin
       //ExecuteMnu.Visible := capRun in Engine.Tendency.Capabilities;
   
  -    DBGRunAct.Enabled := capRun in Capabilities;
  +    DBGRunAct.Enabled := (capRun in Capabilities) and (not Engine.Session.Run.Active);
       DBGCompileAct.Visible := capCompile in Capabilities;
       DBGExecuteAct.Enabled := capRun in Capabilities;
       DBGResetAct.Enabled := capRun in Capabilities;
       DBGLintAct.Enabled := capLint in Capabilities;
   
  -    DBGStartServerAct.Enabled := (capDebugServer in Capabilities) and (aTendency.Debug <> nil) and (not aTendency.Debug.Active);
  -    DBGStopServerAct.Enabled := (capDebugServer in Capabilities) and (aTendency.Debug <> nil) and (aTendency.Debug.Active);
  +    DBGStartServerAct.Enabled := (capDebugServer in Capabilities) and (Debug <> nil) and (not Debug.Active);
  +    DBGStopServerAct.Enabled := (capDebugServer in Capabilities) and (Debug <> nil) and (Debug.Active);
   
       DBGAddWatchAct.Enabled := capTrace in Capabilities;
       DBGBreakpointsAct.Enabled := capTrace in Capabilities;
       DBGToggleBreakpointAct.Enabled := capTrace in Capabilities;
  -
  -    MessagesTabs.PageItem[WatchesGrid].Visible := capDebug in Capabilities;
  -    MessagesTabs.PageItem[CallStackGrid].Visible := capTrace in Capabilities;
  -    MessagesTabs.PageItem[MessagesGrid].Visible := capErrors in Capabilities;
   
       DBGStepOverAct.Enabled := capTrace in Capabilities;
       DBGStepIntoAct.Enabled := capTrace in Capabilities;
  
positive.code:   end;
    //  DebugPnl.Visible := DebugPnl.Caption <> '';
    UpdateMenu;
    UpdateFileHeaderPanel;
  end;
  
  
negative.code: 
  procedure TMainForm.EngineDebug;
  begin
    //DBGRunAct.Enabled := not Engine.Session.Run.Active;
    UpdateActions;
    if (Engine.Tendency.Debug <> nil) then
    begin
      DebugPnl.Caption := Engine.Tendency.Debug.GetKey;
      UpdateFileHeaderPanel;
      UpdateCallStack;
      UpdateWatches;
      Engine.Files.Refresh; // not safe thread
    end;
  end;
  
  