1 19 20 package org.netbeans.modules.web.core.jsploader; 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 34 public class JspLoader extends UniFileLoader { 35 36 37 private static final long serialVersionUID = 1549250022027438942L; 38 39 40 public static final String JSP_EXTENSION = "jsp"; 42 public static final String JSPF_EXTENSION = "jspf"; 44 public static final String JSF_EXTENSION = "jsf"; 46 47 public static final String JSPX_EXTENSION = "jspx"; 49 public static final String TAG_FILE_EXTENSION = "tag"; 51 public static final String TAGF_FILE_EXTENSION = "tagf"; 53 public static final String TAGX_FILE_EXTENSION = "tagx"; 55 public static final String JSP_MIME_TYPE = "text/x-jsp"; 57 public static final String TAG_MIME_TYPE = "text/x-tag"; 59 public static String getMimeType(JspDataObject data) { 60 if ((data == null) || !(data instanceof JspDataObject)) { 61 return ""; } 63 String ext = data.getPrimaryFile().getExt(); 64 if (ext.equals(TAG_FILE_EXTENSION) || ext.equals(TAGF_FILE_EXTENSION) 65 || ext.equals(TAGX_FILE_EXTENSION)) { 66 return TAG_MIME_TYPE; 67 } else { 68 return JSP_MIME_TYPE; 69 } 70 } 71 72 protected void initialize () { 73 super.initialize(); 74 getExtensions().addMimeType(JSP_MIME_TYPE); 75 getExtensions().addMimeType(TAG_MIME_TYPE); 76 77 } 78 79 82 protected String defaultDisplayName () { 83 return NbBundle.getBundle(JspLoader.class).getString("PROP_JspLoader_Name"); 84 } 85 86 protected String actionsContext() { 87 return "Loaders/text/x-jsp/Actions/"; } 89 90 public JspLoader() { 91 super ("org.netbeans.modules.web.core.jsploader.JspDataObject"); } 93 94 95 protected JspLoader(String str) { 96 super (str); 97 } 98 99 protected JspDataObject createJspObject(FileObject pf, final UniFileLoader l) 100 throws DataObjectExistsException { 101 return new JspDataObject (pf, l); 102 } 103 104 105 protected MultiDataObject createMultiObject (final FileObject primaryFile) 106 throws DataObjectExistsException, IOException { 107 JspDataObject obj = createJspObject(primaryFile, this); 108 obj.getCookieSet0 ().add (new TagLibParseSupport(primaryFile)); 110 return obj; 111 } 112 113 } 114 | Popular Tags |