1 19 package org.netbeans.modules.css; 20 21 import java.io.IOException ; 22 import java.util.*; 23 import java.text.*; 24 25 import org.openide.loaders.*; 26 import org.openide.filesystems.FileObject; 27 import org.openide.filesystems.FileUtil; 28 import org.openide.actions.*; 29 import org.openide.util.actions.SystemAction; 30 import org.openide.util.*; 31 32 import org.netbeans.modules.css.actions.*; 33 34 40 public final class CSSLoader extends UniFileLoader { 41 42 43 private static final long serialVersionUID = -6638807099960633333L; 44 45 private static final String CSS_EXT = "css"; private static final String CSS_MIME = "text/css"; 48 49 public CSSLoader() { 50 super("org.netbeans.modules.css.CSSObject"); 51 } 52 53 55 protected void initialize () { 56 super.initialize(); 57 58 ExtensionList ext = getExtensions(); 59 ext.addExtension (CSS_EXT); 60 ext.addMimeType(CSS_MIME); 61 setExtensions(ext); 62 } 63 64 protected String actionsContext() { 65 return "Loaders/text/css/Actions/"; 66 } 67 68 71 protected String defaultDisplayName () { 72 return Util.THIS.getString ("PROP_CSSLoader_Name"); 73 } 74 75 83 protected MultiDataObject createMultiObject (FileObject primaryFile) 84 throws DataObjectExistsException, java.io.IOException { 85 return new CSSObject (primaryFile, this); 86 } 87 88 93 protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) { 94 return new CSSFileEntry (obj, primaryFile); 95 } 96 97 101 public static class CSSFileEntry extends FileEntry.Format { 102 103 104 private static final long serialVersionUID = 2833661760805697888L; 105 106 107 CSSFileEntry (MultiDataObject obj, FileObject file) { 108 super (obj, file); 109 } 110 111 118 protected java.text.Format createFormat (FileObject target, String n, String e) { 119 HashMap map = new HashMap(); 120 Date now = new Date(); 121 122 map.put ("NAME", n); map.put ("DATE", DateFormat.getDateInstance (DateFormat.LONG).format (now)); map.put ("TIME", DateFormat.getTimeInstance (DateFormat.SHORT).format (now)); map.put ("USER", System.getProperty ("user.name")); 127 MapFormat format = new MapFormat (map); 128 format.setLeftBrace ("__"); format.setRightBrace ("__"); format.setExactMatch (false); 131 return format; 132 } 133 } 134 135 } 136 | Popular Tags |