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 12 package org.eclipse.jface.text.formatter; 13 14 /** 15 * Extension interface for <code>IFormattingStrategy</code>. 16 * <p> 17 * Updates formatting strategies to be able to receive a more general <code>IFormattingContext</code> 18 * object from its associated content formatters. 19 * <p> 20 * Each formatting process calls the strategy's methods in the following 21 * sequence: 22 * <ul> 23 * <li><code>formatterStarts</code> 24 * <li><code>format</code> 25 * <li><code>formatterStops</code> 26 * </ul> 27 * <p> 28 * Note that multiple calls to <code>formatterStarts</code> can be issued to 29 * a strategy before launching the formatting process with <code>format</code>. 30 * <p> 31 * This interface must be implemented by clients. Implementers should be 32 * registered with a content formatter in order get involved in the formatting 33 * process. 34 * 35 * @see IFormattingContext 36 * @since 3.0 37 */ 38 public interface IFormattingStrategyExtension { 39 40 /** 41 * Formats the region with the properties indicated in the formatting 42 * context previously supplied by <code>formatterStarts(IFormattingContext)</code>. 43 */ 44 void format(); 45 46 /** 47 * Informs the strategy about the start of a formatting process in which it 48 * will participate. 49 * 50 * @param context 51 * Formatting context used in the corresponding formatting 52 * process. 53 */ 54 void formatterStarts(IFormattingContext context); 55 56 /** 57 * Informs the strategy that the formatting process in which it has 58 * participated has been finished. 59 */ 60 void formatterStops(); 61 } 62