Пример #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);
        }
Пример #2
0
 /// <summary>
 ///     Executes the specified tree tool using the selected items.
 /// </summary>
 /// <param name="pSelection">The selection.</param>
 public void Execute(IMMTreeViewSelection pSelection)
 {
     try
     {
         this.InternalExecute(pSelection);
     }
     catch (Exception e)
     {
         Log.Error("Error Executing Tree Tool " + this.Name, e);
     }
 }
Пример #3
0
        /// <summary>
        ///     Returns <c>true</c> if the tool should be enabled for the specified selection of items.
        /// </summary>
        /// <param name="pSelection">The selection.</param>
        /// <returns>
        ///     <c>true</c> if the tool should be enabled; otherwise <c>false</c>
        /// </returns>
        public int get_Enabled(IMMTreeViewSelection pSelection)
        {
            try
            {
                return(this.InternalEnabled(pSelection));
            }
            catch (Exception e)
            {
                Log.Error("Error Enabling Tree Tool " + this.Name, e);
            }

            return(0);
        }
Пример #4
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);
        }