129
|
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.IDocumentPartitionerExtension2;
|
|
15
|
|
16 import dwt.dwthelper.utils;
|
|
17
|
|
18
|
|
19 /**
|
|
20 * Extension interface for {@link dwtx.jface.text.IDocumentPartitioner}.
|
|
21 * <p>
|
|
22 * Extends the original concept of a document partitioner to answer the position
|
|
23 * categories that are used to manage the partitioning information.
|
|
24 * <p>
|
|
25 * This extension also introduces the concept of open and delimited partitions.
|
|
26 * A delimited partition has a predefined textual token delimiting its start and
|
|
27 * end, while an open partition can fill any space between two delimited
|
|
28 * partitions.
|
|
29 * </p>
|
|
30 * <p>
|
|
31 * An open partition of length zero can occur between two delimited partitions,
|
|
32 * thus having the same offset as the following delimited partition. The
|
|
33 * document start and end are considered to be delimiters of open partitions,
|
|
34 * i.e. there may be a zero-length partition between the document start and a
|
|
35 * delimited partition starting at offset 0.
|
|
36 * </p>
|
|
37 *
|
|
38 * @since 3.0
|
|
39 */
|
|
40 public interface IDocumentPartitionerExtension2 {
|
|
41
|
|
42 /**
|
|
43 * Returns the position categories that this partitioners uses in order to manage
|
|
44 * the partitioning information of the documents. Returns <code>null</code> if
|
|
45 * no position category is used.
|
|
46 *
|
|
47 * @return the position categories used to manage partitioning information or <code>null</code>
|
|
48 */
|
|
49 String[] getManagingPositionCategories();
|
|
50
|
|
51
|
|
52 /* zero-length partition support */
|
|
53
|
|
54 /**
|
|
55 * Returns the content type of the partition containing the given offset in
|
|
56 * the connected document. There must be a document connected to this
|
|
57 * partitioner.
|
|
58 * <p>
|
|
59 * If <code>preferOpenPartitions</code> is <code>true</code>,
|
|
60 * precedence is given to an open partition ending at <code>offset</code>
|
|
61 * over a delimited partition starting at <code>offset</code>.
|
|
62 * <p>
|
|
63 * This method replaces {@link IDocumentPartitioner#getContentType(int)}and
|
|
64 * behaves like it when <code>prepreferOpenPartitions</code> is
|
|
65 * <code>false</code>, i.e. precedence is always given to the partition
|
|
66 * that does not end at <code>offset</code>.
|
|
67 * </p>
|
|
68 *
|
|
69 * @param offset the offset in the connected document
|
|
70 * @param preferOpenPartitions <code>true</code> if precedence should be
|
|
71 * given to a open partition ending at <code>offset</code> over
|
|
72 * a delimited partition starting at <code>offset</code>
|
|
73 * @return the content type of the offset's partition
|
|
74 */
|
|
75 String getContentType(int offset, bool preferOpenPartitions);
|
|
76
|
|
77 /**
|
|
78 * Returns the partition containing the given offset of the connected
|
|
79 * document. There must be a document connected to this partitioner.
|
|
80 * <p>
|
|
81 * If <code>preferOpenPartitions</code> is <code>true</code>,
|
|
82 * precedence is given to an open partition ending at <code>offset</code>
|
|
83 * over a delimited partition starting at <code>offset</code>.
|
|
84 * <p>
|
|
85 * This method replaces {@link IDocumentPartitioner#getPartition(int)}and
|
|
86 * behaves like it when <preferOpenPartitions</code> is <code>false
|
|
87 * </code>, i.e. precedence is always given to the partition that does not
|
|
88 * end at <code>offset</code>.
|
|
89 * </p>
|
|
90 *
|
|
91 * @param offset the offset for which to determine the partition
|
|
92 * @param preferOpenPartitions <code>true</code> if precedence should be
|
|
93 * given to a open partition ending at <code>offset</code> over
|
|
94 * a delimited partition starting at <code>offset</code>
|
|
95 * @return the partition containing the offset
|
|
96 */
|
|
97 ITypedRegion getPartition(int offset, bool preferOpenPartitions);
|
|
98
|
|
99 /**
|
|
100 * Returns the partitioning of the given range of the connected document.
|
|
101 * There must be a document connected to this partitioner.
|
|
102 * <p>
|
|
103 * If <code>includeZeroLengthPartitions</code> is <code>true</code>, a
|
|
104 * zero-length partition of an open partition type (usually the default
|
|
105 * partition) is included between two delimited partitions. If it is
|
|
106 * <code>false</code>, no zero-length partitions are included.
|
|
107 * </p>
|
|
108 * <p>
|
|
109 * This method replaces
|
|
110 * {@link IDocumentPartitioner#computePartitioning(int, int)}and behaves
|
|
111 * like it when <code>includeZeroLengthPartitions</code> is
|
|
112 * <code>false</code>.
|
|
113 * </p>
|
|
114 *
|
|
115 * @param offset the offset of the range of interest
|
|
116 * @param length the length of the range of interest
|
|
117 * @param includeZeroLengthPartitions <code>true</code> if zero-length
|
|
118 * partitions should be returned as part of the computed
|
|
119 * partitioning
|
|
120 * @return the partitioning of the range
|
|
121 */
|
|
122 ITypedRegion[] computePartitioning(int offset, int length, bool includeZeroLengthPartitions);
|
|
123 }
|