% CB_GUICLOSED Callback method which destroys the workbench object.
%
% CALL:    wb.cb_guiClosed
%
% VERSION: $Id: cb_guiClosed.m,v 1.1 2010/08/06 19:10:49 ingo Exp $
%
function cb_guiClosed(varargin)
  disp('$$$ closing LTPDAworkbench');
  wb = varargin{1};
  
  
%   % Delete workbench handle
%   h = handle(wb.mp, 'callbackproperties');
%   set(h, 'WindowClosedCallback', []);
%   
%   javaMethod('setRepositoryManager', wb.mp, []);
%   javaMethod('setLibrary', wb.mp, []);
%   
%   h.dispose
%   delete(h);
%   wb.mp = [];
  
  delete(wb);
  
%   clear();
%   evalin('base', 'clear ans');
%   java.lang.System.gc();
%   
%   pause(2);
%   
%   jDesktop   = com.mathworks.mde.desk.MLDesktop.getInstance;
%   jMainFrame = jDesktop.getMainFrame;
%   jAllFrames = jMainFrame.getFrames

  java.lang.System.gc

  clear();
  setappdata(0, 'LTPDAworkbench', []);
  disp('*** Goodbye from LTPDAworkbench');

end
