Java Reference
In-Depth Information
&& getActivePage() == diagramPageIndex) {
diagramEditor.updateSelectionActions();
}
}
});
}
public void init(IEditorSite site, IEditorInput editorInput) {
// . . .
site.setSelectionProvider( selectionProvider );
// . . .
}
The selectionChanged() method calls upon a new updateSelection
Actions() method that we add to our RequirementsDiagramEditor , which
appears here:
public void updateSelectionActions() {
updateActions(getSelectionActions());
}
In the handleActivate() method, we need to leverage the selection
Provider as well (changes in bold):
/**
* Handles activation of the editor or its associated views.
* Modified to use selection provider .
*
* @generated NOT
*/
protected void handleActivate() {
// Recompute the read only state.
if (editingDomain.getResourceToReadOnlyMap() != null) {
editingDomain.getResourceToReadOnlyMap().clear();
// Refresh any actions that may become enabled or disabled.
selectionProvider.setSelection(selectionProvider.getSelection());
}
// . . .
}
Our setCurrentViewer() method becomes much simpler because it no
longer needs to deal with selection handling.
/**
* This makes sure that one content viewer, either the current page or
* the outline view, if it has focus, is the current one.
Search WWH ::




Custom Search