void () { @Language("JAVA") @NonNls String text = """ import static java.lang.Math.max; import java.util.Map; import static java.lang.Math.min; import java.awt.Component; import static javax.swing.SwingConstants.CENTER; /** @noinspection ALL*/ class I {{ max(0, 0); Map.class.hashCode(); min(0,0); Component.class.hashCode(); int i = CENTER; }}"""; final PsiJavaFile file = configureByText(text); assertEmpty(highlightErrors()); CommandProcessor.getInstance().executeCommand( getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> { try { JavaCodeStyleSettings javaSettings = JavaCodeStyleSettings.getInstance(getProject()); javaSettings.LAYOUT_STATIC_IMPORTS_SEPARATELY = true; PackageEntryTable table = new PackageEntryTable(); table.addEntry(PackageEntry.ALL_OTHER_IMPORTS_ENTRY); table.addEntry(PackageEntry.BLANK_LINE_ENTRY); table.addEntry(new PackageEntry(false, "javax", true)); table.addEntry(new PackageEntry(false, "java", true)); table.addEntry(PackageEntry.BLANK_LINE_ENTRY); table.addEntry(new PackageEntry(true, "java", true)); table.addEntry(PackageEntry.BLANK_LINE_ENTRY); table.addEntry(PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY); JavaCodeStyleSettings.getInstance(getProject()).IMPORT_LAYOUT_TABLE.copyFrom(table); JavaCodeStyleManager.getInstance(getProject()).optimizeImports(file); assertOrder(file, "java.awt.*", CommonClassNames.JAVA_UTIL_MAP, "static java.lang.Math.max", "static java.lang.Math.min", "static javax.swing.SwingConstants.CENTER"); } catch (Throwable e) { LOG.error(e); } }), "", ""); }