1 package org.enhydra.kelp.ant.deployer; 2 3 11 12 import org.enhydra.kelp.common.AbstractTool; 14 import org.enhydra.kelp.common.event.SelectionPanelEvent; 15 import org.enhydra.kelp.common.event.SelectionPanelListener; 16 import org.enhydra.kelp.common.event.WriteListener; 17 import org.enhydra.kelp.common.node.OtterProject; 18 import org.enhydra.kelp.common.node.OtterFileNode; 19 import org.enhydra.kelp.common.swing.AddinInnerPanel; 20 24 25 import org.enhydra.kelp.ant.node.AntProject; 27 import org.enhydra.kelp.ant.swing.HTMLViewer; 28 30 31 import org.enhydra.tool.common.PathHandle; 33 import org.enhydra.tool.common.InnerPanel; 34 import org.enhydra.tool.common.SwingUtil; 35 import org.enhydra.tool.common.ButtonPanel; 36 import org.enhydra.tool.common.event.FirstFocusEvent; 37 import org.enhydra.tool.common.event.FirstFocusListener; 38 39 import java.io.File ; 41 import java.awt.Component ; 42 import java.awt.Dialog ; 43 import java.awt.Frame ; 44 import java.awt.event.ActionListener ; 45 import java.lang.ref.WeakReference ; 46 import java.net.URL ; 47 import java.util.ResourceBundle ; 48 57 58 public class AntDeployTool extends AbstractTool 59 implements FirstFocusListener { 60 61 static ResourceBundle addinRes = 62 ResourceBundle.getBundle("org.enhydra.kelp.common.Res"); 63 private AntDeployInnerPanel innerPanel = null; 64 private AntDeployButtonPanel buttonPanel = null; 66 private WeakReference compileRef = null; 67 68 public AntDeployTool() { 69 super(); 70 innerPanel = new AntDeployInnerPanel(); 71 buttonPanel = new AntDeployButtonPanel(); 72 innerPanel.addFirstFocusListener(this); 73 } 74 public static void main(String [] args) { 75 SwingUtil.setLookAndFeelToSystem(); 76 AntDeployTool tool = null; 77 AntProject project = null; 78 if(args.length > 0){ 79 File root = new File (args[0]); 81 if(!root.exists()){ 82 System.err.println("ERROR: directory'"+args[0]+"' don't exist!"); 83 return; 84 } 85 try { 86 project = new AntProject(args[0]); 87 } 88 catch (Exception ex) { 89 ex.printStackTrace(); 90 return; 91 } 92 93 }else{ 94 return; 95 } 97 98 tool = new AntDeployTool(); 99 tool.setProject(project); tool.showDialog(new Frame ()); 101 return; 102 } 103 106 public void build() { 107 ((AntDeployInnerPanel)getInnerPanel()).selectOutputTab(); 108 ((AntDeployInnerPanel)getInnerPanel()).save(); 109 ((AntDeployInnerPanel)getInnerPanel()).clearOutput(); 110 buildImpl(); 111 } 112 113 private void buildImpl() { 114 AntDeployBuilder builder = new AntDeployBuilder(((AntDeployInnerPanel)getInnerPanel()).getWriteListeners()); 115 builder.setProject(getProject()); 116 builder.build(); 117 } 118 119 public static final String getDefaultTitle() { 120 return "Deployer"; 121 } 122 123 public String getTitle() { 125 return AntDeployTool.getDefaultTitle(); 126 } 127 128 public InnerPanel getInnerPanel() { 130 return innerPanel; 131 } 132 133 public ButtonPanel getButtonPanel() { 135 return buttonPanel; 136 } 137 138 public ActionListener createButtonListener() { 139 return (new AntDeployButtonListener(this)); 140 } 141 142 public void setProject(OtterProject project) { 144 super.setProject(project); 145 } 147 148 public void clearAll() { 150 super.clearAll(); 151 innerPanel.removeFirstFocusListener(this); 152 if (compileRef != null) { 153 compileRef.clear(); 154 } 155 innerPanel = null; 156 buttonPanel = null; 157 compileRef = null; 158 } 159 160 public void onFirstFocus(FirstFocusEvent event) { 162 163 } 164 165 public void showHelp(Dialog parent){ 166 URL helpURL = this.getClass().getClassLoader().getResource("using_ant_kelp.html"); 167 HTMLViewer.createAndShow(parent, "Kelp Help", helpURL); 168 169 } 170 protected String getProgressTitle() { 172 return addinRes.getString("Deployment_Progress"); 173 } 174 175 protected AddinInnerPanel getPropertyPanel() { 177 return innerPanel; 178 } 179 180 protected void back() { 181 innerPanel.back(); 182 } 183 184 protected void next() { 185 innerPanel.next(); 186 } 187 } 188 | Popular Tags |