function setActiveView(h, view)

%
% setActiveView
%
% Sets the given view as the active view of the view manager.

%   Copyright 2010 The MathWorks, Inc.

% Sets the given view as an active view.
if ~isempty(view) && ~isempty(h) && isa(view, 'DAStudio.MEView')
    % Check valid view names and if it already exists or not.
    v = find(h, '-isa', 'DAStudio.MEView', 'Name', view.Name);
    if ~isempty(v) && h.ActiveView ~= v
        h.ActiveView = v;
    end
end
