function handleClickOpenProfile(cbinfo)
    %
    
    %   Copyright 2023 The MathWorks, Inc.
    peInstance = cbinfo.Context.Object.AppObject;
    [fname, fpath] = uigetfile('*.xml', ...
        DAStudio.message('SystemArchitecture:ProfileDesigner:ImportProfileTitle'));
    if ~ischar(fname)
        return;
    end
    
    fullpath = fullfile(fpath, fname);
    splitFname = split(fname, '.');
    profileName = splitFname{1};

    existingProfilesinPE = peInstance.ProfileBrowser.dataProvider.UUIDtoNameMap.values;
    if ~isempty(find(strcmp(string(existingProfilesinPE), profileName), 1))
        dp = DAStudio.DialogProvider;
        dp.warndlg(...
            DAStudio.message('SystemArchitecture:Profile:ProfileAlreadyExists', profileName), ...
            DAStudio.message('SystemArchitecture:ProfileDesigner:ErrorLoadingProfile'), ...
            true);
        return;
    end
    
    try
        m = systemcomposer.internal.profile.Profile.loadFromFile(fullpath); %#ok<NASGU>
    catch me
        dp = DAStudio.DialogProvider;
        eDlg = dp.errordlg(...
            DAStudio.message('SystemArchitecture:ProfileDesigner:InvalidProfileFile', me.message), ...
            DAStudio.message('SystemArchitecture:ProfileDesigner:ErrorLoadingProfile'), ...
            true);
        eDlg.show;
        return;
    end
    
    %While opening the profile, the profile browser should update with the
    %profile and all of its dependent profile.
    model = systemcomposer.profile.internal.Model;
    allProfiles = model.Profiles;

    profileUUIDs = peInstance.ProfileBrowser.dataProvider.UUIDtoUUIDMap('_INVISIBLE_ROOT_');
    profileIds = {};
    
    for prof = allProfiles
        profileObj = systemcomposer.profile.Profile.find(prof.getName).getImpl;
        profName = profileObj.getName;

        existingProfilesinPE = peInstance.ProfileBrowser.dataProvider.UUIDtoNameMap.values;
        matches = cellfun(@(x) strcmp(string(x), string(profName)), existingProfilesinPE);
        if ~any(matches)
    id = string(matlab.lang.internal.uuid);
    profileUUIDs = [profileUUIDs id];
            profileIds{end+1} = char(id);

            peInstance.ProfileBrowser.dataProvider.UUIDtoNameMap(id) = string(profName);
            peInstance.ProfileBrowser.dataProvider.addProfileDatatoMaps(profileObj);
        end
    end

    peInstance.ProfileBrowser.dataProvider.UUIDtoUUIDMap('_INVISIBLE_ROOT_') = profileUUIDs;
    peInstance.ProfileBrowser.dataProvider.rearrangeData('_INVISIBLE_ROOT_');

    peInstance.ProfileBrowser.dataModel.insertRows('_INVISIBLE_ROOT_', 0, length(profileIds), profileIds);
    children = peInstance.ProfileBrowser.dataProvider.UUIDtoUUIDMap('_INVISIBLE_ROOT_');
    dm = peInstance.ProfileBrowser.dataModel;
    dm.rowChanged('_INVISIBLE_ROOT_', length(children), {});
    for i = 1:length(children)
        peInstance.updateInternalData(dm, i-1, children(i), '_INVISIBLE_ROOT_');
    end
    
    
    r = peInstance.ProfileBrowser.createNewRow(0, -1, id);
    peInstance.ProfileBrowser.clearSelection();
    peInstance.ProfileBrowser.addToSelection(r);
    peInstance.handleBrowserClickEvent(peInstance.ProfileBrowser.getTable);

end
