comparison org.eclipse.text/src/org/eclipse/jface/text/projection/Segment.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children 5feec68b4556
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
1 /*******************************************************************************
2 * Copyright (c) 2000, 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 org.eclipse.jface.text.projection.Segment;
14
15 import org.eclipse.jface.text.projection.ProjectionMapping; // packageimport
16 import org.eclipse.jface.text.projection.ChildDocumentManager; // packageimport
17 import org.eclipse.jface.text.projection.SegmentUpdater; // packageimport
18 import org.eclipse.jface.text.projection.ProjectionDocument; // packageimport
19 import org.eclipse.jface.text.projection.FragmentUpdater; // packageimport
20 import org.eclipse.jface.text.projection.ProjectionDocumentEvent; // packageimport
21 import org.eclipse.jface.text.projection.ChildDocument; // packageimport
22 import org.eclipse.jface.text.projection.IMinimalMapping; // packageimport
23 import org.eclipse.jface.text.projection.Fragment; // packageimport
24 import org.eclipse.jface.text.projection.ProjectionTextStore; // packageimport
25 import org.eclipse.jface.text.projection.ProjectionDocumentManager; // packageimport
26
27
28 import java.lang.all;
29 import java.util.Set;
30
31 import org.eclipse.jface.text.Position;
32
33
34 /**
35 * Internal class. Do not use. Only public for testing purposes.
36 * <p>
37 * A segment is the image of a master document fragment in a projection
38 * document.
39 *
40 * @since 3.0
41 * @noinstantiate This class is not intended to be instantiated by clients.
42 * @noextend This class is not intended to be subclassed by clients.
43 */
44 public class Segment : Position {
45
46 /** The corresponding fragment for this segment. */
47 public Fragment fragment;
48 /** A flag indicating that the segment updater should stretch this segment when a change happens at its boundaries. */
49 public bool isMarkedForStretch_;
50 /** A flag indicating that the segment updater should shift this segment when a change happens at its boundaries. */
51 public bool isMarkedForShift_;
52
53 /**
54 * Creates a new segment covering the given range.
55 *
56 * @param offset the offset of the segment
57 * @param length the length of the segment
58 */
59 public this(int offset, int length) {
60 super(offset, length);
61 }
62
63 /**
64 * Sets the stretching flag.
65 */
66 public void markForStretch() {
67 isMarkedForStretch_= true;
68 }
69
70 /**
71 * Returns <code>true</code> if the stretching flag is set, <code>false</code> otherwise.
72 * @return <code>true</code> if the stretching flag is set, <code>false</code> otherwise
73 */
74 public bool isMarkedForStretch() {
75 return isMarkedForStretch_;
76 }
77 public bool isMarkedForStretch(bool v) {
78 isMarkedForStretch_ = v;
79 return isMarkedForStretch();
80 }
81
82 /**
83 * Sets the shifting flag.
84 */
85 public void markForShift() {
86 isMarkedForShift_= true;
87 }
88
89 /**
90 * Returns <code>true</code> if the shifting flag is set, <code>false</code> otherwise.
91 * @return <code>true</code> if the shifting flag is set, <code>false</code> otherwise
92 */
93 public bool isMarkedForShift() {
94 return isMarkedForShift_;
95 }
96 public bool isMarkedForShift(bool v) {
97 isMarkedForShift_ = v;
98 return isMarkedForShift();
99 }
100
101 /**
102 * Clears the shifting and the stretching flag.
103 */
104 public void clearMark() {
105 isMarkedForStretch_= false;
106 isMarkedForShift_= false;
107 }
108 }