1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.core.filebuffers; 12 13 14 import org.eclipse.core.runtime.CoreException; 15 16 import org.eclipse.jface.text.IDocument; 17 18 19 20 /** 21 * Tagging interface for {@link org.eclipse.jface.text.source.IAnnotationModel} implementers that offer 22 * state persistence. 23 * 24 * @since 3.0 25 */ 26 public interface IPersistableAnnotationModel { 27 28 /** 29 * Transforms the current transient state of the annotation model into a 30 * persistent state. 31 * 32 * @param document the document the annotation model is connected to 33 * @throws CoreException in case the transformation fails 34 */ 35 void commit(IDocument document) throws CoreException; 36 37 /** 38 * Changes the current transient state of the annotation model to match the 39 * last persisted state. 40 * 41 * @param document the document the annotation model is connected to 42 * @throws CoreException in case accessing the persisted state 43 */ 44 void revert(IDocument document) throws CoreException; 45 46 /** 47 * Forces this annotation model to re-initialize from the persistent state. 48 * The persistent state must not be the same as the last persisted state. 49 * I.e. external modification may have caused changes to the persistent 50 * state since the last <code>commit</code> or <code>revert</code> 51 * operation. 52 * 53 * @param document the document the annotation model is connected to 54 * @throws CoreException in case accessing the persistent state fails 55 */ 56 void reinitialize(IDocument document) throws CoreException; 57 } 58