Java Reference
In-Depth Information
The string 'scenario' matches the semanticHints attribute of the
Scenario diagram's provider declaration, as shown next. When the
ViewService is consulted to create the new diagram for the Process element
reference, it uses this hint to create the diagram, as discussed in Section 10.4.1,
“View Service.”
<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders">
<?gmfgen generated="true"?>
<viewProvider
class="org.eclipse.scenario.diagram.providers.ScenarioViewProvider">
<Priority name="Lowest"/>
<context viewClass="org.eclipse.gmf.runtime.notation.Diagram"
semanticHints="scenario"/>
<context viewClass="org.eclipse.gmf.runtime.notation.Node"
semanticHints=""/>
<context viewClass="org.eclipse.gmf.runtime.notation.Edge"
semanticHints=""/>
</viewProvider>
</extension>
TIP
When testing behavior that initiates on double-click, such as an open dia-
gram edit policy, be sure that the root figure is selected. If you're not sure,
use the mouse to drag around the element to select it and then double-
click.
In the RequirementsEditor class, we need to add an adapter factory for our
Scenario integration. The following line added to initializeEditingDomain()
does the trick:
adapterFactory.addAdapterFactory( new
ScenarioItemProviderAdapterFactory());
We now can regenerate our diagram code and launch. Add a new Scenario
element to a Requirement in a sample diagram and double-click it. A new dia-
gram should open in an adjacent editor tab, as shown in Figure 4-41.
 
Search WWH ::




Custom Search