public class JavaImportOptimizer extends java.lang.Object implements ImportOptimizer
ImportOptimizer.CollectingInfoRunnable
Constructor and Description |
---|
JavaImportOptimizer() |
Modifier and Type | Method and Description |
---|---|
java.lang.Runnable |
processFile(PsiFile file)
Implementers of the method are expected to perform all necessary calculations synchronously and return a
Runnable ,
which performs modifications based on preprocessing results. |
boolean |
supports(PsiFile file)
Call to this method is made before the
processFile() call to ensure implementation can process the file given |
public java.lang.Runnable processFile(PsiFile file)
ImportOptimizer
Runnable
,
which performs modifications based on preprocessing results.
processFile() is guaranteed to run with Application.runReadAction(Runnable)
privileges and
the Runnable returned is guaranteed to run with Application.runWriteAction(Runnable)
privileges.
One can theoretically delay all the calculation until Runnable is called but this code will be executed in Swing thread thus
lengthy calculations may block user interface for some significant time.processFile
in interface ImportOptimizer
file
- to optimize an imports in. It's guaranteed to have a language this ImportOptimizer
have been
issued from.java.lang.Runnable
object, which being called will replace original file imports with optimized version.public boolean supports(PsiFile file)
ImportOptimizer
processFile()
call to ensure implementation can process the file givensupports
in interface ImportOptimizer
file
- file to checktrue
if implementation can handle the file