mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
modality cleanup
This commit is contained in:
@@ -17,7 +17,6 @@ package com.intellij.mock;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.*;
|
||||
import com.intellij.openapi.application.impl.ModalityStateEx;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.ThrowableComputable;
|
||||
@@ -30,8 +29,6 @@ import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class MockApplication extends MockComponentManager implements Application {
|
||||
private ModalityState MODALITY_STATE_NONE;
|
||||
|
||||
public static int INSTANCES_CREATED = 0;
|
||||
|
||||
public MockApplication(@NotNull Disposable parentDisposable) {
|
||||
@@ -194,20 +191,7 @@ public class MockApplication extends MockComponentManager implements Application
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getNoneModalityState() {
|
||||
if (MODALITY_STATE_NONE == null) {
|
||||
MODALITY_STATE_NONE = new ModalityStateEx() {
|
||||
@Override
|
||||
public boolean dominates(@NotNull ModalityState anotherState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NONE";
|
||||
}
|
||||
};
|
||||
}
|
||||
return MODALITY_STATE_NONE;
|
||||
return ModalityState.NON_MODAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-2
@@ -90,7 +90,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
public class ApplicationImpl extends PlatformComponentManagerImpl implements ApplicationEx {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.application.impl.ApplicationImpl");
|
||||
private final ModalityState MODALITY_STATE_NONE = ModalityState.NON_MODAL;
|
||||
|
||||
// about writer preference: the way the j.u.c.l.ReentrantReadWriteLock.NonfairSync is implemented, the
|
||||
// writer thread will be always at the queue head and therefore, j.u.c.l.ReentrantReadWriteLock.NonfairSync.readerShouldBlock()
|
||||
@@ -774,7 +773,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
@Override
|
||||
@NotNull
|
||||
public ModalityState getNoneModalityState() {
|
||||
return MODALITY_STATE_NONE;
|
||||
return ModalityState.NON_MODAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-8
@@ -214,6 +214,7 @@ public class LaterInvocator {
|
||||
ourModalityStack.pop();
|
||||
}
|
||||
LOG.assertTrue(removed, modalEntity);
|
||||
LOG.assertTrue(!ourModalityStack.isEmpty());
|
||||
cleanupQueueForModal(modalEntity);
|
||||
ourQueueSkipCount = 0;
|
||||
requestFlush();
|
||||
@@ -303,14 +304,7 @@ public class LaterInvocator {
|
||||
}
|
||||
|
||||
|
||||
ModalityState currentModality;
|
||||
if (ourModalEntities.isEmpty()) {
|
||||
Application application = ApplicationManager.getApplication();
|
||||
currentModality = application == null ? ModalityState.NON_MODAL : application.getNoneModalityState();
|
||||
}
|
||||
else {
|
||||
currentModality = new ModalityStateEx(ourModalEntities.toArray());
|
||||
}
|
||||
ModalityState currentModality = getCurrentModalityState();
|
||||
|
||||
while (ourQueueSkipCount < ourQueue.size()) {
|
||||
RunnableInfo info = ourQueue.get(ourQueueSkipCount);
|
||||
|
||||
Reference in New Issue
Block a user