1, the outline view right key menu item is affected by the Editpart createeditpolicies () method. For example, although the right-click menu provides the option to delete, as long as the associated Treeeditpart does not have install Componenteditpolicy, the "delete" item is not seen when the mouse opens the right-click menu of the node.
2, and 1 similar, sometimes some objects as container elements do not want to be selected by the user, but also by modifying the policy to achieve. Specifically as follows:
Editpart implementation
public class BoardPart extends ContainerPart {
protected void createEditPolicies() {
super.createEditPolicies();
installEditPolicy(EditPolicy.LAYOUT_ROLE, new BoardLayoutEditPolicy());
}
}
Policy implementation
public class BoardLayoutEditPolicy extends XYLayoutEditPolicy {
...
protected Command createChangeConstraintCommand(EditPart child,
Object constraint) {
return null;
}
...
}
As you can see from the above code, the container element is not selected as long as Createchangeconstraintcommand () returns NULL.