function syncAllOpenDialogs(source, activeDlg, paramName, paramValue, paramState, paramVisibility)
% Method to sync any open dialogs that contains the same properties. Here
% we get all the open dialogs, and propagate the correct set widget value
% and state from one dialog to the others.

%   Copyright 2017-2018 The MathWorks, Inc.

if nargin == 5
    paramVisibility = '';
end

    r=DAStudio.ToolRoot;
    d=r.getOpenDialogs;

    for i=1:length(d)
        if ~isequal(activeDlg, d(i)) && isequal(source, d(i).getDialogSource)
            if ~isempty(paramValue)
                d(i).setWidgetValue(paramName, paramValue);
            end
            if ~isempty(paramState)
                d(i).setEnabled(paramName, paramState);
            end
            if ~isempty(paramVisibility)
                d(i).setVisible(paramName, paramVisibility);
            end
        end
    end
end % end syncAllOpendialogs
