% CB_BLOCKDOC gets documentation for the selected block
%
% CALL:  LTPDAworkbench.cb_blockdoc
%
% M Hewitson 25-01-09
%
% $Id: cb_blockdoc.m,v 1.4 2010/08/06 19:10:48 ingo Exp $
%

function cb_blockdoc(varargin)
  
  wb = varargin{1};
  
  % Get all selected blocks
  sbs = awtinvoke(wb.mp, 'getSelectedBlocks');
  if sbs.size() > 0
    block = sbs.get(0);
    
    cl = char(block.getMinfo.getMclass);
    algo = char(block.getAlgo);
    
    % workaround for abstract classes because the help for these classes
    % are hidden.
    if strcmpi(cl, 'ltpda_uo')
      cl = 'plist';
    elseif strcmpi(cl, 'ltpda_uoh')
      cl = 'ao';
    elseif strcmpi(cl, 'ltpda_tf')
      cl = 'pzmodel';
    elseif strcmpi(cl, 'ltpda_filter')
      cl = 'miir';
    end
    
    if ~strcmp(cl, algo)
      cmd = ['doc ' cl '/' algo];
    else
      cmd = ['doc ' algo];
    end
    eval(cmd)
    
  end
  
end
