1 /**********************************************************************
2 Copyright (c) 2000, 2003 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
9 IBM Corporation - Initial implementation
10 **********************************************************************/
12 package net.sourceforge.phpeclipse.phpeditor;
14 import net.sourceforge.phpdt.core.IBuffer;
15 import net.sourceforge.phpdt.core.IBufferFactory;
16 import net.sourceforge.phpdt.core.ICompilationUnit;
17 import net.sourceforge.phpdt.core.IOpenable;
19 import org.eclipse.core.resources.IFile;
20 import org.eclipse.core.resources.IResource;
24 * Creates <code>IBuffer</code>s based on documents.
25 * @deprecated since 3.0 no longer used
27 public class CustomBufferFactory implements IBufferFactory {
30 * @see org.eclipse.jdt.core.IBufferFactory#createBuffer(org.eclipse.jdt.core.IOpenable)
32 public IBuffer createBuffer(IOpenable owner) {
33 if (owner instanceof ICompilationUnit) {
34 ICompilationUnit unit= (ICompilationUnit) owner;
35 ICompilationUnit original= unit.getPrimary();
36 IResource resource= original.getResource();
37 if (resource instanceof IFile) {
38 return new DocumentAdapter(unit, (IFile) resource);
42 return DocumentAdapter.NULL;