Mercurial > projects > dwt-addons
comparison dwtx/jface/text/MarkSelection.d @ 129:eb30df5ca28b
Added JFace Text sources
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 23 Aug 2008 19:10:48 +0200 |
parents | |
children | c4fb132a086c |
comparison
equal
deleted
inserted
replaced
128:8df1d4193877 | 129:eb30df5ca28b |
---|---|
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.MarkSelection; | |
15 | |
16 import dwt.dwthelper.utils; | |
17 | |
18 | |
19 /** | |
20 * Default implementation of {@link dwtx.jface.text.IMarkSelection}. | |
21 * | |
22 * @since 2.0 | |
23 */ | |
24 public class MarkSelection : IMarkSelection { | |
25 | |
26 /** The marked document. */ | |
27 private final IDocument fDocument; | |
28 /** The offset of the mark selection. */ | |
29 private final int fOffset; | |
30 /** The length of the mark selection. */ | |
31 private final int fLength; | |
32 | |
33 /** | |
34 * Creates a MarkSelection. | |
35 * | |
36 * @param document the marked document | |
37 * @param offset the offset of the mark | |
38 * @param length the length of the mark, may be negative if caret before offset | |
39 */ | |
40 public MarkSelection(IDocument document, int offset, int length) { | |
41 fDocument= document; | |
42 fOffset= offset; | |
43 fLength= length; | |
44 } | |
45 | |
46 /* | |
47 * @see IMarkSelection#getDocument() | |
48 */ | |
49 public IDocument getDocument() { | |
50 return fDocument; | |
51 } | |
52 | |
53 /* | |
54 * @see IMarkSelection#getOffset() | |
55 */ | |
56 public int getOffset() { | |
57 return fOffset; | |
58 } | |
59 | |
60 /* | |
61 * @see IMarkSelection#getLength() | |
62 */ | |
63 public int getLength() { | |
64 return fLength; | |
65 } | |
66 | |
67 /* | |
68 * @see ISelection#isEmpty() | |
69 */ | |
70 public bool isEmpty() { | |
71 return fLength is 0; | |
72 } | |
73 | |
74 } |