Mercurial > projects > dwt2
comparison org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategy.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
11:43904fec5dca | 12:bc29606a740c |
---|---|
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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 | |
14 | |
15 module org.eclipse.jface.text.formatter.IFormattingStrategy; | |
16 | |
17 import org.eclipse.jface.text.formatter.MultiPassContentFormatter; // packageimport | |
18 import org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy; // packageimport | |
19 import org.eclipse.jface.text.formatter.FormattingContext; // packageimport | |
20 import org.eclipse.jface.text.formatter.IContentFormatterExtension; // packageimport | |
21 import org.eclipse.jface.text.formatter.IFormattingStrategyExtension; // packageimport | |
22 import org.eclipse.jface.text.formatter.IContentFormatter; // packageimport | |
23 import org.eclipse.jface.text.formatter.FormattingContextProperties; // packageimport | |
24 import org.eclipse.jface.text.formatter.ContentFormatter; // packageimport | |
25 import org.eclipse.jface.text.formatter.IFormattingContext; // packageimport | |
26 | |
27 import java.lang.all; | |
28 | |
29 | |
30 /** | |
31 * A formatting strategy is assumed to be specialized on formatting text | |
32 * of a particular content type. Each formatting process calls the strategy's | |
33 * methods in the following sequence: | |
34 * <ul> | |
35 * <li><code>formatterStarts</code> | |
36 * <li><code>format</code> | |
37 * <li><code>formatterStops</code> | |
38 * </ul> | |
39 * <p> | |
40 * This interface must be implemented by clients. Implementers should be registered with | |
41 * a content formatter in order get involved in the formatting process.</p> | |
42 */ | |
43 public interface IFormattingStrategy { | |
44 | |
45 /** | |
46 * Informs the strategy about the start of a formatting process in which it will | |
47 * participate. | |
48 * | |
49 * @param initialIndentation the indent string of the first line at which the | |
50 * overall formatting process starts. | |
51 */ | |
52 void formatterStarts(String initialIndentation); | |
53 | |
54 /** | |
55 * Formats the given string. During the formatting process this strategy must update | |
56 * the given character positions according to the changes applied to the given string. | |
57 * | |
58 * @param content the initial string to be formatted | |
59 * @param isLineStart indicates whether the beginning of content is a line start in its document | |
60 * @param indentation the indentation string to be used | |
61 * @param positions the character positions to be updated | |
62 * @return the formatted string | |
63 */ | |
64 String format(String content, bool isLineStart, String indentation, int[] positions); | |
65 | |
66 /** | |
67 * Informs the strategy that the formatting process in which it has participated | |
68 * has been finished. | |
69 */ | |
70 void formatterStops(); | |
71 } |