1 11 12 package org.eclipse.jdt.internal.ui.javaeditor; 13 14 import org.eclipse.core.resources.IFile; 15 import org.eclipse.core.resources.IResource; 16 17 import org.eclipse.jdt.core.IBuffer; 18 import org.eclipse.jdt.core.IBufferFactory; 19 import org.eclipse.jdt.core.ICompilationUnit; 20 import org.eclipse.jdt.core.IOpenable; 21 22 23 27 public class CustomBufferFactory implements IBufferFactory { 28 29 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 } 45 | Popular Tags |