KickJava   Java API By Example, From Geeks To Geeks.

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


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
12 package org.eclipse.jface.text;
13
14
15 /**
16  * Default implementation of {@link org.eclipse.jface.text.IMarkSelection}.
17  *
18  * @since 2.0
19  */

20 public class MarkSelection implements IMarkSelection {
21
22     /** The marked document. */
23     private final IDocument fDocument;
24     /** The offset of the mark selection. */
25     private final int fOffset;
26     /** The length of the mark selection. */
27     private final int fLength;
28
29     /**
30      * Creates a MarkSelection.
31      *
32      * @param document the marked document
33      * @param offset the offset of the mark
34      * @param length the length of the mark, may be negative if caret before offset
35      */

36     public MarkSelection(IDocument document, int offset, int length) {
37         fDocument= document;
38         fOffset= offset;
39         fLength= length;
40     }
41
42     /*
43      * @see IMarkSelection#getDocument()
44      */

45     public IDocument getDocument() {
46         return fDocument;
47     }
48
49     /*
50      * @see IMarkSelection#getOffset()
51      */

52     public int getOffset() {
53         return fOffset;
54     }
55
56     /*
57      * @see IMarkSelection#getLength()
58      */

59     public int getLength() {
60         return fLength;
61     }
62
63     /*
64      * @see ISelection#isEmpty()
65      */

66     public boolean isEmpty() {
67         return fLength == 0;
68     }
69
70 }
71
Popular Tags