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 module dwtx.jface.text.source.projection.IProjectionPosition;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 import dwtx.jface.text.BadLocationException;
|
|
18 import dwtx.jface.text.IDocument;
|
|
19 import dwtx.jface.text.IRegion;
|
|
20
|
|
21
|
|
22 /**
|
|
23 * An <code>IProjectionPosition</code> is a position that is associated with a
|
|
24 * <code>ProjectionAnnotation</code> and that is able to compute its collapsed
|
|
25 * regions. That is, if a <code>Position</code> implements this interface,
|
|
26 * <code>ProjectionViewer</code> will delegate to the
|
|
27 * {@link #computeProjectionRegions(IDocument) computeProjectionRegions} method
|
|
28 * when determining the document regions that should be collapsed for a certain
|
|
29 * <code>ProjectionAnnotation</code>.
|
|
30 *
|
|
31 * @since 3.1
|
|
32 */
|
|
33 public interface IProjectionPosition {
|
|
34
|
|
35 /**
|
|
36 * Returns an array of regions that should be collapsed when the annotation
|
|
37 * belonging to this position is collapsed. May return null instead of
|
|
38 * an empty array.
|
|
39 *
|
|
40 * @param document the document that this position is attached to
|
|
41 * @return the foldable regions for this position
|
|
42 * @throws BadLocationException if accessing the document fails
|
|
43 */
|
|
44 IRegion[] computeProjectionRegions(IDocument document) throws BadLocationException;
|
|
45
|
|
46 /**
|
|
47 * Returns the offset of the caption (the anchor region) of this projection
|
|
48 * position. The returned offset is relative to the receivers offset into
|
|
49 * the document.
|
|
50 *
|
|
51 * @param document the document that this position is attached to
|
|
52 * @return the caption offset relative to the position's offset
|
|
53 * @throws BadLocationException if accessing the document fails
|
|
54 */
|
|
55 int computeCaptionOffset(IDocument document) throws BadLocationException;
|
|
56
|
|
57 }
|