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.jface.text; 12 13 14 import org.eclipse.swt.custom.StyledTextContent; 15 16 17 /** 18 * Adapts an {@link org.eclipse.jface.text.IDocument}to the 19 * {@link org.eclipse.swt.custom.StyledTextContent} interface. The document 20 * adapter is used by {@link org.eclipse.jface.text.TextViewer} to translate 21 * document changes into styled text content changes and vice versa. 22 * <p> 23 * Clients may implement this interface and override 24 * <code>TextViewer.createDocumentAdapter</code> if they want to intercept the 25 * communication between the viewer's text widget and the viewer's document. 26 * <p> 27 * In order to provide backward compatibility for clients of 28 * <code>IDocumentAdapter</code>, extension interfaces are used as a means of 29 * evolution. The following extension interfaces exist: 30 * <ul> 31 * <li>{@link org.eclipse.jface.text.IDocumentAdapterExtension} since version 32 * 2.0 introducing a way of batching a sequence of document changes into a 33 * single styled text content notification</li> 34 * </ul> 35 * 36 * @see org.eclipse.jface.text.IDocumentAdapterExtension 37 * @see org.eclipse.jface.text.IDocument 38 */ 39 public interface IDocumentAdapter extends StyledTextContent { 40 41 /** 42 * Sets the adapters document. 43 * 44 * @param document the document to be adapted 45 */ 46 void setDocument(IDocument document); 47 } 48