1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*
*******************************************************************************/
package org.eclipse.jst.jsp.core.internal.util;
import org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.sse.core.internal.text.TextRegionListImpl;
public class ZeroStructuredDocumentRegion implements IStructuredDocumentRegion {
private int length = 0;
private int offset = 0;
private IStructuredDocument fParentDocument;
/**
*/
public ZeroStructuredDocumentRegion(IStructuredDocument document, int start) {
super();
fParentDocument = document;
offset = start;
}
public void addRegion(ITextRegion aRegion) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void adjust(int i) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void adjustLength(int i) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void adjustStart(int i) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void adjustTextLength(int i) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public boolean containsOffset(int i) {
return offset <= i && i < getEndOffset();
}
public boolean containsOffset(ITextRegion region, int i) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void equatePositions(ITextRegion region) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public ITextRegion getDeepestRegionAtCharacterOffset(int offset) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public int getEnd() {
return offset + length;
}
public int getEndOffset() {
return getEnd();
}
public int getEndOffset(ITextRegion containedRegion) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public ITextRegion getFirstRegion() {
return null;
}
public String getFullText() {
return getText();
}
public String getFullText(ITextRegion aRegion) {
return getText();
}
/**
*/
public String getFullText(String context) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public ITextRegion getLastRegion() {
return null;
}
public int getLength() {
return this.length;
}
public IStructuredDocumentRegion getNext() {
return getParentDocument().getFirstStructuredDocumentRegion();
}
public int getNumberOfRegions() {
return 0;
}
int getOffset() {
return offset;
}
/**
*/
public ITextRegionContainer getParent() {
return null;
}
public IStructuredDocument getParentDocument() {
return fParentDocument;
}
public IStructuredDocumentRegion getPrevious() {
return null; //$NON-NLS-1$
}
/**
*/
public ITextRegion getRegionAtCharacterOffset(int offset) {
return null; //$NON-NLS-1$
}
/**
*/
public ITextRegionList getRegions() {
return new TextRegionListImpl(); //$NON-NLS-1$
}
/**
*/
public int getStart() {
return this.offset;
}
/**
*/
public int getStartOffset() {
return getStart();
}
public int getStartOffset(ITextRegion containedRegion) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
/**
*/
public IStructuredDocument getStructuredDocument() {
return getParentDocument();
}
/**
*/
public String getText() {
return new String();
}
/**
*/
public String getText(ITextRegion aRegion) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
/**
*/
public String getText(String context) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
/**
*/
public int getTextEnd() {
return getEnd();
}
/**
*/
public int getTextEndOffset() {
return getTextEnd();
}
public int getTextEndOffset(ITextRegion containedRegion) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
/**
* The text length is equal to length if there is no white space at the
* end of a region. Otherwise it is smaller than length.
*/
public int getTextLength() {
return getLength();
}
/**
*/
public String getType() {
return "ZeroStructuredDocumentRegion";//$NON-NLS-1$
}
public boolean isDeleted() {
return false;
}
public boolean isEnded() {
return true;
}
public boolean sameAs(IStructuredDocumentRegion region, int shift) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
/**
*/
public boolean sameAs(ITextRegion region, int shift) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public boolean sameAs(ITextRegion oldRegion, IStructuredDocumentRegion documentRegion, ITextRegion newRegion, int shift) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void setDeleted(boolean deleted) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void setEnded(boolean hasEnd) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
/**
* had to make public, due to API transition.
*/
public void setLength(int length) {
this.length = length;
}
public void setNext(IStructuredDocumentRegion newNext) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
/**
*/
void setOffset(int offset) {
this.offset = offset;
}
public void setParentDocument(IStructuredDocument document) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void setPrevious(IStructuredDocumentRegion newPrevious) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void setRegions(ITextRegionList embeddedRegions) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public void setStart(int newStart) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
public StructuredDocumentEvent updateRegion(Object requester, IStructuredDocumentRegion flatnode, String changes, int start, int end) {
throw new Error("intentionally not implemented since should never be called"); //$NON-NLS-1$
}
}
|