X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network.ui%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fui%2Ftechtype%2Ftable%2FTechTypeTable.java;h=0c44bff0bdae48469b0edcc2d37b3995d26912d8;hb=refs%2Fchanges%2F37%2F4437%2F1;hp=eb83c902ddf535c9bcd8ae236de40913d33bf4a6;hpb=ae7fa2cc4cfe235b2a392d6fb7e3038042ac4221;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java index eb83c902..0c44bff0 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java @@ -44,7 +44,7 @@ import org.eclipse.swt.widgets.Text; import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; -import org.simantics.district.network.ui.techtype.requests.WriteTechTypeTableRequest; +import org.simantics.district.network.techtype.requests.WriteTechTypeTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -196,20 +196,29 @@ public class TechTypeTable extends Composite { public void setTechTypePath(String path) { String data; try { - data = Files.lines(Paths.get(path)).collect(Collectors.joining("\n")); + data = Files.lines(Paths.get(path), Charset.defaultCharset()).collect(Collectors.joining("\n")); } catch (IOException e) { LOGGER.error("Failed to read contents of file '{}' as {}", path, Charset.defaultCharset(), e); return; } try { - Simantics.getSession().syncRequest(new WriteTechTypeTableRequest(componentType, data)); + Simantics.getSession().syncRequest(new WriteTechTypeTable(componentType, data)); } catch (DatabaseException e) { LOGGER.error("Failed to write tech type table data to model", e); } + setTechTypeData(data); + } + + public void setTechTypeData(String data) { bodyDataProvider.setData(data); table.refresh(true); } + public void setComponentType(Resource componentType) { + this.componentType = componentType; + } + } +