1 23 package org.enhydra.kelp.forte.actions; 24 25 import org.openide.nodes.Node; 27 import org.openide.util.HelpCtx; 28 import org.openide.util.NbBundle; 29 import org.openide.util.actions.CallableSystemAction; 30 import org.openide.TopManager; 31 import org.openide.loaders.DataFolder; 32 import org.openide.loaders.DataObject; 33 import org.openide.src.ClassElement; 34 import org.openide.DialogDescriptor; 35 import org.openide.filesystems.FileSystem; 36 import org.openide.filesystems.FileObject; 37 38 import org.enhydra.tool.common.SwingUtil; 40 import org.enhydra.tool.common.event.HelpEvent; 41 import org.enhydra.tool.common.event.HelpListener; 42 43 import org.enhydra.kelp.KelpInfo; 45 import org.enhydra.kelp.common.dods.CoreDodsTool; 46 import org.enhydra.kelp.common.dods.DodsButtonPanel; 47 import org.enhydra.kelp.common.dods.DodsButtonListener; 48 import org.enhydra.kelp.common.node.OtterFileNode; 49 50 import org.enhydra.kelp.forte.node.ForteProject; 52 53 import java.awt.Dialog ; 55 import java.awt.event.ActionListener ; 56 import java.awt.event.ActionEvent ; 57 import java.net.URL ; 58 import java.net.MalformedURLException ; 59 60 import java.io.File ; 62 import java.io.FileInputStream ; 63 import java.io.FileOutputStream ; 64 69 public class DODSAction extends CallableSystemAction implements HelpListener { 70 private static String anchor = "dodswizard"; 71 72 public void onHelp(HelpEvent event) { 74 URL url = null; 75 String [] home = new String [2]; 76 home[0] = System.getProperty("netbeans.home"); 77 home[1] = System.getProperty("netbeans.user"); 78 StringBuffer buf = new StringBuffer (); 79 buf.append(KelpInfo.getAddinHelpURL(home)); 80 buf.append('#').append(anchor); 81 try { 82 url = new URL (buf.toString()); 83 TopManager.getDefault().showUrl(url); 84 } catch (MalformedURLException e) { 85 e.printStackTrace(System.err); 86 } 87 } 88 89 public void performAction() { 90 ForteProject project = new ForteProject(); 94 project.setEnhydraPath(); 95 96 System.setProperty("DODS_HOME", project.getEnhydraPath()+ 97 File.separator+"dods"); 98 99 String [] options = DodsButtonPanel.getOptions(); 100 101 CoreDodsTool tool = new CoreDodsTool(); 102 DodsButtonListener listener = new DodsButtonListener(tool); 103 tool.getInnerPanel().initPreferredSize(); 104 105 tool.setProject(project); 106 DialogDescriptor dscr = new DialogDescriptor(tool.getInnerPanel(), 107 tool.getTitle(), true, options, options[1], 108 DialogDescriptor.BOTTOM_ALIGN, HelpCtx.DEFAULT_HELP, 109 listener); 110 Dialog dlg = TopManager.getDefault().createDialog(dscr); 111 tool.addHelpListener(this); 112 dlg.show(); 113 114 } 115 116 public String getName() { 117 return CoreDodsTool.getDefaultTitle(); 118 } 119 120 public boolean isEnabled() 121 { 122 return (new ForteProject().getRootFolder() != null); 123 } 124 125 126 protected String iconResource() { 127 return "smallicon.gif"; 128 } 129 130 public HelpCtx getHelpCtx() { 131 return HelpCtx.DEFAULT_HELP; 132 133 } 136 137 141 protected void initialize() { 142 super.initialize(); 144 putProperty(javax.swing.Action.SHORT_DESCRIPTION, 145 NbBundle.getMessage(DeploymentAction.class, 146 "HINT_DODS_Action")); 147 } 148 149 } 150 | Popular Tags |