/**
   * Calls all needed methods to change the template.
   *
   * @param viewName the name of the view.
   * @param datatype the name of the datatype.
   * @param unit the java compilation unit where all imports are added to.
   * @param type the type declaration.
   * @throws JavaModelException if an error occurred transforming the model.
   * @throws JavaTemplateException if an error occurred loading the template.
   */
  private void modifyTemplate(
      String viewName, String datatype, JavaCompilationUnit unit, TypeDeclaration type)
      throws JavaModelException, JavaTemplateException {
    String datatypeName = datatypeDeclaration.nodeToken2.tokenImage;
    String name = datatype + EDIT_VIEW_BROWSER_ELEMENT;

    super.extractAst(NabuccoJavaTemplateConstants.BROWSER_VIEW_HELPER_TEMPLATE);

    BrowserElementSupport.changeFieldViewModel(viewName, type);
    BrowserElementSupport.changeFieldBrowserHandler(datatype, type);
    BrowserElementSupport.changeConstructor(viewName, datatypeName, datatype, name, type);
    // BrowserElementSupport.addGetValuesStatements(datatypeName, viewName, this.annotationList,
    // type, helperUnit);
    BrowserElementSupport.changeGetViewModel(viewName, type);
    BrowserElementSupport.changeSetViewModel(viewName, type);
  }