ABS Module Explorer

FeatureExtension PointsClasses
ABS Module Explorer Coreorg.eclipse.ui.views org.eclipse.ui.navigator.viewereu.hatsproject.absplugin.navigator.ABSNavigator
ABS Module Explorer Contentorg.eclipse.ui.navigator.navigatorContenteu.hatsproject.absplugin.navigator.ABSNavgiatorStyledLabelProvider eu.hatsproject.absplugin.navigator.ABSNavigatorContentProvider
ABS Module Explorer Link with Editororg.eclipse.ui.navigator.linkHelpereu.hatsproject.absplugin.navigator.LinkHelper

ABS Module Explorer

ABS Module Explorer Core

The ABS Module Explorer uses the Common Navigator Framework (CNF) that was included into Eclipse since version 3.2.

The first step is to create a new view with the help of the org.eclipse.ui.views extension point. This extension point is used to create new, but empty view.

This new view is made to a CNF view by adding a new org.eclipse.ui.navigator.viewer extension point and a viewer sub-element to the plug-in.xml. The viewer sub-element is used to name the viewer with an ID (the same as the ID in the org.eclipse.ui.views extension point) and to provide according pop-up menu entries.

Up to now, the CNF view is still empty and has no actions attached. The addition of content and actions is done with the viewerContentBinding and viewerActionBinding sub-elements of the org.eclipse.ui.navigator.viewer extension point.

  • ViewerContentBindings describe, which content is displayed in the CNF view and which filters should be included in the respective view.
  • ViewerActionBindings determine, which actions should be available the the CNF view.

Both sub-elements specify patterns of org.eclipse.ui.navigator.navigatorContent extension point IDs. The

  • includes sub-elements indicate to take the contents of the respective extension points into account.
  • excludes sub-elements indicate the explicit exclusion of certain name patterns (especially useful when working with wildcards like *).

    Example: The viewerContentBinding of the ABSModuleView:

       <viewerContentBinding
                     viewerId="eu.hatsproject.absplugin.navigator.view">
              <includes>
                     <contentExtension
                               isRoot="true"
                               pattern="eu.hatsproject.absplugin.navigator.content">
                     </contentExtension>
                     <contentExtension
                               pattern="eu.hatsproject.absplugin.navigator.LinkHelper">
                     </contentExtension>
                     <contentExtension
                               pattern="eu.hatsproject.absplugin.navigator.hideNonABSFilter">
                     </contentExtension>
                     <contentExtension
                               pattern="org.eclipse.ui.navigator.resources.filters.*">
                     </contentExtension>
              </includes>
       </viewerContentBinding>

ABS Module Explorer Content

After the view has been set up, the extension point org.eclipse.ui.navigator.navigatorContent (and its navigatorContent) is used to group and define content and actions for a CNF view. Within this extension following things can be set:

  • Content and Label Providers: Define the contents of this navigatorContent extension point. For more information on Content and Label Providers, see the section on ABS content outline
  • enablement sub-element: Specifies on which elements of the internal CNF TreeViewers the navigatorContent extension should be used.
  • commonWizard sub-element: Defines common wizards (like new, import or export wizards). For more information on how to define new common wizards, see the section on ABS wizards.

ABS Module Explorer Link With Editor

The CNF framework provides an easy mechanism to provide "Link with Editor" functionality for a given viewer. In order to provide "Link with Editor" functionality the extension point org.eclipse.ui.navigator.linkHelper is used. This extension point necessitates to implement a LinkHelper class that implements the ILinkHelper interface.

This interface has two methods that must be implemented:

IStructuredSelection findSelection(IEditorInput anInput){
  ...
}

void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection){
  ...
}

The findSelection method is responsible for finding the correct element in the tree of the CNF view given a certain editor input. The ABS Module Explorer selects the module declaration, in which the last cursor position was located in or the first module declaration of the compilation unit (the editor input) that was brought to top if no last cursor position existed.

The activateEditor method is responsible for activating the editor in which the element of the current selection is located in. The ABS Module Explorer activates the editor (and therefore the corresponding compilation unit) in which the selected element is located in.