Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public String apply(final IEObjectDescription from) {
private final URI uri;
private IResourceDescription oldDesc;
private final SoftReference<IResourceDescription> newDesc;
private IResourceDescription pinnedNewDesc;
private final IResourceDescriptions index;

private Boolean hasChanges;
Expand Down Expand Up @@ -98,6 +99,9 @@ public IResourceDescription getNew() {
if (newDesc == null) {
return null;
}
if (pinnedNewDesc != null) {
return pinnedNewDesc;
}
IResourceDescription res = newDesc.get();
return res != null ? res : index.getResourceDescription(uri);
}
Expand Down Expand Up @@ -127,6 +131,20 @@ public boolean haveEObjectDescriptionsChanged() {
return hasChanges;
}

/**
* Ensure the new resource description is not touched by GC.
*/
public void pinNew() {
pinnedNewDesc = newDesc == null ? null : newDesc.get();
}

/**
* Reverse the effect of {@link pinNew}.
*/
public void unpinNew() {
pinnedNewDesc = null;
}

/**
* Discards the old descriptions as it's either equivalent to the new or can be computed from a diff against the new.
*
Expand Down