use of com.intellij.idea.CommandLineApplication.MyDataManagerImpl in project intellij by bazelbuild.
the class BlazeRunConfigurationProducerTestCase method doSetup.
@Before
public final void doSetup() {
BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build());
registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
editorTest = new EditorTestHelper(getProject(), testFixture);
// IntelliJ replaces the normal DataManager with a mock version in headless environments.
// We rely on a functional DataManager in run configuration tests to recognize when multiple
// psi elements are selected.
DataManager dataManager = new MyDataManagerImpl() {
DataContext dataContext;
@Override
public <T> void saveInDataContext(DataContext dataContext, Key<T> dataKey, @Nullable T data) {
this.dataContext = dataContext;
super.saveInDataContext(dataContext, dataKey, data);
}
@Override
public DataContext getDataContext() {
return dataContext != null ? dataContext : super.getDataContext();
}
};
registerApplicationComponent(DataManager.class, dataManager);
}
Aggregations