Java Reference
In-Depth Information
* Modified to remove selection handling.
*
* @generated
NOT
*/
public void
setCurrentViewer(Viewer viewer) {
if
(currentViewer != viewer) {
currentViewer = viewer;
}
}
Finally, we need to refactor our
handleContentOutlineSelection()
method.
/**
* This deals with how we want selection in the outline to affect
* the other views.
* Modified to update selection handling.
*
* @generated
NOT
*/
public void
handleContentOutlineSelection(Iselection selection) {
if
(!selection.isEmpty() && selection
instanceof
IStructuredSelection) {
List selectedElements = ((IStructuredSelection)
selection).toList();
if
(getActiveEditor() == selectionTreeEditorPart) {
// For the selection viewer, select the same selection
selectionProvider.setSelection(
new
StructuredSelection(selectedElements));
}
else
{
// For others, set the input directly.
((RequirementsEditorPart)getActiveEditor())
.setInput(selectedElements.get(0));
}
}
}
Our editor no longer is responsible for being an
ISelectionProvider
, so
we can eliminate this interface from the implements list and all associated code.
Attributes
selectionChangedListener
,
selectionChangedListeners
,
and
editorSelection
can be removed, along with their associated
methods
addSelectionChangedListener()
,
removeSelectionChanged
Listeners()
,
getSelection()
, and
setSelection()
. We no longer need
the
currentViewerPane
or the viewers, so we can remove these (except
currentViewer
) as well. We also can remove the
setFocus()
and
isDirty()
methods.
Search WWH ::
Custom Search