@Override
 public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
   if (newBinding instanceof ICPPTemplateTemplateParameter) {
     final Database db = getDB();
     ICPPTemplateTemplateParameter ttp = (ICPPTemplateTemplateParameter) newBinding;
     updateName(newBinding.getNameCharArray());
     IType newDefault = null;
     try {
       newDefault = ttp.getDefault();
     } catch (DOMException e) {
       // ignore
     }
     if (newDefault != null) {
       linkage.storeType(record + DEFAULT_TYPE, newDefault);
     }
     long oldRec = db.getRecPtr(record + PARAMETERS);
     IPDOMCPPTemplateParameter[] oldParams = getTemplateParameters();
     try {
       params =
           PDOMTemplateParameterArray.createPDOMTemplateParameters(
               getLinkage(), this, ttp.getTemplateParameters());
       long newRec = PDOMTemplateParameterArray.putArray(db, params);
       db.putRecPtr(record + PARAMETERS, newRec);
       if (oldRec != 0) db.free(oldRec);
       for (IPDOMCPPTemplateParameter opar : oldParams) {
         opar.forceDelete(linkage);
       }
     } catch (DOMException e) {
     }
   }
 }
Esempio n. 2
0
  /**
   * Deletes this file from PDOM. Only uncommitted files can be safely deleted.
   *
   * @throws CoreException
   */
  public void delete() throws CoreException {
    Database db = fLinkage.getDB();
    long locRecord = db.getRecPtr(record + LOCATION_REPRESENTATION);
    if (locRecord != 0) db.getString(locRecord).delete();
    locRecord = db.getRecPtr(record + SIGNIFICANT_MACROS);
    if (locRecord != 0) db.getString(locRecord).delete();
    locRecord = db.getRecPtr(record + REPLACEMENT_HEADER);
    if (locRecord != 0) db.getString(locRecord).delete();

    db.free(record);
  }
  @Override
  public void forceDelete(PDOMLinkage linkage) throws CoreException {
    getDBName().delete();
    linkage.storeType(record + DEFAULT_TYPE, null);

    final Database db = getDB();
    long oldRec = db.getRecPtr(record + PARAMETERS);
    IPDOMCPPTemplateParameter[] oldParams = getTemplateParameters();
    if (oldRec != 0) db.free(oldRec);
    for (IPDOMCPPTemplateParameter opar : oldParams) {
      opar.forceDelete(linkage);
    }
  }