1 19 20 package org.apache.tools.ant.module.loader; 21 22 import java.io.IOException ; 23 import org.openide.filesystems.FileObject; 24 import org.openide.loaders.DataObjectExistsException; 25 import org.openide.loaders.MultiDataObject; 26 import org.openide.loaders.UniFileLoader; 27 import org.openide.util.NbBundle; 28 29 32 public class AntProjectDataLoader extends UniFileLoader { 33 34 public static final String REQUIRED_MIME = "text/x-ant+xml"; private static final String KNOWN_ANT_FILENAME = "build.xml"; 37 private static final long serialVersionUID = 3642056255958054115L; 38 39 public AntProjectDataLoader () { 40 super ("org.apache.tools.ant.module.loader.AntProjectDataObject"); } 42 43 @Override 44 protected String defaultDisplayName () { 45 return NbBundle.getMessage (AntProjectDataLoader.class, "LBL_loader_name"); 46 } 47 48 @Override 49 protected void initialize () { 50 super.initialize (); 51 getExtensions().addMimeType(REQUIRED_MIME); 52 } 53 54 @Override 55 protected FileObject findPrimaryFile(FileObject fo) { 56 FileObject prim = super.findPrimaryFile(fo); 57 if (prim == null && fo.getNameExt().equals(KNOWN_ANT_FILENAME)) { 58 prim = fo; 62 } 63 return prim; 64 } 65 66 @Override 67 protected MultiDataObject createMultiObject (FileObject primaryFile) throws DataObjectExistsException, IOException { 68 return new AntProjectDataObject(primaryFile, this); 69 } 70 71 @Override 72 protected String actionsContext() { 73 return "Loaders/" + REQUIRED_MIME + "/Actions"; } 75 76 } 77 | Popular Tags |