diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@workspaceBrowser/cb_submit.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,54 @@
+% CB_SUBMIT submits the selected objects to a repository
+%
+% CALL: workspaceBrowser.cb_submit
+%
+% M Hewitson 13-11-08
+%
+% $Id: cb_submit.m,v 1.5 2010/01/22 16:00:47 ingo Exp $
+%
+function cb_submit(varargin)
+  
+  wb = getappdata(0, 'WorkspaceBrowser');
+  
+  % Get all selected objects
+  vars = workspaceBrowser.getSelectedVarNames(wb);
+  objs = workspaceBrowser.getSelectedObjects(wb);
+  if numel(vars) ~= numel(objs)
+    error('### Number of objects not equal to number of variable names. This shouldn''t happen!');
+  end
+  
+  svars = {};
+  for kk=1:numel(objs)
+    obj = objs{kk};
+    if isa(obj, 'ltpda_uoh')
+      svars = [svars vars(kk)];
+    end
+  end
+  
+  if numel(svars) == 0
+    utils.helper.errorDlg('Please select one or more objects to submit.', 'Submission error');
+    return
+  end
+  
+  sinfo = [];
+  
+  % Build command
+  cmd = '[ids, cids] = submit(';
+  
+  for kk=1:numel(svars)
+    cmd = [cmd svars{kk} ','];
+  end
+  
+  % Remove the last comma
+  if cmd(end) == ',', cmd = cmd(1:end-1); end
+  cmd = [cmd ');'];
+  
+  assignin('base', 'sinfo', sinfo);
+  try
+    evalin('base', cmd);
+  catch
+    utils.helper.errorDlg(['Failed to executed submission command: ' cmd], 'Submission error');
+  end
+  
+end
+