Java Reference
In-Depth Information
Navigator and Outline
The
Project Explorer
view in the
Resource
perspective enables us to drill down
into our .
requirements
file and navigate its contents. However, if we attempt
to do this, we'll get
ClassCastException
s in the error log because we have a
diagram contents contribution to the
navigatorContent
extension-point that
doesn't know how to handle domain model elements. To fix this issue, we sim-
ply set the
activeByDefault
property of this contribution to
false
, as shown
in Figure 4-25. More is involved in making the navigator truly useful, but this at
least avoids the exceptions.
Figure 4-25
Requirements navigator extension
Our selection trees in the editor and the
Outline
view both show diagram
content. Later we'll want to fix the
Outline
view so that it again gives us the
“bird's-eye” view of the diagram when the diagram page is selected, but for now
we just filter diagram content from our tree viewers. The process is the same for
both, so we only show the changes made to
SelectionTreeEditorPart.
createPartControl()
here. The same change needs to be made to
RequirementsEditor.getContentOutlinePage()
. As shown here, it's sim-
ply a matter of adding a
ViewerFilter
that excludes instances of
Diagram
from the view (changes in bold).
@Override
public void createPartControl(Composite parent) {
viewer = new TreeViewer(parent, SWT.MULTI);
Search WWH ::
Custom Search