function added = addView(h, view)

% addView
%
% Adds a new view to the view manager. If successful returns true,
% false otherwise.

%   Copyright 2009-2010 The MathWorks, Inc.

% add view to the view management hierarchy
added = false;
if ~isempty(view) && ~isempty(h)
    % Check valid view names and if it already exists or not.
    v = find(h, '-isa', 'DAStudio.MEView', 'Name', view.Name);
    if isempty(v)
        view.ViewManager = h;
        view.connect(h, 'up');
        view.enableLiveliness;
        added = true;
    end
end
