| 105 |
that creates returns an instance of <code>ResourceMapping</code> explicitly |
that creates returns an instance of <code>ResourceMapping</code> explicitly |
| 106 |
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 |
| 107 |
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> |
| 108 |
|
<p>In some cases, the provider of a logical model may not want their model to |
| 109 |
|
adapt to <code>IResource</code> in every context or may want the object to adapt |
| 110 |
|
differently for object contributions than other contexts, The workbench UI provides |
| 111 |
|
a special intermediate adapter API, <code>IContributorResourceAdapter</code>, |
| 112 |
|
for this purpose. When objects are being adapted to <code>IResource</code> in |
| 113 |
|
the context of object contributions, the workbench first tries to adapt the |
| 114 |
|
resource to <code>IContributorResourceAdapter</code> before trying to adapt |
| 115 |
|
to <code>IResource</code> directly. A new sub-iterface of this interface, <code>IContributorResourceAdapter2</code>, |
| 116 |
|
has been added which provides the same capability for <code>ResourceMapping</code>. |
| 117 |
|
The only difference is that the model provider shoudl register a factory for<code> |
| 118 |
|
IContributorResourceAdapter</code> since the Workbench does an <em>instanceof</em> |
| 119 |
|
check to see if the contributed adapter is also an instance of <code>IContributorResourceAdapter2</code>.</p> |
| 120 |
<p>The implementation of the <code>ResourceMapping</code> subclass for a Java |
<p>The implementation of the <code>ResourceMapping</code> subclass for a Java |
| 121 |
package would look something like this.</p> |
package would look something like this.</p> |
| 122 |
<pre style="background-color: rgb(204, 204, 255);">public class JavaPackageResourceMapping extends ResourceMapping { |
<pre style="background-color: rgb(204, 204, 255);">public class JavaPackageResourceMapping extends ResourceMapping { |