1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 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.jface.text.reconciler; 12 13 import org.eclipse.jface.text.ITextViewer; 14 15 16 /** 17 * An <code>IReconciler</code> defines and maintains a model of the content 18 * of the text viewer's document in the presence of changes applied to this 19 * document. An <code>IReconciler</code> is a {@link org.eclipse.jface.text.ITextViewer} add-on. 20 * <p> 21 * Reconcilers are assumed to be asynchronous, i.e. they allow a certain 22 * temporal window of inconsistency between the document and the model of 23 * the content of this document. 24 * </p> 25 * <p> 26 * Reconcilers have a list of {@link org.eclipse.jface.text.reconciler.IReconcilingStrategy} 27 * objects each of which is registered for a particular document content type. 28 * The reconciler uses the strategy objects to react on the changes applied 29 * to the text viewer's document. 30 *</p> 31 * <p> 32 * In order to provide backward compatibility for clients of <code>IReconciler</code>, extension 33 * interfaces are used to provide a means of evolution. The following extension interfaces exist: 34 * <ul> 35 * <li>{@link org.eclipse.jface.text.reconciler.IReconcilerExtension} since version 3.0 introducing 36 * the ability to be aware of documents with multiple partitionings.</li> 37 * </ul> 38 * </p> 39 * <p> 40 * The interface can be implemented by clients. By default, clients use 41 * {@link org.eclipse.jface.text.reconciler.Reconciler} as the standard 42 * implementer of this interface. 43 * </p> 44 * 45 * @see ITextViewer 46 * @see IReconcilingStrategy 47 */ 48 public interface IReconciler { 49 50 /** 51 * Installs the reconciler on the given text viewer. After this method has been 52 * finished, the reconciler is operational, i.e., it works without requesting 53 * further client actions until <code>uninstall</code> is called. 54 * 55 * @param textViewer the viewer on which the reconciler is installed 56 */ 57 void install(ITextViewer textViewer); 58 59 /** 60 * Removes the reconciler from the text viewer it has 61 * previously been installed on. 62 */ 63 void uninstall(); 64 65 /** 66 * Returns the reconciling strategy registered with the reconciler 67 * for the specified content type. 68 * 69 * @param contentType the content type for which to determine the reconciling strategy 70 * @return the reconciling strategy registered for the given content type, or 71 * <code>null</code> if there is no such strategy 72 */ 73 IReconcilingStrategy getReconcilingStrategy(String contentType); 74 } 75