Newer
Older
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
% Java needs to be loaded here. Thus load it.
% First find the path.
path = mfilename('fullpath');
path = [path(1:size(path, 2)-6) 'Matlab2SMT/Matlab2SMT-1.0-SNAPSHOT-jar-with-dependencies.jar'];
% Verify the jar isn't already in the classpath.
classpath = javaclasspath;
exists = 0;
for i=1:size(classpath,1)
if strcmp(classpath{i}, path) == 1
exists = 1;
end
end
if exists == 0
% Not added yet, thus add it.
javaaddpath(path);
end
orig_gcbh = gcbh;
Action = varargin{1};
Colin Eles
committed
DAStudio.warning('improper function use');
LocalOpenBlockFcn(blockHandleTTTopMask,1);
LocalOpenBlockFcn([],0);
case 'Close',
blockHandleTTTopMask = orig_gcbh;
LocalCloseBlockFcn(blockHandleTTTopMask);
case 'Copy',
blockHandleTTTopMask = orig_gcbh;
LocalCopyBlockFcn(blockHandleTTTopMask);
Colin Eles
committed
DAStudio.warning('improper function use');
data = importdata(file);
gui = GUI([],0);
Colin Eles
committed
gui.setData(data);
Colin Eles
committed
msgbox(exception.identifier);
blockHandleTTTopMask = orig_gcbh;
data = get_param(blockHandleTTTopMask,'UserData');
if isempty(data)
return
end
errordlg(...
DAStudio.message('Block Data has been corputed'),...
Colin Eles
committed
'Error', 'modal');
Colin Eles
committed
delete(data.fig);
set_param(blockHandleTTTopMask,'UserData',data);
DAStudio.error('Simulink:dialog:UnknownAction',Action);
end
function LocalCopyBlockFcn(blockHandleTTTopMask)
data = get(blockHandleTTTopMask,'UserData');
if(~isempty(data))
data_new = data.clone(blockHandleTTTopMask);
Colin Eles
committed
set_param(blockHandleTTTopMask,'UserData',data_new);
data = [];
if (mode == 1)
modelHandle = bdroot(blockHandleTTTopMask);
Colin Eles
committed
% check if the user is trying to open the block from the library
Colin Eles
committed
if strcmp(get_param(modelHandle,'Lock'), 'on') || strcmp(get_param(blockHandleTTTopMask,'LinkStatus'),'implicit')
errordlg(...
DAStudio.message('can not open Model Locked, Add to new model to use'),...
Colin Eles
committed
'Error', 'modal');
Colin Eles
committed
end
data = get_param(blockHandleTTTopMask,'UserData');
end
if isempty(data)
data = Data();
data.init();
else
if ~data.valid
errordlg(...
DAStudio.message('Block Data has been corputed'),...
Colin Eles
committed
'Error', 'modal');
return
end
if data.open
if ishghandle(data.fig)
Colin Eles
committed
figure(data.fig);
Colin Eles
committed
end
if mode == 1
gui = GUI(blockHandleTTTopMask,1);
elseif mode == 0
gui = GUI([],0);
end
Colin Eles
committed
gui.setData(data);
gui.init();
if(mode == 1)
set_param(blockHandleTTTopMask,'UserData',data);
set_param(blockHandleTTTopMask, 'UserDataPersistent', 'on');
end
end
function LocalCloseRequestBlockFcn(blockHandleTTTopMask)
modelHandle = bdroot(blockHandleTTTopMask);
data = get_param(blockHandleTTTopMask,'UserData');
Colin Eles
committed
if ~isempty(data)
if data.open
Colin Eles
committed
delete(data.fig);
Colin Eles
committed
end
end
%set_param(gui.fig,'Visible','off')