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.dods.KelpDODSGenerator; 7 import com.borland.primetime.node.Project; 8 import com.borland.primetime.vfs.Url; 9 import com.borland.jbuilder.node.JBProject; 10 import java.io.File ; 11 import org.enhydra.kelp.ant.node.AntProject; 12 13 public class DODSAction extends BrowserAction 14 { 15 16 public DODSAction(String s, char c) { 17 super(s, c); 18 } 19 20 public void actionPerformed(Browser browser) { 21 String prjPath = null; 22 JBProject project = (JBProject)browser.getActiveUserProject(); 23 if (project != null) { 24 try { 25 prjPath = project.getProjectPath().getFullName(); 26 AntProject antProject = new AntProject(prjPath); 27 String enhydraDir = antProject.getProperty(AntProject.ENHYDRA_DIR); 28 File dodsDirFile = new File (enhydraDir, "dods"); 29 System.setProperty("DODS_HOME", dodsDirFile.getAbsolutePath()); 30 KelpDODSGenerator.main(new String [] {prjPath}); 31 } 32 catch (Exception ex) { 33 ex.printStackTrace(); 34 } 35 project.refresh(); 36 } 37 } 38 39 45 public void update(Browser browser) { 46 JBProject project; 47 if (browser.getActiveProject() != null) { 48 project = (JBProject)browser.getActiveProject(); 49 setEnabled( (project instanceof JBProject) && 50 (project.getProperty("enhydra.project", "false") 51 .equalsIgnoreCase("true")) ); 52 } else { 53 setEnabled(false); 54 } 55 } 56 57 } | Popular Tags |