1 23 24 package org.enhydra.kelp.forte.node; 25 26 import java.io.IOException ; 27 28 import org.openide.actions.*; 29 import org.openide.filesystems.FileObject; 30 import org.openide.filesystems.FileUtil; 31 import org.openide.loaders.*; 32 import org.openide.util.NbBundle; 33 import org.openide.util.actions.SystemAction; 34 35 import java.util.Enumeration ; 36 import java.io.*; 37 38 42 public class DeployDataLoader extends MultiFileLoader { 43 44 static final long serialVersionUID = 7377840573359349120L; 45 46 private static final String TEMP_EXT = "in"; 47 49 public static final String PROP_DEPLOY_EXTENSIONS = "deploy.extensions"; 50 51 public DeployDataLoader () 52 { 53 this (DeployDataObject.class); 54 } 55 56 public DeployDataLoader (Class recognizedObject) 57 { 58 super (recognizedObject); 59 } 60 61 protected void initialize () { 62 63 setDisplayName (NbBundle.getMessage (DeployDataLoader.class, "LBL_Deployloader")); 64 65 setActions (new SystemAction[] { 66 SystemAction.get (OpenAction.class), 67 SystemAction.get (FileSystemAction.class), 68 null, 69 75 SystemAction.get (CutAction.class), 76 SystemAction.get (CopyAction.class), 77 SystemAction.get (PasteAction.class), 78 null, 79 SystemAction.get (DeleteAction.class), 80 SystemAction.get (RenameAction.class), 81 null, 82 SystemAction.get (SaveAsTemplateAction.class), 83 SystemAction.get (PropertiesAction.class), 86 }); 87 88 super.initialize(); 89 90 } 91 92 protected FileObject findPrimaryFile (FileObject fo) { 93 Enumeration extSet = getExtensions().extensions(); 95 while (extSet.hasMoreElements()) 96 { 97 String ext = (String )extSet.nextElement(); 98 if (fo.hasExt (ext)) 99 return fo; 100 } 101 return null; 102 } 103 104 protected MultiDataObject createMultiObject (FileObject primaryFile) 105 throws DataObjectExistsException, IOException { 106 return new DeployDataObject (primaryFile, this); 107 } 108 109 protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) { 110 return new FileEntry (obj, primaryFile); 112 } 114 115 protected MultiDataObject.Entry createSecondaryEntry (MultiDataObject obj, FileObject secondaryFile) { 116 secondaryFile.setImportant (false); 117 return new FileEntry.Numb (obj, secondaryFile); } 119 120 123 public ExtensionList getExtensions () { 124 ExtensionList extensions = (ExtensionList)getProperty(PROP_DEPLOY_EXTENSIONS); 125 if (extensions == null) { 126 extensions = new ExtensionList(); 127 extensions.addExtension(TEMP_EXT); 129 131 putProperty(PROP_DEPLOY_EXTENSIONS, extensions, false); 132 } 133 return extensions; 134 } 135 136 139 public void setExtensions(ExtensionList ext) { 140 putProperty(PROP_DEPLOY_EXTENSIONS, ext, true); 141 } 142 143 } 144 | Popular Tags |