% CB_RETRIEVE retrieves objects from an LTPDA repository
%
% CALL: workspaceBrowser.cb_retrieve
%
% M Hewitson 13-11-08
%
% $Id: cb_retrieve.m,v 1.8 2010/03/23 17:39:38 ingo Exp $
%
function cb_retrieve(varargin)
  
  wb = getappdata(0, 'WorkspaceBrowser');
  
  % Get a connection from the repository manager
  rm = LTPDARepositoryManager;
  conn = rm.manager.selectConnection([]);
  
  if ~isempty(conn) && conn.isConnected
    try
      % Get submission info from the user
      
      warning('off', 'MATLAB:JavaEDTAutoDelegation');
      qb = mpipeline.repository.RepositoryRetrieveDialog([], true);
      qb.setVisible(true);
      warning('on', 'MATLAB:JavaEDTAutoDelegation');
      
      if ~qb.isCancelled
        
        workspaceBrowser.retrieveObjectsFromDialog(qb, conn);
        
      end
      
    catch err
      fprintf(2, [err.message, '\n']);
    end
  end
  
end

