private void readFromFile()

in src/org/jetbrains/plugins/ipnb/editor/panels/IpnbFilePanel.java [158:182]


  private void readFromFile(boolean showError) {
    try {
      removeAll();
      myIpnbFile = IpnbParser.parseIpnbFile(myDocument, myVirtualFile);
      myIpnbPanels.clear();
      mySelectedCellPanel = null;
      mySelectedIndex = -1;
      if (myIpnbFile.getCells().isEmpty()) {
        CommandProcessor.getInstance().runUndoTransparentAction(() -> ApplicationManager.getApplication().runWriteAction(() -> {
          createAndAddCell(true, IpnbCodeCell.createEmptyCodeCell());
          saveToFile(true);
          setInitialPosition(0);
        }));
      }
    }
    catch (IOException e) {
      if (showError) {
        Messages.showErrorDialog(getProject(), e.getMessage(), "Can't open " + myVirtualFile.getPath());
      }
      else {
        LOG.error(e.getMessage(), "Can't open " + myVirtualFile.getPath());
      }
    }
    layoutFile();
  }