function [blkH, lineH] = getSelectionHandles()
% Find the last editor instance and get the selection handles

%   Copyright 2014 The MathWorks, Inc.

editor = GLUE2.AbstractDomain.findLastActiveEditor();
s = editor.getSelection;
n = s.size;
h = [];
for i=1:n
    obj = s.at(i);
    if isa(obj, 'SLM3I.Block') || isa(obj, 'SLM3I.Segment')
        h = [h; obj.handle];
    end
end


% Filter for blocks only
filt = arrayfun(@(x) strcmp(get(x,'Type'), 'block'), h);
blkH = h(filt);

% Filter for lines only
filt2 = arrayfun(@(x) strcmp(get(x,'Type'), 'line'), h);
lineH = h(filt2);

end
