You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the name of descriptions which came from the index
Until now to register the names of the linked objects the LinkingService
always looked for the IEObjectDescription within the eResource of the
linked object, then used the qualified name of this description as the
name to register.
This is very inefficient, as for each linked object, an object
descriptor is looked up again within the resource by comparing the URI's
fragment of the object with all the URI's fragments of all objects
within the given resource (until one match is found). The linear search
is very slow because URI#getFragment is an expensive operation, it will
convert the internal representation of the fragment into a String, then
put the string into an EMF String pool, and from them use Sring#intern
before returning the String.
As it happens, for objects which are linked using the index (the Proxy
objects), the descriptor that scope#getSingleElement() returns has
already the exported name of the object as its name, so we can take its
names without looking again for a descriptors from where to extract the
name.
For objects which are not a Proxy, the returned descriptor is not the
one exported to the index, just a descriptor created on the fly for
scoping, and its name is unrelated to the one exported. In this case we
still must fallback to lookup up the resource again by comparing the
URI's fragment.
* Check whether a name import should be added for the given cross-reference.
109
133
* <p>
110
-
* This default implementation will return {@code true} in either of the following cases:
111
-
* <ul>
112
-
* <li>the target is {@code null} and the reference is <em>not</em> {@link ICrossReferenceHelper#isOptionalReference(EObject, EReference, INode) optional}
113
-
* </li>
114
-
* <li>the reference is <em>not</em> {@code null} and should be {@link ICrossReferenceHelper#exportReference(EObject, EReference, EObject) exported}</li>
115
-
* </ul>
134
+
* This default implementation will return {@code true} if the reference should be {@link ICrossReferenceHelper#exportReference(EObject, EReference, EObject)}
135
+
* exported
116
136
*
117
137
* @param context
118
138
* The context of the reference
119
139
* @param ref
120
140
* The meta model cross-reference
121
141
* @param target
122
-
* The target object of the reference; may also be {@code null}
142
+
* The target object of the reference; may be {@code null}
* Gets an {@link EObject} that best matches a given context, reference, and qualified name.
218
+
* Gets an {@link IEObjectDescription} that best matches a given context, reference, and qualified name.
157
219
* <p>
158
220
* The concept of a "best match" is "in the eye of the beholder", that is, the context and reference. The default case is the first element returned from the
159
221
* scope for the given context and reference that matches the given qualified name.
@@ -165,23 +227,20 @@ public List<EObject> getLinkedObjects(final EObject context, final EReference re
165
227
* the reference for which the result element should be suitable, must not be {@code null}
166
228
* @param qualifiedLinkName
167
229
* the name that the result element should match, must not be {@code null}
168
-
* @return an eObject that best matches {@code qualifiedLinkName} in {@code scope} given the {@code context} and {@code reference},
230
+
* @return an IEObjectDescription that best matches {@code qualifiedLinkName} in {@code scope} given the {@code context} and {@code reference},
0 commit comments