function hPropEdit_out = cstpropedit(RespObj)
%CSTPROPEDIT  Opens and retargets the property editor.

%   Authors: Adam DiVergilio and P. Gahinet
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.6 $  $Date: 2000/06/30 17:33:30 $

% RE: When called w/o input, CSTPROPEDIT returns the property editor handle.

mlock

persistent hPropEdit

if nargin
   %---Abort if Java MWT is unsupported
    if ~usejava('MWT')
       hPropEdit_out = hPropEdit;
       return;
    end

    % Retarget property editor to selected @response object
    if isempty(hPropEdit)
        % Create prop editor GUI
        hPropEdit = cstprefs.respedit;
    end
    % Retarget
    fig = watchon;
    UIC = get(RespObj,'UIContextMenu');
    hPropEdit.Target = UIC.Main;

    %---Raise GUI
    set(hPropEdit.GUI,'Minimized','off','Visible','off','Visible','on');

    watchoff(fig);
end
hPropEdit_out = hPropEdit;
