Editor and View are the two UI elements for displaying and managing resources in Eclipse. Editor provides a convenient mechanism to help users to modify and save resources. But for view, it is to a large extent to provide a tree-like display of resources, so how to change the resources to reflect the view, and through the operation of the view to save the resources in the view? The Common Navigator Framework (CNF) provides a resource-saving mechanism (saveable Protocol) that differs from Editor to help the user to save the resources in the View.
Introduction to CNF
The Common Navigator Framework (CNF) is a set of frameworks that help users develop a content navigation view based on Eclipse, a framework in which developers can quickly integrate specific resources and models seamlessly into eclipse and leverage the APIs they provide Shown in a tree-shaped structure. The CNF originally came from the Rational®application Developer (RAD) v6.0 project and was used for Eclipse 3.2.
Next, briefly describes how to use CNF to construct a resource Navigation view for an existing model. First, using the Org.eclipse.ui.navigator extension point to specify the view that the Resource Navigator uses, the CNF framework eliminates the need for users to implement a new view, specifying the view implementation class of the extension point as Org.eclipse.ui.navigator.CommonNavigator, as shown in the following figure.
Figure 1. Org.eclipse.ui.navigator.CommonNavigator extension Point
Then, by org.eclipse.ui.navigator.navigatorContent the content that will be displayed in View, including Actionprovider,commonfilter, Commonwizard, Navigatorcontent. Among them, in Navigatorcontent, the user can define ContentProvider and Labelprovider to show the different nodes in the Resource Navigator and control the timing of the content by specifying the trigger conditions. As the following illustration shows, the provider GetElements () and GetChildren () methods will be invoked when the defined triggerpoints expression is true.
Figure 2. Triggerpoints Property
Then, by org.eclipse.ui.navigator.viewer the extension point, the content to be displayed is bound to the view, and the user no longer needs to use hard programming (Hard-code) ways to ContentProvider and Labelprovider registered to a specific View. At the org.eclipse.ui.navigator.viewer extension point, we need to specify viewercontentbinding to set the visibility of the content in the Navigator, where the includes statement indicates that the content is visible on view, Pattern is the ID of the predefined presentation.