KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > editor > text > PartiallySynchronizedDocument


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  *******************************************************************************/

11
12 package org.eclipse.ant.internal.ui.editor.text;
13
14 import org.eclipse.jface.text.BadLocationException;
15 import org.eclipse.jface.text.Document;
16 import org.eclipse.jface.text.ISynchronizable;
17
18 /**
19  * Document that can also be used by a background reconciler.
20  */

21 public class PartiallySynchronizedDocument extends Document implements ISynchronizable {
22     
23     private final Object JavaDoc fInternalLockObject= new Object JavaDoc();
24     private Object JavaDoc fLockObject;
25             
26     /* (non-Javadoc)
27      * @see org.eclipse.jface.text.IDocumentExtension#startSequentialRewrite(boolean)
28      */

29     synchronized public void startSequentialRewrite(boolean normalized) {
30         super.startSequentialRewrite(normalized);
31     }
32         
33     /* (non-Javadoc)
34      * @see org.eclipse.jface.text.IDocumentExtension#stopSequentialRewrite()
35      */

36     synchronized public void stopSequentialRewrite() {
37         super.stopSequentialRewrite();
38     }
39             
40     /* (non-Javadoc)
41      * @see org.eclipse.jface.text.IDocument#get()
42      */

43     synchronized public String JavaDoc get() {
44         return super.get();
45     }
46             
47     /* (non-Javadoc)
48      * @see org.eclipse.jface.text.IDocument#get(int, int)
49      */

50     synchronized public String JavaDoc get(int offset, int length) throws BadLocationException {
51         return super.get(offset, length);
52     }
53             
54     /* (non-Javadoc)
55      * @see org.eclipse.jface.text.IDocument#getChar(int)
56      */

57     synchronized public char getChar(int offset) throws BadLocationException {
58         return super.getChar(offset);
59     }
60             
61     /* (non-Javadoc)
62      * @see org.eclipse.jface.text.IDocument#set(java.lang.String)
63      */

64     synchronized public void set(String JavaDoc text) {
65         super.set(text);
66     }
67     
68     /*
69      * @see org.eclipse.jface.text.ISynchronizable#setLockObject(java.lang.Object)
70      */

71     public void setLockObject(Object JavaDoc lockObject) {
72         fLockObject= lockObject;
73     }
74
75     /*
76      * @see org.eclipse.jface.text.ISynchronizable#getLockObject()
77      */

78     public Object JavaDoc getLockObject() {
79         return fLockObject == null ? fInternalLockObject : fLockObject;
80     }
81 }
82
Popular Tags