CommandManager includes an example Text Editor as show in figure 1.
Figure 1 and figure 2 show Toolbar Buttons and Menu Items Enable or disabled based on the state of the Command TextEditor.
Figure 1:
Figure 2: