+ Resource pipe = null;
+ try {
+ List<NamedResource> componentTypes = DistrictNetworkUtil.getDistrictComponents();
+
+ pipe = componentTypes.stream()
+ .filter(r -> r.getName().toLowerCase().contains("pipe"))
+ .map(r -> r.getResource())
+ .findFirst().orElse(null);
+
+ if (pipe == null) {
+ pipe = Simantics.getSession().syncRequest(new PossibleResource("http://DistrictComponents@C/dh_pipe@1"));
+ }
+ } catch (DatabaseException e) {
+ LOGGER.error("Failed to read district component types for active model", e);
+ }
+
+ LOGGER.debug("Pipe component type is {}", pipe);
+
+ String data = null;
+ try {
+ Resource model = Simantics.getSession().syncRequest(new PossibleActiveModel(Simantics.getProjectResource()));
+ if (model != null)
+ data = Simantics.getSession().syncRequest(new PossibleTechTypeTableData(model, pipe), TransientCacheListener.instance());
+ } catch (DatabaseException e) {
+ LOGGER.error("Failed to read tech type table data for {}", pipe, e);
+ }
+
+ table = new TechTypeTable(parent, 0, pipe, data);