Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] How can I restore a working copy from a handle?


I have the following problem: I store the Java element handle identifier (IJavaElement.getHandleIdentifier()) of a working copy into a marker.
Later when I need the label and icon of the Java element to display the marker I create the Java element from the handle identifier (JavaCore.create(String)).

Problems:
1) It seems that the handle is not recreated as before: the fact that it was a working copy is lost (even though a corresponding working copy exists)
        Is this correct? What's the suggested way to do this?
2) I can store the fact that it is a working copy but I can not find an API to create a Java element as working copy. Am I right?
3) I then queried IWorkingCopyManager for the corresponding working copy (this works) but there is no API to find the working copy element for a given Java element which might not exist: searching inside the working copy does not work in all cases because I need to ask the non-working copy element for some state (e.g. isConstructor()) and this might fail because the element might not (yet) exist in the original.
        Is there another way to find a corresponding Java element in an existing working copy?

Example: J Core Search reports a match in a working copy (e.g. method X.y - which does not yet exist in the original). This is stored in the marker as handle identifier. How can I restore/find this method later?

Dani

Back to the top