其次,我们必须将导航器内容绑定到视图。
通过将和元素添加到导航器内容扩展中,当能够显示类中所描述的域模型时,我们可以向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.
下面的章节详细介绍了如何访问内容和标签提供程序的数据,以及如何显示模型导航器。
The following sections detail how we can access data for the content and label providers, then how we display the model navigator.
现在,将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.
我们所实现的类接下来将会用作此导航器内容的内容提供程序和标签提供程序。
We implement the classes that will act as the content and label providers for this navigator content next.
在本文的例子中,当查看器包含有作为emf模型的实例的对象时,将调用导航器内容。
In our case, our navigator content will be invoked when the viewer contains an object that is an instance of an EMF model.
我们了解了如何告知导航器框架我们希望显示的内容类型,以及希望导航器如何运作。
We saw how to tell the navigator framework the type of content we want to display and how we want the navigator to act.
首先,我们需要创建新的内容扩展,在其中指定通用导航器使用的内容和标签提供程序,稍后我们将实现这些类。
First, we need to create a new content extension where we can specify the content and label providers to be used by the common navigator, later we will implement these classes.
这里涉及创建一个内容扩展,此扩展可被导航器内容服务用于显示emf域模型。
This involves creating a content extension that can be used by the navigator content service to display the EMF domain model.
导航器内容扩展定义了内容提供程序和标签提供程序,可以使用这些程序为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.
我们还可以修改导航器内容的很多其他属性以更改插件的行为,如动作提供程序、通用向导、过滤器等。
There are also many other attributes of the navigator content we can modify to change the behavior of our plug-in, such as the action providers, common wizards, filters, etc.
导航器插件的行为由我们给它绑定的内容、动作,以及使用CNF(过滤器、分类器等)时插件中设置的其他选项进行管理。
The behavior of our navigator plug-in will be governed by the content we bind to it, the actions we bind to it, and the other options we set in our plug-in when using CNF (filters, sorters, etc.).
模型导航器需要更改的惟一一处是告诉导航器内容何时触发此内容提供程序。
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.
最后,将我们创建的导航器内容绑定到视图,我们将使用先前同样的方法将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.
例如,要将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.
例如,要将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.
应用推荐