1 19 20 package org.netbeans.modules.web.core.jsploader; 21 22 import org.openide.ErrorManager; 23 import org.openide.filesystems.*; 24 import org.openide.loaders.*; 25 import org.openide.util.NbBundle; 26 27 import org.netbeans.api.java.loaders.JavaDataSupport; 28 29 35 public final class JspServletDataLoader extends MultiFileLoader { 36 37 38 private static final long serialVersionUID = -6033464827752236719L; 39 40 41 public static final String JAVA_EXTENSION = "java"; 43 public static final String JSP_MARK = "_jsp"; 45 48 public JspServletDataLoader() { 49 super("org.netbeans.modules.web.core.jsploader.JspServletDataObject"); } 51 52 53 protected @Override String defaultDisplayName() { 54 return NbBundle.getBundle(JspServletDataLoader.class).getString("PROP_JspServletLoader_Name"); 55 } 56 57 protected String actionsContext() { 58 return "Loaders/text/x-jsp-servlet/Actions/"; } 60 61 66 protected FileObject findPrimaryFile (FileObject fo) { 67 FileObject javaPrim; 69 if (fo.isFolder()) 71 javaPrim = null; 72 else if (fo.getExt().equals(JAVA_EXTENSION)) 73 javaPrim = fo; 74 else 75 javaPrim = null; 76 77 if (javaPrim == null) 78 return null; 79 80 if (javaPrim.getAttribute(JspServletDataObject.EA_ORIGIN_JSP_PAGE) != null) { 82 return javaPrim; 83 } 84 85 89 return null; 90 } 91 92 97 protected MultiDataObject createMultiObject (FileObject primaryFile) 98 throws DataObjectExistsException, java.io.IOException { 99 return new JspServletDataObject(primaryFile, this); 100 } 101 102 106 protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) { 107 if (JAVA_EXTENSION.equals(primaryFile.getExt())) { 108 return JavaDataSupport.createJavaFileEntry(obj, primaryFile); 109 } 110 else { 111 return new FileEntry(obj, primaryFile); 112 } 113 } 114 115 121 protected MultiDataObject.Entry createSecondaryEntry (MultiDataObject obj, FileObject secondaryFile) { 122 ErrorManager.getDefault().log ("Subclass of JavaDataLoader ("+this.getClass().getName() 125 +") has secondary entries but does not override createSecondaryEntries (MultidataObject, FileObject) method."); return new FileEntry.Numb(obj, secondaryFile); 127 } 128 129 } 130 | Popular Tags |