use of com.intellij.openapi.application.ApplicationManager in project intellij by bazelbuild.
the class TestUtils method createMockApplication.
public static void createMockApplication(Disposable parentDisposable) {
final BlazeMockApplication instance = new BlazeMockApplication(parentDisposable);
// If there was no previous application,
// ApplicationManager leaves the MockApplication in place, which can break future tests.
Application oldApplication = ApplicationManager.getApplication();
if (oldApplication == null) {
Disposer.register(parentDisposable, () -> {
new ApplicationManager() {
{
ourApplication = null;
}
};
});
}
ApplicationManager.setApplication(instance, FileTypeManager::getInstance, parentDisposable);
instance.registerService(EncodingManager.class, EncodingManagerImpl.class);
}
Aggregations