X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FcomponentTypeEditor%2FPGraphEditorDocumentProvider.java;h=eeaab985c2d6d5816c725655addfe4b03d2eb257;hp=ad247b6bd8cf70e0bf8dd993ed2b96ff9ea0ae4a;hb=0dc7c37151328c8ed5c4720379f5b99b62525dc1;hpb=bd1e84d0abcb2cc4c8324a8881f29fa1eb3751fc diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/PGraphEditorDocumentProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/PGraphEditorDocumentProvider.java index ad247b6bd..eeaab985c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/PGraphEditorDocumentProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/PGraphEditorDocumentProvider.java @@ -60,14 +60,17 @@ public class PGraphEditorDocumentProvider extends AbstractDocumentProvider { return new Document(currentText != null ? currentText : ""); } else { Resource indexRoot = graph.syncRequest(new PossibleIndexRoot(resource)); - if(indexRoot != null && graph.isInstanceOf(indexRoot, L0.Ontology)) { - TransferableGraph1 tg = ModelingUtils.exportSharedOntology(graph, indexRoot, null, Constants.SHARED_LIBRARY_FORMAT, Constants.SHARED_LIBRARY_CURRENT_VERSION); - GraphRefactoringUtils.fixOntologyExport(tg); - currentText = PrettyPrintTG.print(tg); - errorHappened = false; + try { + if(indexRoot != null && graph.isInstanceOf(indexRoot, L0.Ontology)) { + TransferableGraph1 tg = ModelingUtils.exportSharedOntology(graph, indexRoot, null, Constants.SHARED_LIBRARY_FORMAT, Constants.SHARED_LIBRARY_CURRENT_VERSION); + GraphRefactoringUtils.fixOntologyExport(tg); + currentText = PrettyPrintTG.print(tg); + errorHappened = false; + } return new Document(currentText != null ? currentText : ""); + } catch (Exception e) { + throw new DatabaseException("Could not get PGraph from " + resource); } - throw new DatabaseException("Could not get PGraph from " + resource); } } });