1 11 package org.eclipse.jdt.core; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 import org.eclipse.core.runtime.Path; 15 import org.eclipse.jdt.internal.core.BufferManager; 16 import org.eclipse.jdt.internal.core.CompilationUnit; 17 import org.eclipse.jdt.internal.core.DefaultWorkingCopyOwner; 18 import org.eclipse.jdt.internal.core.ExternalJavaProject; 19 import org.eclipse.jdt.internal.core.PackageFragment; 20 21 37 public abstract class WorkingCopyOwner { 38 39 51 public static void setPrimaryBufferProvider(WorkingCopyOwner primaryBufferProvider) { 52 DefaultWorkingCopyOwner.PRIMARY.primaryBufferProvider = primaryBufferProvider; 53 } 54 55 70 public IBuffer createBuffer(ICompilationUnit workingCopy) { 71 72 return BufferManager.createBuffer(workingCopy); 73 } 74 75 88 public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { 89 return null; 90 } 91 92 136 public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException { 137 ExternalJavaProject project = new ExternalJavaProject(classpath); 138 IPackageFragment parent = project.getPackageFragmentRoot(Path.EMPTY).getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME); 139 CompilationUnit result = new CompilationUnit((PackageFragment) parent, name, this); 140 result.becomeWorkingCopy(problemRequestor, monitor); 141 return result; 142 } 143 144 183 public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProgressMonitor monitor) throws JavaModelException { 184 ExternalJavaProject project = new ExternalJavaProject(classpath); 185 IPackageFragment parent = project.getPackageFragmentRoot(Path.EMPTY).getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME); 186 CompilationUnit result = new CompilationUnit((PackageFragment) parent, name, this); 187 result.becomeWorkingCopy(getProblemRequestor(result), monitor); 188 return result; 189 } 190 191 } 192 | Popular Tags |