Skip to content

Commit 00c203d

Browse files
committed
Disabling begin epoch group on data manager nodes when you can't begin an epoch group
1 parent a6c91f9 commit 00c203d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/main/matlab/+symphonyui/+ui/+presenters/DataManagerPresenter.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,14 +722,14 @@ function onServiceChangedControllerState(obj, ~, ~)
722722
end
723723

724724
function updateStateOfControls(obj)
725-
hasOpenFile = obj.documentationService.hasOpenFile();
726-
hasSource = hasOpenFile && ~isempty(obj.documentationService.getExperiment().sources);
727-
hasEpochGroup = hasOpenFile && ~isempty(obj.documentationService.getCurrentEpochGroup());
725+
hasSource = ~isempty(obj.documentationService.getExperiment().sources);
728726
controllerState = obj.acquisitionService.getControllerState();
729727
isStopped = controllerState.isStopped();
730728

731-
%obj.view.enableBeginEpochGroup(hasSource && isStopped);
732-
%obj.view.enableEndEpochGroup(hasEpochGroup && isStopped);
729+
enableBeginEpochGroup = hasSource && isStopped;
730+
731+
obj.view.enableBeginEpochGroupMenu(obj.view.getExperimentNode(), enableBeginEpochGroup);
732+
obj.view.enableBeginEpochGroupMenu(obj.view.getEpochGroupsFolderNode(), enableBeginEpochGroup);
733733
end
734734

735735
function loadSettings(obj)

src/main/matlab/+symphonyui/+ui/+views/DataManagerView.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,13 @@ function setEpochGroupNodeNormal(obj, node)
619619
menu = obj.addEntityContextMenus(menu);
620620
set(node, 'UIContextMenu', menu);
621621
end
622+
623+
function enableBeginEpochGroupMenu(obj, node, tf) %#ok<INUSL>
624+
menu = get(node, 'UIContextMenu');
625+
children = get(menu, 'Children');
626+
index = arrayfun(@(c)isequal(get(c, 'Label'), 'Begin Epoch Group...'), children);
627+
set(children(index), 'Enable', appbox.onOff(tf));
628+
end
622629

623630
function n = addEpochBlockNode(obj, parent, name, entity)
624631
value.entity = entity;

0 commit comments

Comments
 (0)