Example #1
0
        /// <summary>
        ///     Determines of the tree tool is enabled for the specified selection of items.
        /// </summary>
        /// <param name="selection">The selection.</param>
        /// <returns>
        ///     Returns bitwise flag combination of the <see cref="mmToolState" /> to specify if enabled.
        /// </returns>
        protected virtual int InternalEnabled(IMMTreeViewSelection selection)
        {
            if (selection == null)
            {
                return(0);
            }

            if (selection.Count != 1)
            {
                return(0);
            }

            selection.Reset();
            IMMPxNode node = (IMMPxNode)selection.Next;
            IMMPxTask task = ((IMMPxNode3)node).GetTaskByName(this.Name);

            if (task == null)
            {
                return(0);
            }

            if (task.get_Enabled(node))
            {
                return(3);
            }

            return(0);
        }
Example #2
0
        /// <summary>
        ///     Executes the tree tool within error handling.
        /// </summary>
        /// <param name="selection">The selection.</param>
        protected virtual void InternalExecute(IMMTreeViewSelection selection)
        {
            // Only enable if 1 item is selected.
            if (selection == null || selection.Count != 1)
            {
                return;
            }

            // Execute the Task for the specified node.
            selection.Reset();
            IMMPxNode node = (IMMPxNode)selection.Next;
            IMMPxTask task = ((IMMPxNode3)node).GetTaskByName(this.Name);

            if (task == null)
            {
                return;
            }

            task.Execute(node);
        }