001package jmri.jmrit.logixng.tools.swing; 002 003import java.awt.event.ActionEvent; 004import java.io.PrintWriter; 005import java.io.StringWriter; 006 007import javax.swing.AbstractAction; 008 009import jmri.InstanceManager; 010 011import org.apache.commons.lang3.mutable.MutableInt; 012 013/** 014 * Swing action to browse all LogixNGs, Modules, Tables and Global variables. 015 * 016 * @author Daniel Bergqvist Copyright (C) 2024 017 */ 018public class BrowseAllLogixNGsAction extends AbstractAction { 019 020 public BrowseAllLogixNGsAction() { 021 super(Bundle.getMessage("BrowseAllLogixNGs")); 022 } 023 024 @Override 025 public void actionPerformed(ActionEvent e) { 026 String title = Bundle.getMessage("BrowseAllLogixNGs"); 027 LogixNGBrowseWindow browseWindow = 028 new LogixNGBrowseWindow(title); 029 browseWindow.getPrintTreeSettings(); 030 browseWindow.makeBrowserWindow(true, true, title, title, (printTreeSettings) -> { 031 StringWriter writer = new StringWriter(); 032 InstanceManager.getDefault(jmri.jmrit.logixng.LogixNG_Manager.class) 033 .printTree(printTreeSettings, new PrintWriter(writer), " ", new MutableInt(0)); 034 return writer.toString(); 035 }); 036 } 037 038}