mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 09:03:31 +07:00
cleanup: remove unnecessary editor parameter
GitOrigin-RevId: 6a4058516bf2d129005204fd9e81690a21515731
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f5bca9217e
commit
5754f8e2d0
+6
-6
@@ -293,7 +293,7 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
|
||||
|
||||
@Override
|
||||
public boolean fixSilently(@NotNull Editor editor) {
|
||||
return mayAutoImportNow(editor, myElement.getContainingFile()) &&
|
||||
return mayAutoImportNow(myElement.getContainingFile()) &&
|
||||
doFix(editor, false, false) == Result.CLASS_AUTO_IMPORTED;
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
|
||||
|
||||
if (classes.length == 1 &&
|
||||
(canImportHere = canImportHere(allowCaretNearRef, editor, psiFile, classes[0].getName())) &&
|
||||
mayAutoImportNow(editor, psiFile) &&
|
||||
mayAutoImportNow(psiFile) &&
|
||||
!autoImportWillInsertUnexpectedCharacters(classes[0])) {
|
||||
CommandProcessor.getInstance().runUndoTransparentAction(() -> action.execute());
|
||||
return Result.CLASS_AUTO_IMPORTED;
|
||||
@@ -349,15 +349,15 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
|
||||
return Result.POPUP_NOT_SHOWN;
|
||||
}
|
||||
|
||||
private static boolean mayAutoImportNow(@NotNull Editor editor, @NotNull PsiFile psiFile) {
|
||||
private static boolean mayAutoImportNow(@NotNull PsiFile psiFile) {
|
||||
return isAddUnambiguousImportsOnTheFlyEnabled(psiFile) &&
|
||||
(ApplicationManager.getApplication().isUnitTestMode() || DaemonListeners.canChangeFileSilently(psiFile)) &&
|
||||
isInModelessContext(editor);
|
||||
isInModelessContext(psiFile.getProject());
|
||||
}
|
||||
|
||||
private static boolean isInModelessContext(@NotNull Editor editor) {
|
||||
private static boolean isInModelessContext(@NotNull Project project) {
|
||||
return Registry.is("ide.perProjectModality") ?
|
||||
!LaterInvocator.isInModalContextForProject(editor.getProject()) :
|
||||
!LaterInvocator.isInModalContextForProject(project) :
|
||||
!LaterInvocator.isInModalContext();
|
||||
}
|
||||
|
||||
|
||||
+7
-8
@@ -88,7 +88,7 @@ public class OptimizeImportsProcessor extends AbstractLayoutCodeProcessor {
|
||||
try {
|
||||
for (Runnable runnable1 : runnables) {
|
||||
runnable1.run();
|
||||
retrieveAndStoreNotificationInfo(runnable1);
|
||||
myOptimizerNotifications.add(getNotificationInfo(runnable1));
|
||||
}
|
||||
putNotificationInfoIntoCollector();
|
||||
}
|
||||
@@ -100,17 +100,16 @@ public class OptimizeImportsProcessor extends AbstractLayoutCodeProcessor {
|
||||
return new FutureTask<>(runnable, true);
|
||||
}
|
||||
|
||||
private void retrieveAndStoreNotificationInfo(@NotNull Runnable runnable) {
|
||||
@NotNull
|
||||
private static NotificationInfo getNotificationInfo(@NotNull Runnable runnable) {
|
||||
if (runnable instanceof ImportOptimizer.CollectingInfoRunnable) {
|
||||
String optimizerMessage = ((ImportOptimizer.CollectingInfoRunnable)runnable).getUserNotificationInfo();
|
||||
myOptimizerNotifications.add(optimizerMessage != null ? new NotificationInfo(optimizerMessage) : NOTHING_CHANGED_NOTIFICATION);
|
||||
return optimizerMessage == null ? NOTHING_CHANGED_NOTIFICATION : new NotificationInfo(optimizerMessage);
|
||||
}
|
||||
else if (runnable == EmptyRunnable.getInstance()) {
|
||||
myOptimizerNotifications.add(NOTHING_CHANGED_NOTIFICATION);
|
||||
}
|
||||
else {
|
||||
myOptimizerNotifications.add(SOMETHING_CHANGED_WITHOUT_MESSAGE_NOTIFICATION);
|
||||
if (runnable == EmptyRunnable.getInstance()) {
|
||||
return NOTHING_CHANGED_NOTIFICATION;
|
||||
}
|
||||
return SOMETHING_CHANGED_WITHOUT_MESSAGE_NOTIFICATION;
|
||||
}
|
||||
|
||||
private void putNotificationInfoIntoCollector() {
|
||||
|
||||
Reference in New Issue
Block a user