KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > DefaultWorkingCopyOwner


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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 package org.eclipse.jdt.internal.core;
12
13 import org.eclipse.jdt.core.IBuffer;
14 import org.eclipse.jdt.core.ICompilationUnit;
15 import org.eclipse.jdt.core.WorkingCopyOwner;
16
17 /**
18  * A working copy owner that creates internal buffers.
19  * It also defines the PRIMARY working copy owner that is used by JDT/Core.
20  */

21 public class DefaultWorkingCopyOwner extends WorkingCopyOwner {
22     
23     public WorkingCopyOwner primaryBufferProvider;
24         
25     public static final DefaultWorkingCopyOwner PRIMARY = new DefaultWorkingCopyOwner();
26     
27     private DefaultWorkingCopyOwner() {
28         // only one instance can be created
29
}
30
31     public IBuffer createBuffer(ICompilationUnit workingCopy) {
32         if (this.primaryBufferProvider != null) return this.primaryBufferProvider.createBuffer(workingCopy);
33         return super.createBuffer(workingCopy);
34     }
35     public String JavaDoc toString() {
36         return "Primary owner"; //$NON-NLS-1$
37
}
38 }
39
Popular Tags