Skip to content

Commit

Permalink
Merge pull request #2210 from ControlSystemStudio/Issue_2208
Browse files Browse the repository at this point in the history
Fixing full screen menu item
  • Loading branch information
georgweiss authored Apr 11, 2022
2 parents d0f32c9 + 4a067f8 commit 728552b
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,7 @@ private MenuBar createMenu(final Stage stage) {
new SeparatorMenuItem(),
/* Full Screen placeholder */
new FullScreenAction(stage));
// Update Full screen action when shown to get correct enter/exit FS mode
menu.setOnShowing(event ->
{ // Last menu item
final int full_screen_index = menu.getItems().size() - 1;
final FullScreenAction full_screen = new FullScreenAction(stage);
if (!AuthorizationService.hasAuthorization("full_screen"))
full_screen.setDisable(true);
menu.getItems().set(full_screen_index, full_screen);
});

menuBar.getMenus().add(menu);

// Help
Expand All @@ -580,6 +572,13 @@ private MenuBar createMenu(final Stage stage) {
menuItems.sort(Comparator.comparing(MenuItem::getText));
selectTabMenu.getItems().clear();
selectTabMenu.getItems().addAll(menuItems);

// Update Full screen action when shown to get correct enter/exit FS mode
final int full_screen_index = menu.getItems().size() - 1;
final FullScreenAction full_screen = new FullScreenAction(stage);
if (!AuthorizationService.hasAuthorization("full_screen"))
full_screen.setDisable(true);
menu.getItems().set(full_screen_index, full_screen);
});

closeAllTabsMenuItem.setOnAction(ae -> closeAllTabs());
Expand Down

0 comments on commit 728552b

Please sign in to comment.