function thisview = openviewdlg(this,manager)

%% Method for creating/finding a view to support dialog boxes which need a
%% visual display of the data sucha s timeshift

%% Get all timeviews
tsview = manager.Root.find('ChildClass','tsguis.tsseriesview');
views = tsview.getChildren;

%% Does there exist a timeview which contains the timeseries referenced by
%% this tsnode? If so find its view
thisview = [];
for k=1:length(views)
    if ~isempty(views(k).Plot) && ishandle(views(k).Plot) && ...
            ~isempty(views(k).Plot.getTimeSeries(this.Timeseries.Name))
       thisview = views(k);
       break
    end
end

%% If no view exists which contains this time series then create one and
%% give it the name 'Time Shift View'
if isempty(thisview)
    newplotname = 'Edit time series';
    k = 0;
    while any(strcmp(newplotname,get(views,{'Label'})))
        k = k+1;
        newplotname = sprintf('Edit time series%d',k);
    end
    thisview = tsview.addplot(manager,newplotname);
    thisview.addTs(this.Timeseries);
end

%% Bring this view to the front
figure(thisview.Figure)