public interface ImportOptimizer
LanguageImportStatements
Modifier and Type | Interface and Description |
---|---|
static interface |
ImportOptimizer.CollectingInfoRunnable
In order to customize notification popup after reformat code action just return it from
processFile(com.intellij.psi.PsiFile) with proper information,
by default "imports optimized" is shown. |
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 |
boolean supports(PsiFile file)
processFile()
call to ensure implementation can process the file givenfile
- file to checktrue
if implementation can handle the filejava.lang.Runnable processFile(PsiFile file)
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.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.