KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > IMarkSelection


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;
12
13
14 import org.eclipse.jface.viewers.ISelection;
15
16
17 /**
18  * A mark selection. Is sent out by text viewers implementing the
19  * {@link org.eclipse.jface.text.IMarkRegionTarget} interface. By checking the
20  * type of the selection selection listeners can determine whether a selection
21  * event is about a mark or a normal text selection.
22  * <p>
23  * This interface is not intended to be implemented by clients others than
24  * {@link org.eclipse.jface.text.ITextViewer} implementers.
25  * </p>
26  *
27  * @since 2.0
28  */

29 public interface IMarkSelection extends ISelection {
30
31     /**
32      * Returns the marked document.
33      *
34      * @return the marked document
35      */

36     IDocument getDocument();
37
38     /**
39      * Returns the mark position. The offset may be <code>-1</code> if there's no marked region.
40      *
41      * @return the mark position or <code>-1</code> if there is no marked region
42      */

43     int getOffset();
44
45     /**
46      * Returns the length of the mark selection. The length may be negative, if the caret
47      * is before the mark position. The length has no meaning if <code>getOffset()</code>
48      * returns <code>-1</code>.
49      *
50      * @return the length of the mark selection. Result is undefined for <code>getOffset == -1</code>
51      */

52     int getLength();
53 }
54
Popular Tags