I’m trying to list all datasource using the follow code
import com.intellij.database.psi.DataSourceManager;
import com.intellij.openapi.project.Project;
...
List<DataSourceManager<?>> managers = DataSourceManager.getManagers(project);
for (DataSourceManager<?> manager : managers) {
List<?> dataSources = manager.getDataSources();
...
}
And I do have a localhost database added via view->tool window->database.
Debuging the code show that there are two managers:
- LocalDataSourceManager
- SqlDataSourceManager
Both containing no datasource. So what is wrong with the above code?