TER);

% Create the bottom button panel
OKButton = javaObjectEDT('com.mathworks.mwswing.MJButton',...
    getString(message('Control:compDesignTask:strOK')));
OKButton.setName('OKButton');
CancelButton = javaObjectEDT('com.mathworks.mwswing.MJButton',...
    getString(message('Control:compDesignTask:strCancel')));
CancelButton.setName('CancelButton');

ButtonPanel = javaObjectEDT('com.mathworks.mwswing.MJPanel');
ButtonPanel.setLayout(FlowLayout(FlowLayout.RIGHT))
ButtonPanel.add(OKButton);
ButtonPanel.add(CancelButton);
cp.add(ButtonPanel,BorderLayout.SOUTH);

% Store the handles
Handles = this.Handles;
Handles.TreeManager = TreeManager;
Handles.Dialog = Dialog;
Handles.SignalInspectPanel = SignalInspectPanel;
Handles.OpenLoopSplitPane = OpenLoopSplitPane;
Handles.OpenLoopInstruct = OpenLoopInstruct;
this.Handles = Handles;

% Set the callbacks
h = handle(OKButton,'callbackproperties');
h.ActionPerformedCallback = {@LocalOKFcn this};

h = handle(CancelButton,'callbackproperties');
h.ActionPerformedCallback = {@LocalCloseFcn this};
                           
% Set the frame to a good size
Dialog.setSize(650,450);

% Show the dialog
Dialog.setLocationRelativeTo(this.Handles.Frame);
Dialog.show;
end

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Local Functions
%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function LocalOKFcn(es,ed,this)

% Get the selected signal from the explorer dialog
Handles = this.Handles;
SignalInspectPanel = Handles.SignalInspectPanel;
selectednode = handle(getObject(SignalInspectPanel.getSelected));
dlg = selectednode.getDialogInterface;
row = dlg.getTable.getSelectedRow+1;

if ~isempty(row)
    SelectedSignal = selectednode.Signals{row};
    portdel = strfind(SelectedSignal,':');
    block = SelectedSignal(1:portdel-1);
    port = str2double(SelectedSignal(portdel+1:end));
   
    %% Add to the LoopOpenings structure
    this.LoopConfig(this.Target).LoopOpenings = [this.LoopConfig(this.Target).LoopOpenings,...
               