Example usage for org.eclipse.jdt.core WorkingCopyOwner newWorkingCopy

List of usage examples for org.eclipse.jdt.core WorkingCopyOwner newWorkingCopy

Introduction

In this page you can find the example usage for org.eclipse.jdt.core WorkingCopyOwner newWorkingCopy.

Prototype

public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProgressMonitor monitor)
        throws JavaModelException 

Source Link

Document

Returns a new working copy with the given name using this working copy owner to create its buffer.

Usage

From source file:org.eclipse.objectteams.otdt.tests.AbstractJavaModelTests.java

License:Open Source License

protected ICompilationUnit newExternalWorkingCopy(String name, IClasspathEntry[] classpath,
        final IProblemRequestor problemRequestor, final String contents) throws JavaModelException {
    WorkingCopyOwner owner = new WorkingCopyOwner() {
        public IBuffer createBuffer(ICompilationUnit wc) {
            IBuffer buffer = super.createBuffer(wc);
            buffer.setContents(contents);
            return buffer;
        }//  w ww  .j  av a  2 s.  com

        public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) {
            return problemRequestor;
        }
    };
    return owner.newWorkingCopy(name, classpath, null/*no progress monitor*/);
}