001package jmri.jmrit.whereused; 002 003import javax.swing.JTextArea; 004import jmri.NamedBean; 005import jmri.NamedBean.DisplayOptions; 006 007/** 008 * Find memory references. 009 * 010 * @author Dave Sand Copyright (C) 2020 011 */ 012 013public class MemoryWhereUsed { 014 015 /** 016 * Populate a textarea with the where used content for the supplied memory. 017 * @param memory The memory bean. 018 * @return a populated textarea. 019 */ 020 static public JTextArea getWhereUsed(NamedBean memory) { 021 JTextArea textArea = new JTextArea(); 022 String label = Bundle.getMessage("MakeLabel", Bundle.getMessage("BeanNameMemory")); // NOI18N 023 textArea.append(Bundle.getMessage("ReferenceTitle", label, memory.getDisplayName(DisplayOptions.USERNAME_SYSTEMNAME))); // NOI18N 024 textArea.append(Bundle.getMessage("ListenerCount", memory.getNumPropertyChangeListeners())); // NOI18N 025 026 textArea.append(WhereUsedCollectors.checkLayoutBlocks(memory)); 027 textArea.append(WhereUsedCollectors.checkLogixConditionals(memory)); 028 textArea.append(WhereUsedCollectors.checkLogixNGConditionals(memory)); 029 textArea.append(WhereUsedCollectors.checkPanels(memory)); 030 return textArea; 031 } 032}