Exemplo n.º 1
0
        private void UpdateUI(IList <TreeNode> nodes)
        {
            if (nodes == null)
            {
                return;
            }

            _buttonAddTagByte.Enabled      = _controller.CanOperateOnSelection(Predicates.CreateByteNodePred);
            _buttonAddTagShort.Enabled     = _controller.CanOperateOnSelection(Predicates.CreateShortNodePred);
            _buttonAddTagInt.Enabled       = _controller.CanOperateOnSelection(Predicates.CreateIntNodePred);
            _buttonAddTagLong.Enabled      = _controller.CanOperateOnSelection(Predicates.CreateLongNodePred);
            _buttonAddTagFloat.Enabled     = _controller.CanOperateOnSelection(Predicates.CreateFloatNodePred);
            _buttonAddTagDouble.Enabled    = _controller.CanOperateOnSelection(Predicates.CreateDoubleNodePred);
            _buttonAddTagByteArray.Enabled = _controller.CanOperateOnSelection(Predicates.CreateByteArrayNodePred);
            _buttonAddTagIntArray.Enabled  = _controller.CanOperateOnSelection(Predicates.CreateIntArrayNodePred);
            _buttonAddTagLongArray.Enabled = _controller.CanOperateOnSelection(Predicates.CreateLongArrayNodePred);
            _buttonAddTagString.Enabled    = _controller.CanOperateOnSelection(Predicates.CreateStringNodePred);
            _buttonAddTagList.Enabled      = _controller.CanOperateOnSelection(Predicates.CreateListNodePred);
            _buttonAddTagCompound.Enabled  = _controller.CanOperateOnSelection(Predicates.CreateCompoundNodePred);

            _buttonSave.Enabled     = _controller.CheckModifications();
            _buttonRename.Enabled   = _controller.CanOperateOnSelection(Predicates.RenameNodePred);
            _buttonEdit.Enabled     = _controller.CanOperateOnSelection(Predicates.EditNodePred);
            _buttonDelete.Enabled   = _controller.CanOperateOnSelection(Predicates.DeleteNodePred);
            _buttonCut.Enabled      = _controller.CanOperateOnSelection(Predicates.CutNodePred) && NbtClipboardController.IsInitialized;;
            _buttonCopy.Enabled     = _controller.CanOperateOnSelection(Predicates.CopyNodePred) && NbtClipboardController.IsInitialized;;
            _buttonPaste.Enabled    = _controller.CanOperateOnSelection(Predicates.PasteIntoNodePred) && NbtClipboardController.IsInitialized;;
            _buttonFindNext.Enabled = _controller.CanOperateOnSelection(Predicates.SearchNodePred) || _searchState != null;
            _buttonRefresh.Enabled  = _controller.CanOperateOnSelection(Predicates.RefreshNodePred);

            _menuItemSave.Enabled      = _buttonSave.Enabled;
            _menuItemRename.Enabled    = _buttonRename.Enabled;
            _menuItemEditValue.Enabled = _buttonEdit.Enabled;
            _menuItemDelete.Enabled    = _buttonDelete.Enabled;
            _menuItemMoveUp.Enabled    = _controller.CanOperateOnSelection(Predicates.MoveNodeUpPred);
            _menuItemMoveDown.Enabled  = _controller.CanOperateOnSelection(Predicates.MoveNodeDownPred);
            _menuItemCut.Enabled       = _buttonCut.Enabled;
            _menuItemCopy.Enabled      = _buttonCopy.Enabled;
            _menuItemPaste.Enabled     = _buttonPaste.Enabled;
            _menuItemFind.Enabled      = _controller.CanOperateOnSelection(Predicates.SearchNodePred);
            _menuItemRefresh.Enabled   = _buttonRefresh.Enabled;
            _menuItemFindNext.Enabled  = _searchState != null;
        }