1 package org.enhydra.kelp.ant.xmlc; 2 3 11 import java.awt.Dialog ; 13 import java.awt.event.ActionEvent ; 14 import java.awt.event.ActionListener ; 15 import java.lang.ref.WeakReference ; 16 17 import javax.swing.JButton ; 18 19 import org.enhydra.tool.common.ButtonPanel; 20 21 22 public class AntXMLCButtonListener implements ActionListener { 23 private WeakReference ref = null; 24 25 public AntXMLCButtonListener(AntXMLCTool tool) { 26 ref = new WeakReference (tool); 27 } 28 29 36 public void actionPerformed(ActionEvent event) { 37 String command = event.getActionCommand(); 38 39 if (command.equals(ButtonPanel.COMMAND_COMPILE)) { 40 getTool().getProject().save(); 41 getTool().build(); 42 } else if (command.equals(ButtonPanel.COMMAND_CLOSE)) { 43 getTool().getProject().save(); 44 getTool().closeWindow(); 45 } else if (command.equals(ButtonPanel.COMMAND_CANCEL)) { 46 getTool().closeWindow(); 47 } else if (command.equals(ButtonPanel.COMMAND_HELP)) { 48 getTool().showHelp(null); 49 } else if (command.equals(ButtonPanel.COMMAND_ABOUT)) { 50 getTool().showAbout(); 51 } 52 } 53 54 private AntXMLCTool getTool() { 55 return (AntXMLCTool) ref.get(); 56 } 57 58 } 59 | Popular Tags |