001package jmri.jmrit.logixng.swing; 002 003import javax.annotation.Nonnull; 004import javax.swing.JDialog; 005 006import jmri.JmriException; 007import jmri.jmrit.logixng.*; 008import jmri.util.swing.JmriJOptionPane; 009 010/** 011 * Abstract class for SwingConfiguratorInterface 012 * 013 * @author Daniel Bergqvist Copyright 2020 014 */ 015public abstract class AbstractSwingConfigurator implements SwingConfiguratorInterface { 016 017 private JDialog _dialog; 018 019 /** {@inheritDoc} */ 020 @Override 021 public void setJDialog(JDialog dialog) { 022 _dialog = dialog; 023 } 024 025 /** {@inheritDoc} */ 026 @Override 027 public JDialog getJDialog() { 028 return _dialog; 029 } 030 031 private void getSymbols(@Nonnull Base object, SymbolTable symbolTable) throws JmriException { 032 if (object.getParent() != null) getSymbols(object.getParent(), symbolTable); 033 034 if (object instanceof MaleSocket) { 035 symbolTable.createSymbols(symbolTable, ((MaleSocket)object).getLocalVariables()); 036 } 037 } 038 039 public void getAllSymbols(@Nonnull Base object, SymbolTable symbolTable) { 040 try { 041 getSymbols(object.getParent(), symbolTable); 042 } catch (JmriException e) { 043 JmriJOptionPane.showMessageDialog(null, 044 e.getLocalizedMessage(), 045 "Error", 046 JmriJOptionPane.ERROR_MESSAGE); 047 } 048 } 049 050 /** {@inheritDoc} */ 051 @Override 052 public String getExecuteEvaluateMenuText() { 053 throw new RuntimeException("Not supported. Class: " + this.getClass().getName()); 054 } 055 056 /** {@inheritDoc} */ 057 @Override 058 public void executeEvaluate(@Nonnull Base object) { 059 throw new RuntimeException("Not supported"); 060 } 061 062}