Skip to content

Commit

Permalink
Merge pull request #2746 from ControlSystemStudio/tabs_active_fix
Browse files Browse the repository at this point in the history
Tabs: Fix editor hangup when active_tab too large
  • Loading branch information
kasemir authored Jul 26, 2023
2 parents 0c2504a + 90336cd commit ef2eea2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015-2016 Oak Ridge National Laboratory.
* Copyright (c) 2015-2023 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -19,6 +19,7 @@
import org.csstudio.display.builder.model.widgets.ArrayWidget;
import org.csstudio.display.builder.model.widgets.GroupWidget;
import org.csstudio.display.builder.model.widgets.TabsWidget;
import org.csstudio.display.builder.model.widgets.TabsWidget.TabItemProperty;
import org.csstudio.display.builder.model.widgets.VisibleWidget;

import javafx.geometry.Rectangle2D;
Expand Down Expand Up @@ -137,8 +138,9 @@ private ParentSearchResult findParent(final List<Widget> children)
else if (widget instanceof TabsWidget)
{ // Check children of _selected_ Tab
final TabsWidget tabwid = (TabsWidget) widget;
final int selected = tabwid.propActiveTab().getValue();
child_prop = tabwid.propTabs().getValue().get(selected).children();
final List<TabItemProperty> tabs = tabwid.propTabs().getValue();
int selected = Math.min(tabwid.propActiveTab().getValue(), tabs.size()-1);
child_prop = tabs.get(selected).children();
}
else if (widget instanceof ArrayWidget)
{
Expand Down

0 comments on commit ef2eea2

Please sign in to comment.