use of com.insightfullogic.honest_profiler.ports.javafx.util.ResourceUtil.CTXMENU_TREE_EXPORTSUBTREE in project honest-profiler by jvm-profiling-tools.
the class ContextMenuUtil method getContextMenu.
/**
* Constructs the {@link ContextMenu} for a {@link TreeItem}.
* <p>
* Based on the type of the Object contained in the {@link TreeItem}, menu options can be added.
* <p>
* The following options are always provided : Expand All (selected node and all its descendants), Expand First Only
* (recursively expand only the first child) and Collapse All (collapse the entire subtree).
* <p>
* For {@link Node}s, the menu will (when fixed) add an Export To File option.
* <p>
*
* @param <T> the type of the item contained in the {@link TreeItem}
* @param appCtx the {@link ApplicationContext} of the application
* @param treeItem the {@link TreeItem} for which the {@link ContextMenu} is constructed
* @return the constructed {@link ContextMenu}
*/
private static <T> ContextMenu getContextMenu(ApplicationContext appCtx, TreeItem<T> treeItem) {
ContextMenu menu = new ContextMenu();
addMenuItem(menu.getItems(), appCtx.textFor(CTXMENU_TREE_EXPANDFULLY), info -> expandFully(treeItem));
addMenuItem(menu.getItems(), appCtx.textFor(CTXMENU_TREE_EXPANDFIRSTONLY), info -> expandFirstOnly(treeItem));
addMenuItem(menu.getItems(), appCtx.textFor(CTXMENU_TREE_COLLAPSE), info -> collapseFully(treeItem));
// TODO FIX - ProfileNodes are no longer used.
if (treeItem.getValue() instanceof Node) {
addMenuItem(menu.getItems(), appCtx.textFor(CTXMENU_TREE_EXPORTSUBTREE), info -> showExportDialog(appCtx, menu.getScene().getWindow(), "stack_profile.txt", out -> writeStack(out, (Node) treeItem.getValue())));
}
return menu;
}
Aggregations