mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
initialize UndoManagerImpl earlier (refix IDEA-163699, IDEA-CR-16066)
This commit is contained in:
@@ -66,7 +66,6 @@ import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -420,13 +419,11 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
}
|
||||
|
||||
private void addFlushRequest(@NotNull MyFlushRunnable flushRunnable, final int millis) {
|
||||
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(() -> {
|
||||
synchronized (myCurrentRequests) {
|
||||
if (!myFlushAlarm.isDisposed() && myCurrentRequests.add(flushRunnable)) {
|
||||
myFlushAlarm.addRequest(flushRunnable, millis, getStateForUpdate());
|
||||
}
|
||||
synchronized (myCurrentRequests) {
|
||||
if (!myFlushAlarm.isDisposed() && myCurrentRequests.add(flushRunnable)) {
|
||||
myFlushAlarm.addRequest(flushRunnable, millis, getStateForUpdate());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.EmptyRunnable;
|
||||
@@ -66,7 +65,6 @@ public class UndoManagerImpl extends UndoManager implements ProjectComponent, Ap
|
||||
|
||||
@Nullable private final ProjectEx myProject;
|
||||
private final CommandProcessor myCommandProcessor;
|
||||
private final StartupManager myStartupManager;
|
||||
|
||||
private UndoProvider[] myUndoProviders;
|
||||
private CurrentEditorProvider myEditorProvider;
|
||||
@@ -101,29 +99,21 @@ public class UndoManagerImpl extends UndoManager implements ProjectComponent, Ap
|
||||
return Registry.intValue("undo.documentUndoLimit");
|
||||
}
|
||||
|
||||
public UndoManagerImpl(Application application, CommandProcessor commandProcessor) {
|
||||
this(application, null, commandProcessor, null);
|
||||
public UndoManagerImpl(CommandProcessor commandProcessor) {
|
||||
this(null, commandProcessor);
|
||||
}
|
||||
|
||||
public UndoManagerImpl(Application application,
|
||||
@Nullable ProjectEx project,
|
||||
CommandProcessor commandProcessor,
|
||||
StartupManager startupManager) {
|
||||
public UndoManagerImpl(@Nullable ProjectEx project, CommandProcessor commandProcessor) {
|
||||
myProject = project;
|
||||
myCommandProcessor = commandProcessor;
|
||||
myStartupManager = startupManager;
|
||||
|
||||
init(application);
|
||||
if (myProject == null || !myProject.isDefault()) {
|
||||
runStartupActivity();
|
||||
}
|
||||
|
||||
myMerger = new CommandMerger(this);
|
||||
}
|
||||
|
||||
private void init(@NotNull Application application) {
|
||||
if (myProject == null || application.isUnitTestMode() && !myProject.isDefault()) {
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
@@ -141,9 +131,6 @@ public class UndoManagerImpl extends UndoManager implements ProjectComponent, Ap
|
||||
|
||||
@Override
|
||||
public void projectOpened() {
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -158,15 +145,6 @@ public class UndoManagerImpl extends UndoManager implements ProjectComponent, Ap
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
if (myProject == null) {
|
||||
runStartupActivity();
|
||||
}
|
||||
else {
|
||||
myStartupManager.registerStartupActivity(this::runStartupActivity);
|
||||
}
|
||||
}
|
||||
|
||||
private void runStartupActivity() {
|
||||
myEditorProvider = new FocusBasedCurrentEditorProvider();
|
||||
CommandListener commandListener = new CommandAdapter() {
|
||||
|
||||
Reference in New Issue
Block a user