1 19 20 25 26 package org.openide.loaders; 27 28 import org.openide.filesystems.*; 29 import java.io.*; 30 31 35 public class MultiFileLoaderHid extends MultiFileLoader { 36 37 private static final String PRIMARY_EXT = "primary"; 38 private static final String SECONDARY_EXT = "secondary"; 39 40 41 public MultiFileLoaderHid () { 42 super ("org.openide.loaders.DataObject"); 43 } 44 45 51 protected FileObject findPrimaryFile (FileObject fo) { 52 if (PRIMARY_EXT.equals (fo.getExt ())) { 53 return fo; 54 } 55 if (SECONDARY_EXT.equals (fo.getExt ())) { 56 return FileUtil.findBrother (fo, PRIMARY_EXT); 57 } 58 return null; 59 } 60 61 69 protected MultiDataObject.Entry createSecondaryEntry (MultiDataObject obj, FileObject secondaryFile) { 70 return new FileEntry (obj, secondaryFile); 71 } 72 73 79 protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) { 80 return new FileEntry (obj, primaryFile); 81 } 82 83 91 protected MultiDataObject createMultiObject (FileObject primaryFile) throws DataObjectExistsException, IOException { 92 return new MDO (primaryFile, this); 93 } 94 95 private static class MDO extends MultiDataObject { 96 public MDO (FileObject primaryFile, MultiFileLoader loader) throws DataObjectExistsException { 97 super (primaryFile, loader); 98 } 99 } 100 } 101 | Popular Tags |