KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > source > projection > IProjectionPosition


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 package org.eclipse.jface.text.source.projection;
12
13 import org.eclipse.jface.text.BadLocationException;
14 import org.eclipse.jface.text.IDocument;
15 import org.eclipse.jface.text.IRegion;
16
17
18 /**
19  * An <code>IProjectionPosition</code> is a position that is associated with a
20  * <code>ProjectionAnnotation</code> and that is able to compute its collapsed
21  * regions. That is, if a <code>Position</code> implements this interface,
22  * <code>ProjectionViewer</code> will delegate to the
23  * {@link #computeProjectionRegions(IDocument) computeProjectionRegions} method
24  * when determining the document regions that should be collapsed for a certain
25  * <code>ProjectionAnnotation</code>.
26  *
27  * @since 3.1
28  */

29 public interface IProjectionPosition {
30
31     /**
32      * Returns an array of regions that should be collapsed when the annotation
33      * belonging to this position is collapsed. May return null instead of
34      * an empty array.
35      *
36      * @param document the document that this position is attached to
37      * @return the foldable regions for this position
38      * @throws BadLocationException if accessing the document fails
39      */

40     IRegion[] computeProjectionRegions(IDocument document) throws BadLocationException;
41
42     /**
43      * Returns the offset of the caption (the anchor region) of this projection
44      * position. The returned offset is relative to the receivers offset into
45      * the document.
46      *
47      * @param document the document that this position is attached to
48      * @return the caption offset relative to the position's offset
49      * @throws BadLocationException if accessing the document fails
50      */

51     int computeCaptionOffset(IDocument document) throws BadLocationException;
52
53 }
54
Popular Tags