模型导航器需要更改的惟一一处是告诉导航器内容何时触发此内容提供程序。
The only other part of the model navigator that needs to be changed is to tell the navigator content when this content provider can be triggered.
下面的章节详细介绍了如何访问内容和标签提供程序的数据,以及如何显示模型导航器。
The following sections detail how we can access data for the content and label providers, then how we display the model navigator.
通过将和元素添加到导航器内容扩展中,当能够显示类中所描述的域模型时,我们可以向CNF发出通知。
We signal the CNF when we will be able to display the domain model we described in our classes by adding and elements to the navigator content extension.
这里涉及创建一个内容扩展,此扩展可被导航器内容服务用于显示emf域模型。
This involves creating a content extension that can be used by the navigator content service to display the EMF domain model.
现在,将EMF模型内容添加到通用导航器中的步骤已基本结束。
That pretty much completes the steps needed to add EMF model content to a common navigator.
我们希望从同一个导航器中访问所有的模型内容。
We want to access all model content from the same navigator.
这个导航器仍然不是我们所需要的,因此我们要添加在查看器中显示emf模型的功能。
This navigator is still not what we want, so we need to add the ability to display an EMF model in the viewer.
我们即将了解到,这个类的优势在于,导航器只需将我们所需要的模型类型的项目提供程序作为组合适配器工厂的一部分包括进来。
The advantage of this, as we will see later, is that our navigator only needs to include the item providers for the model types we are interested in as part of the composed adapter factory.
导航器内容扩展定义了内容提供程序和标签提供程序,可以使用这些程序为emf模型的元素提供子对象和父对象。
The navigator content extension defines a content provider and label provider that can be used to provide children and parent objects for element of an EMF model.
在本文的例子中,当查看器包含有作为emf模型的实例的对象时,将调用导航器内容。
In our case, our navigator content will be invoked when the viewer contains an object that is an instance of an EMF model.
它对于用户过程驱动模型很有效,且使用该方法可创建无需导航器的应用程序设计。
It works well for the user-process-driven model, and you can create a navigator-less application design using this method.
最后,将我们创建的导航器内容绑定到视图,我们将使用先前同样的方法将IResource模型内容扩展包含到查看器内容绑定。
Finally, to bind the navigator content we have created to our view, we will use the same method we did earlier to include the IResource model content extension to the viewer content binding.
我们所创建的导航器将显示Ecore模型,但是其他类型的EMF模型怎么办?
The navigator we have created will display Ecore models, but what about other types of EMF models?
例如,要将genmodel对象添加到导航器中,我们只需将生成器模型项目提供程序添加到内容提供程序和标签提供程序所使用的适配器工厂列表中。
For example, to add the genmodel objects to our navigator, we just add the generator model item provider to the adapter factory list our content and label providers use.
例如,我们可以让导航器显示生成器模型、Ecore模型、uml模型等。
For example, we can make our navigator provide a display for generator models, Ecore models, UML models, etc.
例如,我们可以让导航器显示生成器模型、Ecore模型、uml模型等。
For example, we can make our navigator provide a display for generator models, Ecore models, UML models, etc.
应用推荐