}
// create this sections display area
createDisplayArea(TITLE, MESSAGE);
final ODOMSelectionManager selectionManager =
context.getODOMSelectionManager();
// create a listener that responds to ODOMElement selections
ODOMElementSelectionListener deviceSelectionListener =
new ODOMElementSelectionListener() {
// javadoc inherited
public void selectionChanged(
ODOMElementSelectionEvent event) {
treeViewer.removeSelectionChangedListener(
selectionManager);
treeViewer.setSelection(event.getSelection(), true);
treeViewer.getTree().showSelection();
treeViewer.addSelectionChangedListener(
selectionManager);
ODOMElement selected = getSelectedDevice();
boolean enable = (selected != null &&
!isRootDevice(selected) &&
(context.isAdminProject() ||
!context.getDeviceRepositoryAccessorManager().
isStandardDevice(getDeviceName(selected))));
// Disable the delete and move actions if there
// is no selection or the master device is selected or
// if the device is a standard device and the project
// is not in admin mode.
deleteAction.setEnabled(enable);
moveAction.setEnabled(enable);
renameAction.setEnabled(enable);
// The new action is always enabled if there is a
// selection.
newAction.setEnabled(selected != null);
viewDeviceXMLAction.setEnabled(selected != null);
}
};
// register the ODOM selection listener with the contexts selection
// manager
selectionManager.addSelectionListener(deviceSelectionListener,
DEVICE_FILTER);
// we want to update the tree whenever a hierarchy element is modified
ODOMChangeListener rootElementListener = new ODOMChangeListener() {
public void changed(ODOMObservable node,