1 package org.enhydra.kelp.jbuilder.actions; 2 3 import com.borland.primetime.ide.Browser; 4 import com.borland.primetime.ide.BrowserAction; 5 import javax.swing.AbstractAction ; 6 import org.enhydra.kelp.ant.deployer.AntDeployTool; 7 import com.borland.jbuilder.node.JBProject; 8 import com.borland.primetime.vfs.Filesystem; 9 import com.borland.primetime.vfs.VFS; 10 import com.borland.primetime.vfs.Url; 11 import com.borland.primetime.node.FileNode; 12 import java.io.File ; 13 import com.borland.primetime.node.FolderNode; 14 import com.borland.primetime.node.Node; 15 import com.borland.primetime.node.LightweightNode; 16 import org.enhydra.kelp.ant.node.AntProject; 17 import org.enhydra.kelp.jbuilder.node.NodeUtil; 18 19 public class DeployerAction extends BrowserAction 20 { 21 22 private JBProject project; 23 24 public DeployerAction(String s, char c) { 25 super(s, c); 26 } 27 28 public void actionPerformed(Browser browser) { 29 String prjPath = null; 30 Url url; 31 project = (JBProject) browser.getActiveProject(); 32 prjPath = project.getProjectPath().getFullName(); 33 AntProject antProject = null; 34 try { 35 antProject = new AntProject(prjPath); 36 } 37 catch (Exception e) { 38 e.printStackTrace(); 39 } 40 41 AntDeployTool.main(new String [] {prjPath}); 42 43 url = new Url(new File (antProject.getProperty(AntProject.OUTPUT_DIR))); 44 if (url.getFileObject().exists()) { 45 try { 46 NodeUtil.doAddFolders(project, project, url); 47 } 48 catch (Exception ex) { 49 ex.printStackTrace(); 50 } 51 browser.getActiveProject().refresh(); 52 } 53 } 54 55 61 public void update(Browser browser) { 62 if (browser.getActiveProject() != null) { 63 project = (JBProject)browser.getActiveProject(); 64 setEnabled( (project instanceof JBProject) && 65 (project.getProperty("enhydra.project", "false") 66 .equalsIgnoreCase("true")) ); 67 } else { 68 setEnabled(false); 69 } 70 } 71 } | Popular Tags |