function hiliteBlock(this)
% HILITEBLOCK method highlights currently selected result's block in
% Simulink Canvas

% Copyright 2018-2019 The MathWorks, Inc.
    
    selection = this.FPTInstance.getSelectedResult;
    
    if isempty(selection)
        fxptui.showdialog('generalnoselection');
        return;
    end
    
    % If the result is a MATLABExpressionResult hierarchy, then
    % highlight it in the codeview instead.
    if isa(selection, 'fxptds.MATLABExpressionResult')
        this.hiliteMLResult(selection);
    else
        blockPath = this.FPTInstance.getViewDataset().LastHighlightedBlock;
        if ~isempty(blockPath)
            set_param(blockPath, 'Selected', 'off');
        end
        
        fxptds.AbstractActions.selectAndInvoke('hiliteInEditor', selection);
        
        % select block programmatically 
        blockObject = selection.getUniqueIdentifier.getObject;
        set_param(blockObject.getFullName, 'Selected', 'on');
        
        this.FPTInstance.getViewDataset().setLastHighlightedBlock(blockObject.getFullName);
    end
end
