comparison m-toolbox/classes/@workspaceBrowser/cb_submit.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % CB_SUBMIT submits the selected objects to a repository
2 %
3 % CALL: workspaceBrowser.cb_submit
4 %
5 % M Hewitson 13-11-08
6 %
7 % $Id: cb_submit.m,v 1.5 2010/01/22 16:00:47 ingo Exp $
8 %
9 function cb_submit(varargin)
10
11 wb = getappdata(0, 'WorkspaceBrowser');
12
13 % Get all selected objects
14 vars = workspaceBrowser.getSelectedVarNames(wb);
15 objs = workspaceBrowser.getSelectedObjects(wb);
16 if numel(vars) ~= numel(objs)
17 error('### Number of objects not equal to number of variable names. This shouldn''t happen!');
18 end
19
20 svars = {};
21 for kk=1:numel(objs)
22 obj = objs{kk};
23 if isa(obj, 'ltpda_uoh')
24 svars = [svars vars(kk)];
25 end
26 end
27
28 if numel(svars) == 0
29 utils.helper.errorDlg('Please select one or more objects to submit.', 'Submission error');
30 return
31 end
32
33 sinfo = [];
34
35 % Build command
36 cmd = '[ids, cids] = submit(';
37
38 for kk=1:numel(svars)
39 cmd = [cmd svars{kk} ','];
40 end
41
42 % Remove the last comma
43 if cmd(end) == ',', cmd = cmd(1:end-1); end
44 cmd = [cmd ');'];
45
46 assignin('base', 'sinfo', sinfo);
47 try
48 evalin('base', cmd);
49 catch
50 utils.helper.errorDlg(['Failed to executed submission command: ' cmd], 'Submission error');
51 end
52
53 end
54