| 104 |
that creates returns an instance of <code>ResourceMapping</code> explicitly |
that creates returns an instance of <code>ResourceMapping</code> explicitly |
| 105 |
when asked for one. This is a more straightforward approach but the least desirable |
when asked for one. This is a more straightforward approach but the least desirable |
| 106 |
as the model must have explicit knowledge of the adaptation to resources.</p> |
as the model must have explicit knowledge of the adaptation to resources.</p> |
| 107 |
|
<p>The implementation of the <code>ResourceMapping</code> subclass for a Java |
| 108 |
|
package would look something like this.</p> |
| 109 |
|
<pre style="background-color: rgb(204, 204, 255);">public class JavaPackageResourceMapping extends ResourceMapping { |
| 110 |
|
IPackageFragment package; |
| 111 |
|
... |
| 112 |
|
public getModelObject() { |
| 113 |
|
return package; |
| 114 |
|
} |
| 115 |
|
public ResourceTraversals[] getTraversals( |
| 116 |
|
ResourceMappingContext context, |
| 117 |
|
IProgressMonitor monitor) { |
| 118 |
|
return new ResourceTraversal[] { |
| 119 |
|
new ResourceTraversal( |
| 120 |
|
new IResource[] { package.getCorrespondingResource() }, |
| 121 |
|
IResource.DEPTH_ONE, IResource.NONE) |
| 122 |
|
} |
| 123 |
|
} |
| 124 |
|
}</pre> |
| 125 |
|
<p>This is a fairly straightforward mapping so the implementaion is not complex. |
| 126 |
|
The complexity of the resource mapping implementation will, of course, vary |
| 127 |
|
from model to model. The <code>EMFResourceMapping</code> example used above |
| 128 |
|
is implemented in the example and it a much more complicated implementation.</p> |
| 129 |
<h4>Contributing Menus to Resource Mappings</h4> |
<h4>Contributing Menus to Resource Mappings</h4> |
| 130 |
<p>Plug-ins that contribute extensions to adaptable extension points will have |
<p>Plug-ins that contribute extensions to adaptable extension points will have |
| 131 |
to make two changes to support the new <code>ResourceMapping</code> APIs:</p> |
to make two changes to support the new <code>ResourceMapping</code> APIs:</p> |
| 201 |
cannot be described by a simple traversal that is gauranteed to encompass those |
cannot be described by a simple traversal that is gauranteed to encompass those |
| 202 |
resources (and only those resources) that consitute the model. For example, |
resources (and only those resources) that consitute the model. For example, |
| 203 |
although the resources of a Java package may change over time, the package can |
although the resources of a Java package may change over time, the package can |
| 204 |
be described as a folder of depth one so a resource mapping for java packages |
be described as a folder of depth of one so a resource mapping for java packages |
| 205 |
would not ned to make use of the resource mapping context. </p> |
would not ned to make use of the resource mapping context. </p> |
| 206 |
<p>As a more complicated example, consider an HTML file that contains several |
<p>As a more complicated example, consider an HTML file that contains several |
| 207 |
images. Let's mak the assumption that any images references from an HTML file |
images. Let's mak the assumption that any images references from an HTML file |
| 271 |
<li>Would it be possible to add a workbench adapter to specific implementations |
<li>Would it be possible to add a workbench adapter to specific implementations |
| 272 |
IModelElement in order to get an image and label for a model element?</li> |
IModelElement in order to get an image and label for a model element?</li> |
| 273 |
<li>Can the user benefit from resource mappings in cases where the repository |
<li>Can the user benefit from resource mappings in cases where the repository |
| 274 |
provider isn't mapping aware?<br> |
provider isn't mapping aware?</li> |
| 275 |
|
<li>What about reposiory providers that cannot provide a remote mapping context?</li> |
| 276 |
|
<li>What should a model provider do if they canno reliably determine the remote |
| 277 |
|
model state? </li> |
| 278 |
|
<li>Need to reference the example<br> |
| 279 |
</li> |
</li> |
| 280 |
</ul> |
</ul> |
| 281 |
</body> |
</body> |