1 23 package org.enhydra.kelp.common.xmlc; 24 25 import org.enhydra.tool.common.ButtonPanel; 27 28 import java.awt.Window ; 30 import java.awt.event.ActionEvent ; 31 import java.awt.event.ActionListener ; 32 import java.lang.ref.WeakReference ; 33 34 public class XMLCButtonListener implements ActionListener { 36 private WeakReference ref = null; 37 38 public XMLCButtonListener(CoreXMLCTool tool) { 39 ref = new WeakReference (tool); 40 } 41 42 49 public void actionPerformed(ActionEvent event) { 50 String command = event.getActionCommand(); 51 52 if (command.equals(ButtonPanel.COMMAND_COMPILE)) { 53 getTool().build(); 54 } else if (command.equals(ButtonPanel.COMMAND_CLOSE)) { 55 getTool().closeWindow(); 56 } else if (command.equals(ButtonPanel.COMMAND_HELP)) { 57 getTool().notifyHelpListeners(event.getSource()); 58 } else if (command.equals(ButtonPanel.COMMAND_ABOUT)) { 59 getTool().showAbout(); 60 } 61 } 62 63 private CoreXMLCTool getTool() { 64 return (CoreXMLCTool) ref.get(); 65 } 66 67 } 68 | Popular Tags |