/**
   * model to string
   *
   * @return
   * @throws Exception
   */
  private String createResourceToString() throws Exception {
    XMLResourceImpl resource = new XMLResourceImpl();
    resource.setEncoding("UTF-8");
    resource.getContents().add(db);

    XMLProcessor processor = new XMLProcessor();
    return processor.saveToString(resource, null);
  }
  /**
   * resource load
   *
   * @param input
   */
  private void loadDBRsource(IEditorInput input) {
    TadpoleRDBEditorInput erdInput = (TadpoleRDBEditorInput) input;
    userDB = erdInput.getUserDBDAO();
    isAllTable = erdInput.isAllTable();

    // 신규로드 인지 기존 파일 로드 인지 검사합니다.
    if (null != erdInput.getUserDBERD()) {
      userDBErd = erdInput.getUserDBERD();

      // load resouce
      try {
        String xmlString = TadpoleSystem_UserDBResource.getResourceData(userDBErd);

        // 처음 로드 할때 ResourceSet에 instance가 등록 되어 있어야 합니다.
        /** <code>TadpolePackage.eNS_URI</code> */
        ResourceSet resourceSet = new ResourceSetImpl();
        if (resourceSet.getPackageRegistry().get("http://com.hangum.tadpole.rdb.model.ERDInfo")
            == null) {
          resourceSet
              .getPackageRegistry()
              .put("http://com.hangum.tadpole.rdb.model.ERDInfo", RdbPackage.eINSTANCE.getClass());
        }

        //
        XMLResourceImpl resource = new XMLResourceImpl();
        resource.setEncoding("UTF-8");
        resource.load(new InputSource(new StringReader(xmlString)), null);
        db = (DB) resource.getContents().get(0);

      } catch (Exception e) {
        logger.error("Load ERD Resource", e); // $NON-NLS-1$

        Status errStatus =
            new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$
        ExceptionDetailsErrorDialog.openError(
            getSite().getShell(),
            "Error",
            Messages.get().TadpoleEditor_0,
            errStatus); //$NON-NLS-1$
      }

      setPartName(isAllTable ? "All " + userDBErd.getName() : userDBErd.getName());
      setTitleToolTip(userDB.getDisplay_name());
    } else {
      setPartName(isAllTable ? "All " + userDB.getDisplay_name() : userDB.getDisplay_name());
      setTitleToolTip(userDB.getDisplay_name());
    }

    // google analytic
    AnalyticCaller.track(TadpoleRDBEditor.ID, userDB.getDbms_type());
  }
  @Override
  protected void attachedHelper(EObject eObject) {
    if (eObject instanceof Widget) {
      Widget widget = (Widget) eObject;
      Long id = widget.getId();

      if (id == null && !isLoading() && isDirectWidget(widget)) assignWidgetId(widget);
    } else if (eObject instanceof Panel) {
      Panel panel = (Panel) eObject;
      String id = panel.getId();

      if (id == null) assignPanelId(panel);
    }

    super.attachedHelper(eObject);
  }
  @Override
  protected void doUnload() {
    super.doUnload();

    getIntrinsicIDToEObjectMap().clear();
  }
 @Override
 protected void init() {
   super.init();
   setIntrinsicIDToEObjectMap(new HashMap<String, EObject>());
 }
 @Override
 public void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException {
   super.doLoad(inputStream, options);
   maxWidgetId = computeMaxWidgetId();
 }
 @Override
 public void doSave(OutputStream outputStream, Map<?, ?> options) throws IOException {
   assignMissingIds();
   super.doSave(outputStream, options);
 }