deleted old partition test; no longer suitable
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / CustomBufferFactory.java
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
7
8 Contributors:
9         IBM Corporation - Initial implementation
10 **********************************************************************/
11
12 package net.sourceforge.phpeclipse.phpeditor;
13
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;
18
19 import org.eclipse.core.resources.IFile;
20 import org.eclipse.core.resources.IResource;
21
22
23 /**
24  * Creates <code>IBuffer</code>s based on documents.
25  * @deprecated since 3.0 no longer used
26  */
27 public class CustomBufferFactory implements IBufferFactory {
28         
29         /*
30          * @see org.eclipse.jdt.core.IBufferFactory#createBuffer(org.eclipse.jdt.core.IOpenable)
31          */
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);
39                         }
40                                 
41                 }
42                 return DocumentAdapter.NULL;
43         }
44 }