|
33 | 33 | end |
34 | 34 |
|
35 | 35 | function selectProtocol(obj, className) |
| 36 | + if strcmp(className, class(obj.session.protocol)) |
| 37 | + return; |
| 38 | + end |
36 | 39 | if ~isempty(className) && ~any(strcmp(className, obj.getAvailableProtocols())) |
37 | 40 | error([className ' is not an available protocol']); |
38 | 41 | end |
@@ -75,12 +78,18 @@ function selectProtocol(obj, className) |
75 | 78 | end |
76 | 79 |
|
77 | 80 | function setProtocolProperty(obj, name, value) |
| 81 | + if isequal(value, obj.session.protocol.getProperty(name)) |
| 82 | + return; |
| 83 | + end |
78 | 84 | obj.session.protocol.setProperty(name, value); |
79 | 85 | obj.session.protocol.closeFigures(); |
80 | 86 | notify(obj, 'SetProtocolProperties'); |
81 | 87 | end |
82 | 88 |
|
83 | 89 | function setProtocolProperties(obj, map) |
| 90 | + if isequal(map, obj.session.protocol.getProperties()) |
| 91 | + return; |
| 92 | + end |
84 | 93 | obj.session.protocol.setProperties(map); |
85 | 94 | obj.session.protocol.closeFigures(); |
86 | 95 | notify(obj, 'SetProtocolProperties'); |
@@ -138,12 +147,8 @@ function applyProtocolPreset(obj, name) |
138 | 147 | error([name ' is not an available protocol preset']); |
139 | 148 | end |
140 | 149 | preset = presets(name); |
141 | | - if ~strcmp(preset.protocolId, class(obj.session.protocol)) |
142 | | - obj.selectProtocol(preset.protocolId); |
143 | | - end |
144 | | - if ~isequal(preset.propertyMap, obj.session.protocol.getProperties()) |
145 | | - obj.setProtocolProperties(preset.propertyMap); |
146 | | - end |
| 150 | + obj.selectProtocol(preset.protocolId); |
| 151 | + obj.setProtocolProperties(preset.propertyMap); |
147 | 152 | end |
148 | 153 |
|
149 | 154 | function p = addProtocolPreset(obj, name) |
|
0 commit comments