@@ -367,23 +367,8 @@ protected JavaSource getJavaSource(Phase p) {
367367 if (treePathHandle == null && docTreePathHandle == null ) {
368368 return null ;
369369 }
370- switch (p ) {
371- case PRECHECK :
372- case FASTCHECKPARAMETERS :
373- return JavaSource .forFileObject (docTreePathHandle != null ? docTreePathHandle .getTreePathHandle ().getFileObject ()
374- : treePathHandle .getFileObject ());
375- case PREPARE :
376- case CHECKPARAMETERS :
377- if (treePathHandle != null && treePathHandle .getKind () == Tree .Kind .LABELED_STATEMENT ) {
378- return JavaSource .forFileObject (treePathHandle .getFileObject ());
379- }
380- ClasspathInfo cpInfo = getClasspathInfo (refactoring );
381- JavaSource source = JavaSource .create (cpInfo , docTreePathHandle != null ? docTreePathHandle .getTreePathHandle ().getFileObject ()
382- : treePathHandle .getFileObject ());
383- return source ;
384-
385- }
386- throw new IllegalStateException ();
370+ return JavaSource .forFileObject (docTreePathHandle != null ? docTreePathHandle .getTreePathHandle ().getFileObject ()
371+ : treePathHandle .getFileObject ());
387372 }
388373
389374 @ Override
@@ -408,16 +393,10 @@ private Set<FileObject> getRelevantFiles() {
408393 JavaSource source = getJavaSource (Phase .PREPARE );
409394
410395 try {
411- source .runUserActionTask (new CancellableTask <CompilationController >() {
412-
413- @ Override
414- public void cancel () {
415- throw new UnsupportedOperationException ("Not supported yet." ); // NOI18N
416- }
417-
396+ source .runUserActionTask (new Task <CompilationController >() {
418397 @ Override
419398 public void run (CompilationController info ) throws Exception {
420- final ClassIndex idx = info . getClasspathInfo ().getClassIndex ();
399+ final ClassIndex idx = getClasspathInfo (refactoring ).getClassIndex ();
421400 info .toPhase (JavaSource .Phase .RESOLVED );
422401 Element el = docTreePathHandle != null ? ((DocTrees )info .getTrees ()).getElement (docTreePathHandle .resolve (info ))
423402 : treePathHandle .resolveElement (info );
@@ -631,7 +610,7 @@ public Problem prepare(RefactoringElementsBag elements) {
631610 Set <FileObject > a = getRelevantFiles ();
632611 fireProgressListenerStart (AbstractRefactoring .PREPARE , a .size ());
633612 TransformTask transform = new TransformTask (new RenameTransformer (treePathHandle , docTreePathHandle , refactoring , allMethods , recordLinkedDeclarations , refactoring .isSearchInComments ()), treePathHandle != null && treePathHandle .getKind () == Tree .Kind .LABELED_STATEMENT ? null : treePathHandle );
634- Problem problem = createAndAddElements (a , transform , elements , refactoring , getClasspathInfo ( refactoring ) );
613+ Problem problem = createAndAddElements (a , transform , elements , null );
635614 fireProgressListenerStop ();
636615 return problem ;
637616 }
0 commit comments