Search in sources :

Example 1 with ModalityStateEx

use of com.intellij.openapi.application.impl.ModalityStateEx in project intellij-community by JetBrains.

the class AbstractProgressIndicatorBase method setModalityProgress.

@Override
public void setModalityProgress(ProgressIndicator modalityProgress) {
    LOG.assertTrue(!isRunning());
    myModalityProgress = modalityProgress;
    ModalityState currentModality = ApplicationManager.getApplication().getCurrentModalityState();
    myModalityState = myModalityProgress != null ? ((ModalityStateEx) currentModality).appendProgress(myModalityProgress) : currentModality;
    if (modalityProgress != null) {
        ((TransactionGuardImpl) TransactionGuard.getInstance()).enteredModality(myModalityState);
    }
}
Also used : ModalityStateEx(com.intellij.openapi.application.impl.ModalityStateEx) ModalityState(com.intellij.openapi.application.ModalityState) TransactionGuardImpl(com.intellij.openapi.application.TransactionGuardImpl)

Example 2 with ModalityStateEx

use of com.intellij.openapi.application.impl.ModalityStateEx in project intellij-community by JetBrains.

the class ActivityMonitorTest method testModalityState.

public void testModalityState() {
    assertReady(null);
    myMonitor.addActivity(new UiActivity("non_modal_1"), ModalityState.NON_MODAL);
    assertBusy(null);
    LaterInvocator.enterModal("dialog");
    try {
        assertReady(null);
        myMonitor.addActivity(new UiActivity("non_modal2"), ModalityState.NON_MODAL);
        assertReady(null);
        myMonitor.addActivity(new UiActivity("modal_1"), new ModalityStateEx(new Object[] { "dialog" }));
        assertBusy(null);
        myMonitor.addActivity(new UiActivity("modal_2"), new ModalityStateEx(new Object[] { "dialog", "popup" }));
        assertBusy(null);
    } finally {
        LaterInvocator.leaveModal("dialog");
    }
    assertBusy(null);
}
Also used : ModalityStateEx(com.intellij.openapi.application.impl.ModalityStateEx) BusyObject(com.intellij.openapi.util.BusyObject)

Aggregations

ModalityStateEx (com.intellij.openapi.application.impl.ModalityStateEx)2 ModalityState (com.intellij.openapi.application.ModalityState)1 TransactionGuardImpl (com.intellij.openapi.application.TransactionGuardImpl)1 BusyObject (com.intellij.openapi.util.BusyObject)1