function res = SimscapeBus_svg(funcName, varargin)
%

%   Copyright 2017-2018 The MathWorks, Inc.

    f = str2func(funcName);
    res = f(varargin{:});
end

function res=isEditable(elemId) %#ok<DEFNU> Called by str2func from SimscapeBus_svg
    res = startsWith(elemId, 'hierStrs');
end

function res = onTextEditComplete(blockHandle, elemId, ~, ~, text) %#ok<DEFNU> Called by str2func from SimscapeBus_svg
    res = 'OK';
    
    if isempty(text)
        % There is a special case where if the user enters empty text then
        % we want to ignore the change. Otherwise we might end up deleting
        % the port which is not desirable here.
        return;
    end   
    
    index = 0;
    if startsWith(elemId, 'hierStrs_repeat_') 
        index = str2double(elemId(17:end));
    end
    
    hierStrings = get_param(blockHandle, 'HierarchyStrings');
    strArray = split(hierStrings, ';');
    strArray{index+1}=text;
    hierStrings = char(join(strArray, ';'));

    SLBlockIcon.setBlockParamsWithUndo(blockHandle, 'HierarchyStrings', hierStrings);
end

% LocalWords:  hier Strs
