下面列出了怎么用javafx.scene.control.SeparatorMenuItem的API类实例代码及写法,或者点击链接到github查看源代码。
private void initOSMac(ResourceBundle bundle) {
MenuToolkit tk = MenuToolkit.toolkit();
String appName = bundle.getString("app.name");
Menu appMenu = new Menu(appName); // Name for appMenu can't be set at Runtime
MenuItem aboutItem = tk.createAboutMenuItem(appName, createAboutStage(bundle));
MenuItem prefsItem = new MenuItem(bundle.getString("menu.preferences"));
prefsItem.acceleratorProperty().set(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.SHORTCUT_DOWN));
prefsItem.setOnAction(event -> new PreferencePane().showAndWait());
appMenu.getItems().addAll(aboutItem, new SeparatorMenuItem(), prefsItem, new SeparatorMenuItem(),
tk.createHideMenuItem(appName), tk.createHideOthersMenuItem(), tk.createUnhideAllMenuItem(),
new SeparatorMenuItem(), tk.createQuitMenuItem(appName));
Menu windowMenu = new Menu(bundle.getString("menu.window"));
windowMenu.getItems().addAll(tk.createMinimizeMenuItem(), tk.createZoomMenuItem(), tk.createCycleWindowsItem(),
new SeparatorMenuItem(), tk.createBringAllToFrontItem());
// Update the existing Application menu
tk.setForceQuitOnCmdQ(false);
tk.setApplicationMenu(appMenu);
}
@FXML
private void showRecentMenu(MouseEvent event) {
hideMenu(event);
popMenu = new ContextMenu();
popMenu.setAutoHide(true);
popMenu.getItems().addAll(getRecentMenu());
popMenu.getItems().add(new SeparatorMenuItem());
MenuItem closeMenu = new MenuItem(message("MenuClose"));
closeMenu.setStyle("-fx-text-fill: #2e598a;");
closeMenu.setOnAction((ActionEvent cevent) -> {
popMenu.hide();
popMenu = null;
});
popMenu.getItems().add(closeMenu);
showMenu(recentBox, event);
view.setImage(new Image("img/RecentAccess.png"));
text.setText(message("RecentAccessImageTips"));
locateImage(recentBox, true);
}
@Test
public void menuPath() {
List<String> path = new ArrayList<>();
Platform.runLater(() -> {
Menu menuFile = new Menu("File");
MenuItem add = new MenuItem("Shuffle");
MenuItem clear = new MenuItem("Clear");
MenuItem exit = new MenuItem("Exit");
menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit);
RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
path.add(rfxMenuItem.getSelectedMenuPath(clear));
});
new Wait("Waiting for menu selection path") {
@Override
public boolean until() {
return path.size() > 0;
}
};
AssertJUnit.assertEquals("File>>Clear", path.get(0));
}
@Test
public void menuItemIconNoText() {
List<String> path = new ArrayList<>();
Platform.runLater(() -> {
Menu menuFile = new Menu("File");
MenuItem add = new MenuItem("Shuffle");
MenuItem clear = new MenuItem();
clear.setGraphic(new ImageView(RFXTabPaneTest.imgURL.toString()));
MenuItem exit = new MenuItem("Exit");
menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit);
RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
path.add(rfxMenuItem.getSelectedMenuPath(clear));
});
new Wait("Waiting for menu selection path") {
@Override
public boolean until() {
return path.size() > 0;
}
};
AssertJUnit.assertEquals("File>>middle", path.get(0));
}
@Test
public void duplicateMenuPath() {
List<String> path = new ArrayList<>();
Platform.runLater(() -> {
Menu menuFile = new Menu("File");
MenuItem add = new MenuItem("Shuffle");
MenuItem clear = new MenuItem("Clear");
MenuItem clear1 = new MenuItem("Clear");
MenuItem clear2 = new MenuItem("Clear");
MenuItem exit = new MenuItem("Exit");
menuFile.getItems().addAll(add, clear, clear1, clear2, new SeparatorMenuItem(), exit);
RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
path.add(rfxMenuItem.getSelectedMenuPath(clear2));
});
new Wait("Waiting for menu selection path") {
@Override
public boolean until() {
return path.size() > 0;
}
};
AssertJUnit.assertEquals("File>>Clear(2)", path.get(0));
}
private void createContextMenu()
{
final ContextMenu menu = new ContextMenu();
tree_view.setOnContextMenuRequested(event ->
{
menu.getItems().clear();
if (ContextMenuHelper.addSupportedEntries(tree_view, menu))
menu.getItems().add(new SeparatorMenuItem());
menu.getItems().add(new PrintAction(tree_view));
menu.getItems().add(new SaveSnapshotAction(tree_view));
menu.getItems().add(new SendEmailAction(tree_view, "PV Snapshot", () -> "See attached screenshot.", () -> Screenshot.imageFromNode(tree_view)));
menu.getItems().add(new SendLogbookAction(tree_view, "PV Snapshot", () -> "See attached screenshot.", () -> Screenshot.imageFromNode(tree_view)));
menu.show(tree_view.getScene().getWindow(), event.getScreenX(), event.getScreenY());
});
tree_view.setContextMenu(menu);
}
private void createContextMenu()
{
final ContextMenu menu = new ContextMenu();
plot.setOnContextMenuRequested(event ->
{
menu.getItems().setAll(new ToggleToolbarMenuItem(plot));
final List<Trace<Double>> traces = new ArrayList<>();
plot.getTraces().forEach(traces::add);
if (! traces.isEmpty())
menu.getItems().add(new ToggleLinesMenuItem(plot, traces));
menu.getItems().addAll(new SeparatorMenuItem(),
new PrintAction(plot),
new SaveSnapshotAction(plot));
menu.show(getScene().getWindow(), event.getScreenX(), event.getScreenY());
});
}
private void updateContextMenu(final ContextMenuEvent event)
{
final ContextMenu menu = channel_table.getContextMenu();
final List<ChannelInfo> selection = channel_table.getSelectionModel().getSelectedItems();
if (selection.isEmpty())
menu.getItems().clear();
else
{
menu.getItems().setAll(new AddToPlotAction(channel_table, model, undo, selection),
new SeparatorMenuItem());
SelectionService.getInstance().setSelection(channel_table, selection);
ContextMenuHelper.addSupportedEntries(channel_table, menu);
menu.show(channel_table.getScene().getWindow(), event.getScreenX(), event.getScreenY());
}
}
protected synchronized void updateImpl(){
ObservableList<javafx.scene.control.MenuItem> contextMenuItems = contextMenu.getItems();
contextMenuItems.clear();
javafx.scene.control.MenuItem item = new javafx.scene.control.MenuItem(Main.getString("options"));
item.setOnAction(optionsMenuItemAction);
contextMenuItems.add(item);
item = new javafx.scene.control.MenuItem(Main.getString("send-top"));
item.setOnAction(frontMenuItemAction);
contextMenuItems.add(item);
contextMenuItems.add(new SeparatorMenuItem());
for(PluginMenuItem it : menuItems){
contextMenuItems.add(it.getJavaFXItem());
}
contextMenuItems.add(new SeparatorMenuItem());
item = new javafx.scene.control.MenuItem(Main.getString("quit"));
item.setOnAction(quitMenuItemAction);
contextMenuItems.add(item);
}
public ChartContainerController(String selectedType, IntegerProperty interval) {
Initialization.initializeFXML(this, "/fxml/dashboard/charts/ChartContainer.fxml");
this.interval = interval;
chartType = new SimpleStringProperty();
chartType.addListener(this::handleChartTypeChanged);
chartType.set(selectedType);
contextMenu = new ContextMenu();
contextMenu.getItems().addAll(
createContextMenuItem(ChartsFactory.ChartTypes.TX_PPS),
createContextMenuItem(ChartsFactory.ChartTypes.RX_PPS),
createContextMenuItem(ChartsFactory.ChartTypes.TX_BPS_L1),
createContextMenuItem(ChartsFactory.ChartTypes.TX_BPS_L2),
createContextMenuItem(ChartsFactory.ChartTypes.RX_BPS_L2),
createContextMenuItem(ChartsFactory.ChartTypes.PACKET_LOSS),
new SeparatorMenuItem(),
createContextMenuItem(ChartsFactory.ChartTypes.MAX_LATENCY, runningConfiguration.latencyEnabledProperty()),
createContextMenuItem(ChartsFactory.ChartTypes.AVG_LATENCY, runningConfiguration.latencyEnabledProperty()),
createContextMenuItem(ChartsFactory.ChartTypes.JITTER_LATENCY, runningConfiguration.latencyEnabledProperty()),
createContextMenuItem(ChartsFactory.ChartTypes.TEMPORARY_MAX_LATENCY, runningConfiguration.latencyEnabledProperty()),
createContextMenuItem(ChartsFactory.ChartTypes.LATENCY_HISTOGRAM, runningConfiguration.latencyEnabledProperty())
);
}
@Inject
public WorkspaceMenu(RecentWorkspacesService service) {
super(DefaultI18nContext.getInstance().i18n("_Workspace"));
this.service = service;
setId("workspaceMenu");
MenuItem load = new MenuItem(DefaultI18nContext.getInstance().i18n("_Load"));
load.setId("loadWorkspace");
load.setOnAction(e -> loadWorkspace());
MenuItem save = new MenuItem(DefaultI18nContext.getInstance().i18n("_Save"));
save.setOnAction(e -> saveWorkspace());
save.setId("saveWorkspace");
recent = new Menu(DefaultI18nContext.getInstance().i18n("Recen_ts"));
recent.setId("recentWorkspace");
service.getRecentlyUsedWorkspaces().stream().map(WorkspaceMenuItem::new).forEach(recent.getItems()::add);
MenuItem clear = new MenuItem(DefaultI18nContext.getInstance().i18n("_Clear recents"));
clear.setOnAction(e -> clearWorkspaces());
clear.setId("clearWorkspaces");
getItems().addAll(load, save, new SeparatorMenuItem(), recent, clear);
eventStudio().addAnnotatedListeners(this);
}
@Inject
AppContextMenu(WorkspaceMenu workspace, ModulesMenu modulesMenu) {
MenuItem exit = new MenuItem(DefaultI18nContext.getInstance().i18n("E_xit"));
exit.setOnAction(e -> Platform.exit());
exit.setAccelerator(new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN));
getItems().addAll(workspace, modulesMenu);
if (!Boolean.getBoolean(PreferencesDashboardItem.PDFSAM_DISABLE_SETTINGS_DEPRECATED)
&& !Boolean.getBoolean(PreferencesDashboardItem.PDFSAM_DISABLE_SETTINGS)) {
MenuItem settings = new MenuItem(DefaultI18nContext.getInstance().i18n("_Settings"));
settings.setOnAction(
e -> eventStudio().broadcast(new SetActiveDashboardItemRequest(PreferencesDashboardItem.ID)));
getItems().add(settings);
}
getItems().addAll(new SeparatorMenuItem(), exit);
}
private void initTopSectionContextMenu(ContextMenu contextMenu, boolean hasRanges) {
MenuItem setDestinationItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set destination"),
MaterialDesignIcon.AIRPLANE_LANDING);
setDestinationItem.setOnAction(e -> eventStudio().broadcast(
requestDestination(getSelectionModel().getSelectedItem().descriptor().getFile(), getOwnerModule()),
getOwnerModule()));
setDestinationItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.ALT_DOWN));
selectionChangedConsumer = e -> setDestinationItem.setDisable(!e.isSingleSelection());
contextMenu.getItems().add(setDestinationItem);
if (hasRanges) {
MenuItem setPageRangesItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set as range for all"),
MaterialDesignIcon.FORMAT_INDENT_INCREASE);
setPageRangesItem.setOnAction(e -> eventStudio().broadcast(
new SetPageRangesRequest(getSelectionModel().getSelectedItem().pageSelection.get()),
getOwnerModule()));
setPageRangesItem.setAccelerator(new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_DOWN));
selectionChangedConsumer = selectionChangedConsumer
.andThen(e -> setPageRangesItem.setDisable(!e.isSingleSelection()));
contextMenu.getItems().add(setPageRangesItem);
}
contextMenu.getItems().add(new SeparatorMenuItem());
}
@Test
public void invalidatedDescriptorDoesntTriggerAnything() throws Exception {
typePathAndValidate();
typePathAndValidate("/this/doesnt/exists");
WaitForAsyncUtils.waitForAsyncFx(2000, () -> {
victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.REQUESTED);
victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.LOADING);
victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.LOADED);
});
Labeled details = lookup(".-pdfsam-selection-details").queryLabeled();
assertTrue(isEmpty(details.getText()));
Labeled encStatus = lookup(".encryption-status").queryLabeled();
assertTrue(isEmpty(encStatus.getText()));
var field = lookup(".validable-container-field").queryAs(ValidableTextField.class);
field.getContextMenu().getItems().parallelStream().filter(i -> !(i instanceof SeparatorMenuItem))
.filter(i -> !i.getText().equals(DefaultI18nContext.getInstance().i18n("Remove")))
.forEach(i -> assertTrue(i.isDisable()));
}
private void onContextMenuEvent(ContextMenuEvent event) {
ObjectTag selected = selectedObjectProperty.get();
if (selected == null) {
return;
}
contextMenu = new ContextMenu();
for (int i = 0; i < 10 && i < Settings.recentNamesProperty.size(); i++) {
NameColor nameColor = Settings.recentNamesProperty.get(i);
String name = nameColor.getName();
if (name.isEmpty() || name.isBlank()) {
continue;
}
MenuItem mi = new MenuItem(name);
mi.setOnAction(value -> {
selected.nameProperty().set(name);
Settings.recentNamesProperty.addName(name);
});
contextMenu.getItems().add(mi);
}
if (!contextMenu.getItems().isEmpty()) {
contextMenu.getItems().add(new SeparatorMenuItem());
}
MenuItem editName = new MenuItem(bundle.getString("menu.editName"));
editName.setOnAction(value -> {
NameEditor editor = new NameEditor(selected.nameProperty().get());
String label = editor.showPopup(event.getScreenX(), event.getScreenY(), getScene().getWindow());
selected.nameProperty().set(label);
Settings.recentNamesProperty.addName(label);
});
MenuItem delete = new MenuItem(bundle.getString("menu.delete"));
delete.setOnAction(value -> deleteSelected(bundle.getString("menu.delete")));
contextMenu.getItems().addAll(editName, delete);
contextMenu.setAutoHide(true);
contextMenu.show(imageView, event.getScreenX(), event.getScreenY());
event.consume();
}
private void updateRecentFilesMenu() {
List<MenuItem> items = new ArrayList<>();
List<File> filesToClear = new ArrayList<>();
for (final File f : recentFiles) {
if (f.exists() && f.isFile()) {
CustomMenuItem item = new CustomMenuItem(new Label(f.getName()));
item.setOnAction(e -> loadSourceFromFile(f));
item.setMnemonicParsing(false);
Tooltip.install(item.getContent(), new Tooltip(f.getAbsolutePath()));
items.add(item);
} else {
filesToClear.add(f);
}
}
recentFiles.removeAll(filesToClear);
if (items.isEmpty()) {
openRecentMenu.setDisable(true);
return;
}
Collections.reverse(items);
items.add(new SeparatorMenuItem());
MenuItem clearItem = new MenuItem();
clearItem.setText("Clear menu");
clearItem.setOnAction(e -> {
recentFiles.clear();
openRecentMenu.setDisable(true);
});
items.add(clearItem);
openRecentMenu.getItems().setAll(items);
}
private void initData(){
SeparatorMenuItem separator2 = new SeparatorMenuItem();
Image onlineImage = ImageBox.getImageClassPath("/common/images/status/flag/big/imonline.png");
ImageView onlineImageView = new ImageView();
onlineImageView.setImage(onlineImage);
HBox hBox=new HBox();
hBox.setPadding(new Insets(0, 0, 0, 10));
hBox.getChildren().add(onlineImageView);
OnlyMenuItem item=new OnlyMenuItem("测试1");
menu.getItems().add(item);
item=new OnlyMenuItem("测试1");
menu.getItems().add(item);
//item.setGraphic(hBox);
item=new OnlyMenuItem("测试3");
menu.getItems().add(item);
menu.getItems().add(separator2);
item=new OnlyMenuItem("测试1");
menu.getItems().add(item);
//System.out.println(item);
}
/**
* Create the database menu.
*/
public DatabaseMenu() {
super(LabelGrabber.INSTANCE.getLabel("database.heading"));
newSongItem = new MenuItem(LabelGrabber.INSTANCE.getLabel("new.song.button"), new ImageView(new Image(QueleaProperties.get().getUseDarkTheme() ? "file:icons/newsong-light.png" : "file:icons/newsong.png", 16, 16, false, true)));
newSongItem.setOnAction(new NewSongActionHandler());
newSongItem.setAccelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
getItems().add(newSongItem);
getItems().add(new SeparatorMenuItem());
importMenu = new ImportMenu();
getItems().add(importMenu);
exportMenu = new ExportMenu();
getItems().add(exportMenu);
}
@Override
public void setPopupSaveToAction(Executable saveContentToFile) {
saveToFilePopupMenuItem.setOnAction(event -> saveContentToFile.execute());
TextAreaSkin customContextSkin = new TextAreaSkin(fxTextArea) {
@Override
public void populateContextMenu(ContextMenu contextMenu) {
super.populateContextMenu(contextMenu);
contextMenu.getItems().add(0, new SeparatorMenuItem());
contextMenu.getItems().add(0, saveToFilePopupMenuItem);
}
};
fxTextArea.setSkin(customContextSkin);
}
private void addAdditionalEntryToConfigNameContextMenu() {
TextFieldSkin customContextSkin = new TextFieldSkin(topicConfigNameField) {
@Override
public void populateContextMenu(ContextMenu contextMenu) {
super.populateContextMenu(contextMenu);
contextMenu.getItems().add(0, new SeparatorMenuItem());
contextMenu.getItems().add(0, generateNameMenuItem);
}
};
topicConfigNameField.setSkin(customContextSkin);
}
private void addAdditionalEntryToConfigNameContextMenu() {
TextFieldSkin customContextSkin = new TextFieldSkin(messageNameTextField) {
@Override
public void populateContextMenu(ContextMenu contextMenu) {
super.populateContextMenu(contextMenu);
contextMenu.getItems().add(0, new SeparatorMenuItem());
contextMenu.getItems().add(0, generateNameMenuItem);
}
};
messageNameTextField.setSkin(customContextSkin);
}
private ContextMenu getTopicManagementContextMenu(MenuItem deleteTopicMenuItem,
MenuItem createTopicMenuItem,
MenuItem alterTopicMenuItem,
MenuItem topicPropertiesMenuItem) {
final ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().setAll(createTopicMenuItem,
deleteTopicMenuItem,
alterTopicMenuItem,
new SeparatorMenuItem(),
topicPropertiesMenuItem);
return contextMenu;
}
private void addAdditionalEntryToConfigNameContextMenu() {
TextFieldSkin customContextSkin = new TextFieldSkin(listenerNameTextField) {
@Override
public void populateContextMenu(ContextMenu contextMenu) {
super.populateContextMenu(contextMenu);
contextMenu.getItems().add(0, new SeparatorMenuItem());
contextMenu.getItems().add(0, generateNameMenuItem);
}
};
listenerNameTextField.setSkin(customContextSkin);
}
private void populateMenuItems(ContextMenu contextMenu, Tab tab) {
int tabCount = getTabs().size();
int tabIndex = getTabs().indexOf(tab);
ObservableList<MenuItem> items = contextMenu.getItems();
items.clear();
MenuItem closeMenuItem = new MenuItem("Close");
closeMenuItem.setOnAction((e) -> requestClose(tab));
items.add(closeMenuItem);
if (tabCount > 1) {
MenuItem closeRestMenuItem = new MenuItem("Close Others");
closeRestMenuItem.setOnAction((e) -> closeOtherTabs(tab));
items.add(closeRestMenuItem);
}
if (tabCount > 1 && tabIndex != 0) {
MenuItem closeLeftTabsMenuItem = new MenuItem("Close Tabs to the Left");
closeLeftTabsMenuItem.setOnAction((e) -> closeTabsToLeft(tab));
items.add(closeLeftTabsMenuItem);
}
if (tabCount > 1 && tabIndex != tabCount - 1) {
MenuItem closeRigthTabsMenuItem = new MenuItem("Close Tabs to the Right");
closeRigthTabsMenuItem.setOnAction((e) -> closeTabsToRight(tab));
items.add(closeRigthTabsMenuItem);
}
if (tabCount > 1) {
MenuItem closeAllMenuItem = new MenuItem("Close All");
closeAllMenuItem.setOnAction((e) -> closeAllTabs());
items.addAll(new SeparatorMenuItem(), closeAllMenuItem);
}
}
private void populateMenuItems() {
historyMenuItems.clear();
populateSavedHistory(TestRunnerHistory.getInstance().getHistory("favourites"));
populateUnSavedHistory(TestRunnerHistory.getInstance().getHistory("unsaved"));
if (historyMenuItems.size() > 0) {
historyMenuItems.add(new SeparatorMenuItem());
}
historyMenuItems.add(manageHistoryAction.getMenuItem());
}
private void populateUnSavedHistory(JSONArray unsavedHistory) {
if (unsavedHistory.length() > 0 && historyMenuItems.size() > 0) {
historyMenuItems.add(new SeparatorMenuItem());
}
ArrayList<MenuItem> items = new ArrayList<>();
for (int i = 0; i < unsavedHistory.length(); i++) {
JSONObject testJSON = unsavedHistory.getJSONObject(i);
MenuItem item = createMenuItem(testJSON, false);
item.setGraphic(getIcon(State.valueOf(testJSON.getString("state"))));
items.add(0, item);
}
historyMenuItems.addAll(items);
}
private void getChidernMenuItem(Menu parentMenu, String items, List<MenuItem> menuItems) {
ObservableList<MenuItem> children = parentMenu.getItems();
for (MenuItem menuItem : children) {
if (menuItem instanceof Menu) {
getChidernMenuItem((Menu) menuItem, items, menuItems);
}
if (!(menuItem instanceof SeparatorMenuItem) && getTextForMenuItem(menuItem, menuItem.getParentMenu()).equals(items)) {
menuItems.add(menuItem);
break;
}
}
}
private void getChidernMenuItem(ObservableList<MenuItem> children, String items, List<MenuItem> menuItems) {
for (MenuItem menuItem : children) {
if (menuItem instanceof Menu) {
getChidernMenuItem(((Menu) menuItem).getItems(), items, menuItems);
}
if (!(menuItem instanceof SeparatorMenuItem) && getTextForMenuItem(menuItem).equals(items)) {
menuItems.add(menuItem);
break;
}
}
}
public MorphWidgetsMenu(final DisplayEditor editor)
{
super(Messages.ReplaceWith,
ImageCache.getImageView(DisplayEditor.class, "/icons/replace.png"));
this.editor = editor;
// Create menu that lists all widget types
final ObservableList<MenuItem> items = getItems();
WidgetCategory category = null;
for (WidgetDescriptor descriptor : WidgetFactory.getInstance().getWidgetDescriptions())
{
if (Preferences.hidden_widget_types.contains(descriptor.getType()))
continue;
// Header for start of each category
if (descriptor.getCategory() != category)
{
category = descriptor.getCategory();
// Use disabled, empty action to show category name
final MenuItem info = new MenuItem(category.getDescription());
info.setDisable(true);
items.add(new SeparatorMenuItem());
items.add(info);
}
items.add(new MorphAction(descriptor));
}
}
private ContextMenu createContextMenu(final int snapshotIndex) {
MenuItem removeItem = new MenuItem("Remove");
// removeItem.setOnAction(ev -> SaveAndRestoreService.getInstance().execute("Remove Snapshot",
// () -> update(controller.removeSnapshot(snapshotIndex))));
MenuItem setAsBaseItem = new MenuItem("Set As Base");
// setAsBaseItem.setOnAction(ev -> SaveAndRestoreService.getInstance().execute("Set new base Snapshot",
// () -> update(controller.setAsBase(snapshotIndex))));
MenuItem moveToNewEditor = new MenuItem("Move To New Editor");
// moveToNewEditor.setOnAction(ev -> SaveAndRestoreService.getInstance().execute("Open Snapshot",
// () -> update(controller.moveSnapshotToNewEditor(snapshotIndex))));
return new ContextMenu(removeItem, setAsBaseItem, new SeparatorMenuItem(), moveToNewEditor);
}