129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2006, 2008 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.revisions.RevisionRange;
|
|
14
|
131
|
15 import dwtx.jface.text.revisions.IRevisionListener; // packageimport
|
|
16 import dwtx.jface.text.revisions.IRevisionRulerColumnExtension; // packageimport
|
|
17 import dwtx.jface.text.revisions.IRevisionRulerColumn; // packageimport
|
|
18 import dwtx.jface.text.revisions.RevisionEvent; // packageimport
|
|
19 import dwtx.jface.text.revisions.RevisionInformation; // packageimport
|
|
20 import dwtx.jface.text.revisions.Revision; // packageimport
|
|
21
|
|
22
|
129
|
23 import dwt.dwthelper.utils;
|
|
24
|
|
25
|
|
26 import dwtx.core.runtime.Assert;
|
|
27 import dwtx.jface.text.source.ILineRange;
|
|
28
|
|
29
|
|
30 /**
|
|
31 * An unmodifiable line range that belongs to a {@link Revision}.
|
|
32 *
|
|
33 * @since 3.3
|
|
34 * @noinstantiate This class is not intended to be instantiated by clients.
|
|
35 */
|
|
36 public final class RevisionRange : ILineRange {
|
|
37 private final Revision fRevision;
|
|
38 private final int fStartLine;
|
|
39 private final int fNumberOfLines;
|
|
40
|
|
41 RevisionRange(Revision revision, ILineRange range) {
|
|
42 Assert.isLegal(revision !is null);
|
|
43 fRevision= revision;
|
|
44 fStartLine= range.getStartLine();
|
|
45 fNumberOfLines= range.getNumberOfLines();
|
|
46 }
|
|
47
|
|
48 /**
|
|
49 * Returns the revision that this range belongs to.
|
|
50 *
|
|
51 * @return the revision that this range belongs to
|
|
52 */
|
|
53 public Revision getRevision() {
|
|
54 return fRevision;
|
|
55 }
|
|
56
|
|
57 /*
|
|
58 * @see dwtx.jface.text.source.ILineRange#getStartLine()
|
|
59 */
|
|
60 public int getStartLine() {
|
|
61 return fStartLine;
|
|
62 }
|
|
63
|
|
64 /*
|
|
65 * @see dwtx.jface.text.source.ILineRange#getNumberOfLines()
|
|
66 */
|
|
67 public int getNumberOfLines() {
|
|
68 return fNumberOfLines;
|
|
69 }
|
|
70
|
|
71 /*
|
|
72 * @see java.lang.Object#toString()
|
|
73 */
|
|
74 public String toString() {
|
|
75 return "RevisionRange [" + fRevision.toString() + ", [" + getStartLine() + "+" + getNumberOfLines() + ")]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
76 }
|
|
77 }
|