Mercurial > hg > ltpda
view m-toolbox/m/gui/gltpda/g_RetrievePlist.m @ 33:5e7477b94d94 database-connection-manager
Add known repositories list to LTPDAPreferences
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
function paramcommand = g_RetrievePlist(varargin) % Retrieve the name of the function from the block, then asks for % parameters. global params paramEnabled paramSets try functionname = varargin{1}; catch childpath = find_system(gcbh,'LookUnderMasks','all','BlockType','M-S-Function'); functionname = get_param(childpath,'Tag'); end if isempty(functionname) description = get_param(gcbh,'Description'); funcname = findstr('functionName=',description); if funcname i = funcname+14; while ~strcmp(description(i),';'), i=i+1; end functionname = description(funcname+14:i-2); end end if isempty(functionname) functionname = g_setmethod(); end setappdata(0,'ltpda_currFunctionName',functionname); try switch functionname case 'generic' paramcommand = 'functionName=''generic'';params=plist();paramEnabled=[];'; return case 'arithmetic' paramcommand = 'functionName=''arithmetic'';params=plist(''alpha'',''-->'',''beta'',''-->'');'; return otherwise [func,currClass] = strtok(get(gcbh,'Tag')); currClass(1)=[]; infoObj = eval([currClass,'.getInfo(''',functionname,''')']); if numel(infoObj.sets) > 1 paramSets = plist('sets',infoObj.sets,'currSet',1); paramcommand = ['paramSets=',string(paramSets),';','params=plist();']; elseif numel(infoObj.sets) == 1 && nparams(infoObj.plists) paramEnabled = zeros(1,nparams(infoObj.plists)); paramcommand = ['params=',string(infoObj.plists),'; paramEnabled=',mat2str(paramEnabled),';']; else paramcommand = 'params=plist();'; end end catch ME disp(sprintf('Error: unable to retrieve the parameters required by the function "%s". Maybe it''s not supported yet?',functionname)); ErrorFuncNotSupported(); rethrow(ME) end %---------------------------------------------------------------------- function ErrorFuncNotSupported(varargin) % Recalled whenever the parameters call fails % Text: '[...] Maybe it''s not supported yet?' uicontrol('Parent',currPanel,'BackgroundColor',backColor,'Units','pixels','HorizontalAlignment','center','Position',[(panelDimens(4)-300)/2 panelDimens(4)-100-100 300 30],'String','Error: unable to retrieve the parameters required by this function. Maybe it''s not supported yet?','Visible','on','Style','text'); end %---------------------------------------------------------------------- end