Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 182935
Collapse All | Expand All

(-)src/org/eclipse/core/internal/filebuffers/SynchronizableDocument.java (+155 lines)
Lines 11-19 Link Here
11
package org.eclipse.core.internal.filebuffers;
11
package org.eclipse.core.internal.filebuffers;
12
12
13
import org.eclipse.jface.text.BadLocationException;
13
import org.eclipse.jface.text.BadLocationException;
14
import org.eclipse.jface.text.BadPartitioningException;
14
import org.eclipse.jface.text.BadPositionCategoryException;
15
import org.eclipse.jface.text.BadPositionCategoryException;
15
import org.eclipse.jface.text.Document;
16
import org.eclipse.jface.text.Document;
17
import org.eclipse.jface.text.DocumentRewriteSession;
18
import org.eclipse.jface.text.DocumentRewriteSessionType;
19
import org.eclipse.jface.text.IRegion;
16
import org.eclipse.jface.text.ISynchronizable;
20
import org.eclipse.jface.text.ISynchronizable;
21
import org.eclipse.jface.text.ITypedRegion;
17
import org.eclipse.jface.text.Position;
22
import org.eclipse.jface.text.Position;
18
23
19
24
Lines 70-75 Link Here
70
			super.stopSequentialRewrite();
75
			super.stopSequentialRewrite();
71
		}
76
		}
72
	}
77
	}
78
	
79
	/*
80
	 * @see org.eclipse.jface.text.AbstractDocument#startRewriteSession(org.eclipse.jface.text.DocumentRewriteSessionType)
81
	 * 
82
	 * @since 3.5
83
	 */
84
	public DocumentRewriteSession startRewriteSession(DocumentRewriteSessionType sessionType) {
85
		Object lockObject= getLockObject();
86
		if (lockObject == null) {
87
			return super.startRewriteSession(sessionType);
88
		}
89
		synchronized (lockObject) {
90
			return super.startRewriteSession(sessionType);
91
		}
92
	}
93
94
	/*
95
	 * @see org.eclipse.jface.text.AbstractDocument#stopRewriteSession(org.eclipse.jface.text.DocumentRewriteSession)
96
	 * 
97
	 * @since 3.5
98
	 */
99
	public void stopRewriteSession(DocumentRewriteSession session) {
100
		Object lockObject= getLockObject();
101
		if (lockObject == null) {
102
			super.stopRewriteSession(session);
103
			return;
104
		}
105
		synchronized (lockObject) {
106
			super.stopRewriteSession(session);
107
		}
108
	}
73
109
74
	/*
110
	/*
75
	 * @see IDocument#get()
111
	 * @see IDocument#get()
Lines 235-238 Link Here
235
		}
271
		}
236
	}
272
	}
237
273
274
	/*
275
	 * @see org.eclipse.jface.text.AbstractDocument#computePartitioning(java.lang.String, int, int, boolean)
276
	 * 
277
	 * @since 3.5
278
	 */
279
	public ITypedRegion[] computePartitioning(String partitioning, int offset, int length, boolean includeZeroLengthPartitions) throws BadLocationException, BadPartitioningException {
280
		Object lockObject= getLockObject();
281
		if (lockObject == null) {
282
			return super.computePartitioning(partitioning, offset, length, includeZeroLengthPartitions);
283
		}
284
		synchronized (lockObject) {
285
			return super.computePartitioning(partitioning, offset, length, includeZeroLengthPartitions);
286
		}
287
	}
288
289
	/*
290
	 * @see org.eclipse.jface.text.AbstractDocument#getLineDelimiter(int)
291
	 * 
292
	 * @since 3.5
293
	 */
294
	public String getLineDelimiter(int line) throws BadLocationException {
295
		Object lockObject= getLockObject();
296
		if (lockObject == null) {
297
			return super.getLineDelimiter(line);
298
		}
299
		synchronized (lockObject) {
300
			return super.getLineDelimiter(line);
301
		}
302
	}
303
304
	/*
305
	 * @see org.eclipse.jface.text.AbstractDocument#getDefaultLineDelimiter()
306
	 * 
307
	 * @since 3.5
308
	 */
309
	public String getDefaultLineDelimiter() {
310
		Object lockObject= getLockObject();
311
		if (lockObject == null) {
312
			return super.getDefaultLineDelimiter();
313
		}
314
		synchronized (lockObject) {
315
			return super.getDefaultLineDelimiter();
316
		}
317
	}
318
	
319
	/*
320
	 * @see org.eclipse.jface.text.AbstractDocument#getLineInformation(int)
321
	 * 
322
	 * @since 3.5
323
	 */
324
	public IRegion getLineInformation(int line) throws BadLocationException {
325
		Object lockObject= getLockObject();
326
		if (lockObject == null) {
327
			return super.getLineInformation(line);
328
		}
329
		synchronized (lockObject) {
330
			return super.getLineInformation(line);
331
		}
332
	}
333
334
	/*
335
	 * @see org.eclipse.jface.text.AbstractDocument#getLineInformationOfOffset(int)
336
	 * 
337
	 * @since 3.5
338
	 */
339
	public IRegion getLineInformationOfOffset(int offset) throws BadLocationException {
340
		Object lockObject= getLockObject();
341
		if (lockObject == null) {
342
			return super.getLineInformationOfOffset(offset);
343
		}
344
		synchronized (lockObject) {
345
			return super.getLineInformationOfOffset(offset);
346
		}
347
	}
348
349
	/*
350
	 * @see org.eclipse.jface.text.AbstractDocument#getLineLength(int)
351
	 * 
352
	 * @since 3.5
353
	 */
354
	public int getLineLength(int line) throws BadLocationException {
355
		Object lockObject= getLockObject();
356
		if (lockObject == null) {
357
			return super.getLineLength(line);
358
		}
359
		synchronized (lockObject) {
360
			return super.getLineLength(line);
361
		}
362
	}
363
364
	/*
365
	 * @see org.eclipse.jface.text.AbstractDocument#getLineOffset(int)
366
	 * 
367
	 * @since 3.5
368
	 */
369
	public int getLineOffset(int line) throws BadLocationException {
370
		Object lockObject= getLockObject();
371
		if (lockObject == null) {
372
			return super.getLineOffset(line);
373
		}
374
		synchronized (lockObject) {
375
			return super.getLineOffset(line);
376
		}
377
	}
378
379
	/*
380
	 * @see org.eclipse.jface.text.AbstractDocument#getLineOfOffset(int)
381
	 * 
382
	 * @since 3.5
383
	 */
384
	public int getLineOfOffset(int pos) throws BadLocationException {
385
		Object lockObject= getLockObject();
386
		if (lockObject == null) {
387
			return super.getLineOfOffset(pos);
388
		}
389
		synchronized (lockObject) {
390
			return super.getLineOfOffset(pos);
391
		}
392
	}
238
}
393
}

Return to bug 182935