use of com.insightfullogic.honest_profiler.ports.javafx.model.ApplicationContext 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;
}
use of com.insightfullogic.honest_profiler.ports.javafx.model.ApplicationContext in project honest-profiler by jvm-profiling-tools.
the class RootController method initialize.
// FXML Implementation
@Override
@FXML
public void initialize() {
super.initialize();
setApplicationContext(new ApplicationContext(this));
// Bind the InfoBar Node to the ApplicationContext.
info.textProperty().bind(appCtx().getInfo());
// Monitor running VMs on the local machine.
machineSource = new LocalMachineSource(getLogger(getClass()), this);
machineSource.start();
}
Aggregations