Mercurial > hg > ltpda
annotate m-toolbox/m/helper/mc.m @ 35:4be5f7a5316f database-connection-manager
Suppress output messages on preferences loading and saving
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | ce4df2e95a55 |
children |
rev | line source |
---|---|
0 | 1 % A function to properly clear MATLAB memory for LTPDA. |
2 % | |
3 % M Hewitson 06-08-08 | |
4 % | |
5 % $Id: mc.m,v 1.11 2011/02/03 13:42:43 ingo Exp $ | |
6 % | |
7 | |
8 % Remove this object from memory so we can clear classes | |
9 % prefs = getappdata(0, 'LTPDApreferences'); | |
10 % prefs.misc.default_window = ''; | |
11 | |
12 % TODO: We need to close all GUIs before doing this - Prefs GUI and Repo Gui | |
13 | |
14 function mc() | |
15 | |
26
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
16 % remove preferences |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
17 try |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
18 rmappdata(0, 'LTPDApreferences'); |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
19 end |
0 | 20 |
26
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
21 % database connection manager |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
22 cm = getappdata(0, 'LTPDADatabaseConnenctionManager'); |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
23 if ~isempty(cm) |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
24 % save cached credentials |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
25 setappdata(0, 'LTPDAcredentials', cm.credentials); |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
26 % remove database connection manager |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
27 rmappdata(0, 'LTPDADatabaseConnenctionManager'); |
0 | 28 end |
29 | |
26
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
30 evalin('caller', 'clear'); % delete the timer-objects |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
31 clear classes % delete the local variables |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
32 evalin('caller', 'clear classes'); % delete the variables in the caller function |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
33 evalin('base', 'clear classes'); % delete the variables in the 'base' workspace |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
34 |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
35 % load the preferences again |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
36 LTPDAprefs.loadPrefs(); |
0 | 37 |
26
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
38 % instantiate database connection manager if required |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
39 credentials = getappdata(0, 'LTPDAcredentials'); |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
40 if ~isempty(credentials) |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
41 cm = LTPDAConnectionManager(); |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
42 cm.credentials = credentials; |
0 | 43 end |
26
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
44 try |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
45 rmappdata(0, 'LTPDAcredentials'); |
ce4df2e95a55
Remove LTPDARepositoryManager initialization
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
46 end |
0 | 47 |
48 end |