Mercurial > projects > dwt-addons
comparison dwtx/jface/text/formatter/IContentFormatterExtension.d @ 129:eb30df5ca28b
Added JFace Text sources
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 23 Aug 2008 19:10:48 +0200 |
parents | |
children | c4fb132a086c |
comparison
equal
deleted
inserted
replaced
128:8df1d4193877 | 129:eb30df5ca28b |
---|---|
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 module dwtx.jface.text.formatter.IContentFormatterExtension; | |
15 | |
16 import dwt.dwthelper.utils; | |
17 | |
18 import dwtx.jface.text.IDocument; | |
19 | |
20 /** | |
21 * Extension interface for {@link IContentFormatter}. | |
22 * <p> | |
23 * Updates the content formatter to be able to pass {@link IFormattingContext} | |
24 * context objects to {@link IFormattingStrategyExtension} objects | |
25 * operating in context based mode. | |
26 * <p> | |
27 * Clients using context based formatting call the method | |
28 * <code>format(IDocument, IFormattingContext)</code> with a properly | |
29 * initialized formatting context.<br> | |
30 * The formatting context must be set up according to the desired formatting mode: | |
31 * <ul> | |
32 * <li>For whole document formatting set the property {@link FormattingContextProperties#CONTEXT_DOCUMENT}. | |
33 * This is equivalent to setting {@link FormattingContextProperties#CONTEXT_REGION} with a region spanning | |
34 * the whole document.</li> | |
35 * <li>For multiple region formatting set the property {@link FormattingContextProperties#CONTEXT_REGION}. | |
36 * Note that the content formatter automatically aligns the region to a block selected region, | |
37 * and if the region spans multiple partitions, it also completes eventual partitions covered only | |
38 * partially by the region.</li> | |
39 * </ul> | |
40 * Depending on the registered formatting strategies, more context information must | |
41 * be passed in the formatting context, like e.g. {@link FormattingContextProperties#CONTEXT_PREFERENCES}. | |
42 * <p> | |
43 * Note that in context based mode the content formatter is fully reentrant, but not | |
44 * thread-safe. | |
45 * <p> | |
46 * | |
47 * @see IFormattingContext | |
48 * @see FormattingContextProperties | |
49 * @since 3.0 | |
50 */ | |
51 public interface IContentFormatterExtension { | |
52 | |
53 /** | |
54 * Formats the given region of the specified document. | |
55 * <p> | |
56 * The formatter may safely assume that it is the only subject that | |
57 * modifies the document at this point in time. This method is fully | |
58 * reentrant, but not thread-safe. | |
59 * <p> | |
60 * The formatting process performed by <code>format(IDocument, IFormattingContext)</code> | |
61 * happens as follows: | |
62 * <ul> | |
63 * <li>In a first pass the content formatter formats the range of the | |
64 * document to be formatted by using the master formatting strategy. This | |
65 * happens regardless of the content type of the underlying partition. | |
66 * </li> | |
67 * <li>In the second pass, the range is formatted again, this time using | |
68 * the registered slave formatting strategies. For each partition contained | |
69 * in the range to be formatted, the content formatter determines its | |
70 * content type and formats the partition with the correct formatting | |
71 * strategy. | |
72 * </li> | |
73 * | |
74 * @param document | |
75 * The document to be formatted | |
76 * @param context | |
77 * The formatting context to pass to the formatting strategies. | |
78 * This argument must not be <code>null</code>. | |
79 */ | |
80 void format(IDocument document, IFormattingContext context); | |
81 } |