1 19 20 package org.netbeans.modules.web.jspparser; 21 22 import java.beans.PropertyVetoException ; 23 import java.io.File ; 24 import java.io.IOException ; 25 import java.util.StringTokenizer ; 26 import org.netbeans.api.java.classpath.ClassPath; 27 import org.netbeans.junit.Manager; 28 import org.netbeans.junit.NbTestCase; 29 import org.netbeans.modules.web.api.webmodule.WebModule; 30 import org.netbeans.modules.web.spi.webmodule.WebModuleImplementation; 31 import org.netbeans.modules.web.core.jsploader.JspParserAccess; 32 import org.netbeans.modules.web.jsps.parserapi.JspParserAPI; 33 import org.openide.ErrorManager; 34 import org.openide.filesystems.FileObject; 35 import org.openide.filesystems.FileUtil; 36 import org.openide.filesystems.Repository; 37 38 42 class TestUtil { 43 44 static FileObject getFileInWorkDir(String path, NbTestCase test) throws Exception { 45 File f = new File (Manager.getWorkDirPath()); 46 FileObject workDirFO = FileUtil.fromFile(f)[0]; 47 StringTokenizer st = new StringTokenizer (path, "/"); 48 FileObject tempFile = workDirFO; 49 while (st.hasMoreTokens()) { 50 tempFile = tempFile.getFileObject(st.nextToken()); 51 } 52 return tempFile; 53 } 54 55 static JspParserAPI.WebModule getWebModule(FileObject fo){ 56 WebModule wm = WebModule.getWebModule(fo); 57 if (wm == null) { 58 return null; 59 } 60 FileObject wmRoot = wm.getDocumentBase(); 61 if (fo == wmRoot || FileUtil.isParentOf(wmRoot, fo)) { 62 return JspParserAccess.getJspParserWM(WebModule.getWebModule(fo)); 63 } 64 return null; 65 } 66 67 113 114 } 115 | Popular Tags |