1 9 10 package org.netbeans.modules.websvc.core; 11 12 import java.io.IOException ; 13 import org.netbeans.api.java.source.CompilationController; 14 import org.netbeans.api.java.source.JavaSource; 15 import org.netbeans.modules.j2ee.common.source.AbstractTask; 16 import org.netbeans.modules.j2ee.common.source.SourceUtils; 17 import org.openide.filesystems.FileObject; 18 19 23 public final class _RetoucheUtil { 24 25 private _RetoucheUtil() {} 26 27 28 public static String getMainClassName(final FileObject classFO) throws IOException { 29 JavaSource javaSource = JavaSource.forFileObject(classFO); 30 final String [] result = new String [1]; 31 javaSource.runUserActionTask(new AbstractTask<CompilationController>() { 32 public void run(CompilationController controller) throws IOException { 33 controller.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED); 34 SourceUtils sourceUtils = SourceUtils.newInstance(controller); 35 result[0] = sourceUtils.getTypeElement().getQualifiedName().toString(); 36 } 37 }, true); 38 return result[0]; 39 } 40 41 } 42 | Popular Tags |