private void UpdateCommands()
{
if (this.m_template == null)
{
this.toolStripButtonTemplateInsert.Enabled = false;
this.toolStripButtonTemplateRemove.Enabled = false;
this.toolStripButtonTemplateUpdate.Enabled = false;
return;
}
bool locked = (this.treeViewTemplate.SelectedNode != null && this.treeViewTemplate.SelectedNode.ForeColor == Color.Gray);
bool insert = true;
if (this.treeViewTemplate.SelectedNode != null && this.treeViewTemplate.SelectedNode.Tag is DocModelRuleConstraint)
{
insert = false;
}
this.toolStripButtonTemplateInsert.Enabled = insert;
this.toolStripButtonTemplateRemove.Enabled = (this.Selection != null && !locked) || (this.treeViewTemplate.SelectedNode != null && this.treeViewTemplate.SelectedNode.Tag is DocTemplateDefinition);
this.toolStripButtonTemplateUpdate.Enabled = ((this.Selection is DocModelRuleAttribute || (this.Selection is DocModelRuleEntity)) && !locked);
this.toolStripButtonRuleRef.Enabled = (this.Selection is DocModelRuleEntity);
TreeNode tnSelect = this.treeViewTemplate.SelectedNode;
TreeNode tnParent = null;
if(tnSelect != null)
{
tnParent = this.treeViewTemplate.SelectedNode.Parent;
}
this.toolStripButtonMoveUp.Enabled = (tnParent != null && tnParent.Nodes.IndexOf(tnSelect) > 0) && !locked;
this.toolStripButtonMoveDown.Enabled = (tnParent != null && tnParent.Nodes.IndexOf(tnSelect) < tnParent.Nodes.Count - 1) && !locked;
this.toolStripButtonSetDefault.Enabled = (this.Selection is DocModelRuleAttribute || this.Selection is DocModelRuleEntity);
}