Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] correct usage of WorkingCopyOwner

Hi all,

I'd like to utilize the new functionality provided by the AST 
(see https://bugs.eclipse.org/bugs/show_bug.cgi?id=36232)

And I'm unsure how to use the WorkingCopyOwner class.
What I'd like to achieve is that binding resolution considers working copies that I created and that have no backing in java files.

This is probably very bogus but here's what I did:
- i subclasses WorkingCopyOwner and because there were no other examples provided I called
return BufferManager.getDefaultBufferManager().createBuffer(workingCopy); in the create buffer method
(BufferManager is internal, I know, but like I said, I found no other examples)

- I used that 'owner' to create the new working copies, using:
ICompilationUnit:getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor) 
i passed null as requestor

- I also used the same owner instance to create ASTs 
(AST.parseCompilationUnit(ICompilationUnit, true, owner))


Then, I started resolving bindings but, sadly, the new working copies were not considered.
I probably did something very bogus - please bounce me in the right direction.

Thanks
a.

ps. my concrete example:
A.java (exists on disk)
class A{}

A.java (working copy created using the owner)
class A implements I{}

I.java (working copy existing only in memory - created using the owner)
interface I{}

resolve type binding of A (from the working copy) and look at supertypes - I is not there



Back to the top