KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > jbuilder > actions > XMLCAction


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 JavaDoc;
6 import org.enhydra.kelp.ant.xmlc.AntXMLCTool;
7 import javax.swing.JOptionPane JavaDoc;
8 import com.borland.primetime.node.Project;
9 import com.borland.primetime.vfs.Url;
10 import java.io.File JavaDoc;
11 import com.borland.jbuilder.node.JBProject;
12
13 public class XMLCAction extends BrowserAction
14 {
15
16   public XMLCAction(String JavaDoc s, char c) {
17     super(s, c);
18   }
19
20   public void actionPerformed(Browser browser) {
21     String JavaDoc prjPath = null;
22     JBProject project = (JBProject)browser.getActiveProject();
23     if (project != null) {
24       prjPath = project.getProjectPath().getFullName();
25       AntXMLCTool.main(new String JavaDoc[] {prjPath});
26       project.refresh();
27     }
28   }
29
30   /**
31    * Enables deploy action if current project exists and if it is JBProject type
32    * and if exist builder.xml file in the project
33    *
34    * @param browser
35    */

36   public void update(Browser browser) {
37     JBProject project;
38     if (browser.getActiveProject() != null) {
39       project = (JBProject)browser.getActiveProject();
40       setEnabled( (project instanceof JBProject) &&
41                   (project.getProperty("enhydra.project", "false")
42                     .equalsIgnoreCase("true")) );
43     } else {
44       setEnabled(false);
45     }
46   }
47
48 }
Popular Tags