1 23 24 package org.enhydra.kelp.forte.node; 25 26 import org.openide.actions.*; 27 import org.openide.cookies.*; 28 import org.openide.loaders.*; 29 import org.openide.nodes.*; 30 import org.openide.util.HelpCtx; 31 import org.openide.filesystems.FileObject; 32 import org.openide.filesystems.FileSystem; 33 import org.openide.filesystems.FileStateInvalidException; 34 35 import org.enhydra.kelp.forte.DeploySettings; 36 37 import org.enhydra.kelp.common.PathUtil; 38 39 import java.io.File ; 40 41 45 public class DeployDataObject extends MultiDataObject { 46 47 static final long serialVersionUID = -1461825550268566994L; 48 49 protected DeploySettings settings = null; 50 51 public DeployDataObject (FileObject pf, DeployDataLoader loader) throws DataObjectExistsException 52 { 53 super (pf, loader); 54 init (); 55 } 56 57 private void init () { 58 settings = DeploySettings.getDefault(); 59 CookieSet cookies = getCookieSet (); 60 73 cookies.add(new XMLCEditorSupport(this)); 74 } 75 76 public HelpCtx getHelpCtx () { 77 return HelpCtx.DEFAULT_HELP; 78 } 81 82 protected Node createNodeDelegate () { 83 return new DeployDataNode (this); 84 } 85 86 public String getPath() 87 { 88 FileObject file = getPrimaryFile(); 89 StringBuffer res = new StringBuffer (); 90 FileSystem fs = null; 91 try 92 { 93 fs = file.getFileSystem(); 94 } catch (FileStateInvalidException e) 95 { 96 System.err.println(e); 97 return "invalid"; 98 } 99 100 res.append(fs.getSystemName()); 101 String pack = file.getPackageNameExt(File.separatorChar, '.'); 102 res.append(File.separatorChar); 103 res.append(pack); 104 105 return res.toString(); 106 } 107 108 public String getProperty(String key) 109 { 110 String path = PathUtil.compressPathRelativeToProject(new ForteProject(), getPath()); 111 return (String )settings.getNodeProperty(path + key); 112 } 113 114 public void setProperty(String key, String value) 115 { 116 String path = PathUtil.compressPathRelativeToProject(new ForteProject(), getPath()); 117 settings.setNodeProperty(path + key, value); 118 } 119 } 120 | Popular Tags |