@Override public List<SelectorNode> buildSelectionTree() { final SelectorNode[] classNode = new SelectorNode[1]; JavaSource js = JavaSource.forFileObject(file); if (js != null) { try { js.runWhenScanFinished(new Task<CompilationController>() { public void run(CompilationController controller) throws Exception { TypeElement classElement = getToplevelClass(controller); classNode[0] = new JavaClassNode(controller.getClasspathInfo(), classElement, null); } }, true); } catch (IOException e) { e.printStackTrace(); } } return classNode[0] != null ? Collections.singletonList(classNode[0]) : Collections.EMPTY_LIST; }
handle = javaSrc.runWhenScanFinished(wrapper, true); } catch (IOException ex) { status.set(ex);
Future future = JavaSource.forFileObject(fobj).runWhenScanFinished(new Task<CompilationController>() { public void run(CompilationController cc) throws Exception {
static SingleMethod getTestMethod(Document doc, int cursor){ SingleMethod sm = null; if (doc != null){ JavaSource js = JavaSource.forDocument(doc); GroovyTestClassInfoTask task = new GroovyTestClassInfoTask(cursor); try { if (js != null) { Future<Void> f = js.runWhenScanFinished(task, true); if (f.isDone() && task.getFileObject() != null && task.getMethodName() != null){ sm = new SingleMethod(task.getFileObject(), task.getMethodName()); } } } catch (IOException ex) { LOGGER.log(Level.WARNING, null, ex); } } return sm; }
public static SingleMethod getTestMethod(Document doc, int cursor){ SingleMethod sm = null; if (doc != null){ JavaSource js = JavaSource.forDocument(doc); if(js == null) { return null; } TestClassInfoTask task = new TestClassInfoTask(cursor); try { Future<Void> f = js.runWhenScanFinished(task, true); if (f.isDone() && task.getFileObject() != null && task.getMethodName() != null){ sm = new SingleMethod(task.getFileObject(), task.getMethodName()); } } catch (IOException ex) { LOGGER.log(Level.WARNING, null, ex); } } return sm; }
public static SingleMethod getTestMethod(Document doc, int cursor){ SingleMethod sm = null; if (doc != null) { JavaSource js = JavaSource.forDocument(doc); if(js == null) { return null; } TestClassInfoTask task = new TestClassInfoTask(cursor); try { Future<Void> f = js.runWhenScanFinished(task, true); if (f.isDone() && task.getFileObject() != null && task.getMethodName() != null) { sm = new SingleMethod(task.getFileObject(), task.getMethodName()); } } catch (IOException ex) { LOGGER.log(Level.WARNING, null, ex); } } return sm; }
source.runWhenScanFinished(new Task<CompilationController>() { // #194569 @Override public void run(CompilationController parameter) throws Exception {
if (info != null) { try { JavaSource.create(info).runWhenScanFinished(new Task<CompilationController>() {
JavaSource.create(ClasspathInfo.create(src)).runWhenScanFinished(new Task<CompilationController>() { public @Override void run(CompilationController cc) throws Exception { cc.toPhase(JavaSource.Phase.RESOLVED);
public List<String> getManagedBeanPropertyNames(Project project, final String managedBean, final String entityClassName, final String managedBeanName, final boolean collection) { final List<String> res = new ArrayList<String>(); Sources sources = ProjectUtils.getSources(project); SourceGroup[] sourceGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); if (sourceGroups.length == 0) { return res; } FileObject root = sourceGroups[0].getRootFolder(); ClasspathInfo classpathInfo = ClasspathInfo.create( ClassPathSupport.createProxyClassPath(ClassPath.getClassPath(root, ClassPath.BOOT)), ClassPathSupport.createProxyClassPath(ClassPath.getClassPath(root, ClassPath.COMPILE)), ClassPathSupport.createProxyClassPath(ClassPath.getClassPath(root, ClassPath.SOURCE))); JavaSource js = JavaSource.create(classpathInfo); try { Future<Void> searchingTask = js.runWhenScanFinished( new SearchTask(managedBean, entityClassName, managedBeanName, res, false), true); if (searchingTask.isDone()) { return res; } js.runUserActionTask(new SearchTask(managedBean, entityClassName, managedBeanName, res, true), true); } catch (IOException ex) { Exceptions.printStackTrace(ex); } return res; }
final ClasspathInfo cpInfo = ClasspathInfo.create(bootCp, compileCp, sourcePath); JavaSource js = JavaSource.create(cpInfo); js.runWhenScanFinished(new Task<CompilationController>() {