Search in sources :

Example 1 with SaveAndSyncHandlerImpl

use of com.intellij.ide.SaveAndSyncHandlerImpl in project intellij-community by JetBrains.

the class DaemonRespondToChangesTest method testDaemonIgnoresFrameDeactivation.

public void testDaemonIgnoresFrameDeactivation() throws Throwable {
    // return default value to avoid unnecessary save
    DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
    String text = "class S { ArrayList<caret>XXX x;}";
    configureByText(StdFileTypes.JAVA, text);
    highlightErrors();
    GeneralSettings settings = GeneralSettings.getInstance();
    ApplicationEx application = ApplicationManagerEx.getApplicationEx();
    boolean frameSave = settings.isSaveOnFrameDeactivation();
    boolean appSave = application.isDoNotSave();
    settings.setSaveOnFrameDeactivation(true);
    application.doNotSave(false);
    try {
        SaveAndSyncHandlerImpl.doSaveDocumentsAndProjectsAndApp();
        checkDaemonReaction(false, SaveAndSyncHandlerImpl::doSaveDocumentsAndProjectsAndApp);
    } finally {
        application.doNotSave(appSave);
        settings.setSaveOnFrameDeactivation(frameSave);
    }
}
Also used : ApplicationEx(com.intellij.openapi.application.ex.ApplicationEx) SaveAndSyncHandlerImpl(com.intellij.ide.SaveAndSyncHandlerImpl) GeneralSettings(com.intellij.ide.GeneralSettings)

Aggregations

GeneralSettings (com.intellij.ide.GeneralSettings)1 SaveAndSyncHandlerImpl (com.intellij.ide.SaveAndSyncHandlerImpl)1 ApplicationEx (com.intellij.openapi.application.ex.ApplicationEx)1