]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/PGraphEditorDocumentProvider.java
Lots of fixes for PrettyPrintTG
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / PGraphEditorDocumentProvider.java
index ad247b6bd8cf70e0bf8dd993ed2b96ff9ea0ae4a..39152636b0e80aab3d9b18eaa439ce26ca839cf1 100644 (file)
@@ -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, false);
+                                   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);
                     }
                 }
             });