//		private NodeIdMapper nodeMapper;

/*		private NodeIdMapper NodeMapper
 *              {
 *                      get
 *                      {
 *                              if (nodeMapper == null)
 *                                      nodeMapper = new NodeIdMapper(DataViewHierarchyAccessor);
 *                              return nodeMapper;
 *                      }
 *              }*/

        /// <summary>
        /// This method supplies information about a command's status. At this point all
        /// commands are supported and visible.
        /// </summary>
        /// <param name="itemIds">
        /// Array of identifiers for the items in the data view hierarchy on which this
        /// command should be invoked.
        /// </param>
        /// <param name="command">
        /// The OleCommand object representing the command to invoke.
        /// </param>
        /// <param name="textType">
        /// The OleCommandTextType object instance for the specified command.
        /// </param>
        /// <param name="status">
        /// The OleCommandStatus object instance for the specified command.
        /// </param>
        /// <returns>
        /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. ///
        /// </returns>
        public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command,
                                                          OleCommandTextType textType, OleCommandStatus status)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }
            if (status == null)
            {
                throw new ArgumentNullException("status");
            }

            OleCommandStatus result = new OleCommandStatus();

/*			string[] selTypes = DataViewHierarchyAccessor.GetChildSelectionTypes(itemIds[0]);
 *                      string type = DataViewHierarchyAccessor.GetObjectType(itemIds[0]);
 *                      string[] staticNodes = DataViewHierarchyAccessor.GetChildStaticNodeIds(itemIds[0]);
 *                      string path = DataViewHierarchyAccessor.GetNodePath(itemIds[0]);
 *                      object[] identifier = DataViewHierarchyAccessor.GetObjectIdentifier(itemIds[0]);
 *
 *                      object v1 = DataViewHierarchyAccessor.GetProperty(itemIds[0], (int)__VSHPROPID.VSHPROPID_IsHiddenItem);
 *                      object v2 = DataViewHierarchyAccessor.GetProperty(itemIds[0], (int)__VSHPROPID.VSHPROPID_Parent);
 */

            //BaseNode node = NodeMapper[itemIds[0]];

            result.Enabled   = true;
            result.Visible   = true;
            result.Supported = true;
            return(result);

/*            // Get command handler instance
 *          ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId);
 *          if (commandHandler == null)
 *              return base.GetCommandStatus(itemIds, command, textType, status);
 *          result.Supported = true;
 *
 *          // Determine visibility
 *          if (!commandHandler.GetIsVisible(Hierarchy, itemIds))
 *          {
 *              result.Visible = false;
 *              return result;
 *          }
 *          result.Visible = true;
 *          result.Enabled = true;
 *
 *          // TODO: Find out why this doesn't work at all!
 *          // Localize text if possible
 *          string localizedText = commandHandler.GetText(Hierarchy, itemIds);
 *          if (!String.IsNullOrEmpty(localizedText))
 *              result.Text = localizedText;
 *
 *          return result;*/
        }
    //		private NodeIdMapper nodeMapper;

    /*		private NodeIdMapper NodeMapper
        {
          get
          {
            if (nodeMapper == null)
              nodeMapper = new NodeIdMapper(DataViewHierarchyAccessor);
            return nodeMapper;
          }
        }*/

    /// <summary>
    /// This method supplies information about a command's status. At this point all 
    /// commands are supported and visible.
    /// </summary>
    /// <param name="itemIds">
    /// Array of identifiers for the items in the data view hierarchy on which this 
    /// command should be invoked.
    /// </param>
    /// <param name="command">
    /// The OleCommand object representing the command to invoke.
    /// </param>
    /// <param name="textType">
    /// The OleCommandTextType object instance for the specified command.
    /// </param>
    /// <param name="status">
    /// The OleCommandStatus object instance for the specified command.
    /// </param>
    /// <returns>
    /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. /// 
    /// </returns>        
    public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command,
        OleCommandTextType textType, OleCommandStatus status)
    {
      if (command == null)
        throw new ArgumentNullException("command");
      if (status == null)
        throw new ArgumentNullException("status");

      OleCommandStatus result = new OleCommandStatus();

      /*			string[] selTypes = DataViewHierarchyAccessor.GetChildSelectionTypes(itemIds[0]);
            string type = DataViewHierarchyAccessor.GetObjectType(itemIds[0]);
            string[] staticNodes = DataViewHierarchyAccessor.GetChildStaticNodeIds(itemIds[0]);
            string path = DataViewHierarchyAccessor.GetNodePath(itemIds[0]);
            object[] identifier = DataViewHierarchyAccessor.GetObjectIdentifier(itemIds[0]);

            object v1 = DataViewHierarchyAccessor.GetProperty(itemIds[0], (int)__VSHPROPID.VSHPROPID_IsHiddenItem);
            object v2 = DataViewHierarchyAccessor.GetProperty(itemIds[0], (int)__VSHPROPID.VSHPROPID_Parent);
      */

      //BaseNode node = NodeMapper[itemIds[0]];

      result.Enabled = true;
      result.Visible = true;
      result.Supported = true;

      if (command.CommandId == PkgCmdIDList.cmdDebugProcedure)
        result.Visible = DataViewHierarchyAccessor.GetNodeId(itemIds[0]).Equals("StoredProcedure", StringComparison.OrdinalIgnoreCase);

      return result;
      /*            // Get command handler instance
                  ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId);
                  if (commandHandler == null)
                      return base.GetCommandStatus(itemIds, command, textType, status);
                  result.Supported = true;

                  // Determine visibility
                  if (!commandHandler.GetIsVisible(Hierarchy, itemIds))
                  {
                      result.Visible = false;
                      return result;
                  }
                  result.Visible = true;
                  result.Enabled = true;

                  // TODO: Find out why this doesn't work at all!
                  // Localize text if possible
                  string localizedText = commandHandler.GetText(Hierarchy, itemIds);
                  if (!String.IsNullOrEmpty(localizedText))
                      result.Text = localizedText;
            
                  return result;*/
    }
Пример #3
0
    public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status)
    {
      if (command.GroupGuid == guidSQLiteCmdSet)
      {
        switch ((cmdid)command.CommandId)
        {
          case cmdid.CreateTable:
          case cmdid.Vacuum:
          case cmdid.Rekey:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = true;
            return status;
        }
      }
      else if (command.GroupGuid == VSConstants.GUID_VSStandardCommandSet97)
      {
        switch ((VSConstants.VSStd97CmdID)command.CommandId)
        {
          case VSConstants.VSStd97CmdID.Delete:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = (SystemTableSelected == false && SystemIndexSelected == false);
            return status;
        }
      }
      else if (command.GroupGuid == guidDataCmdSet)
      {
        switch ((cmdid)command.CommandId)
        {
          case cmdid.Alter:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = (SystemTableSelected == false && SystemIndexSelected == false);
            return status;
          case cmdid.CreateTable:
          case cmdid.CreateView:
            status.Supported = true;
            status.Visible = true;
            status.Enabled = true;
            return status;
        }
      }
      base.GetCommandStatus(itemIds, command, textType, status);

      return status;
    }
Пример #4
0
        /// <summary>
        /// This method supplies information about a command's status. At this point all
        /// commands are supported and visible.
        /// </summary>
        /// <param name="itemIds">
        /// Array of identifiers for the items in the data view hierarchy on which this
        /// command should be invoked.
        /// </param>
        /// <param name="command">
        /// The OleCommand object representing the command to invoke.
        /// </param>
        /// <param name="textType">
        /// The OleCommandTextType object instance for the specified command.
        /// </param>
        /// <param name="status">
        /// The OleCommandStatus object instance for the specified command.
        /// </param>
        /// <returns>
        /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. ///
        /// </returns>
        public override OleCommandStatus GetCommandStatus(
            int[] itemIds,
            OleCommand command,
            OleCommandTextType textType,
            OleCommandStatus status)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }
            if (status == null)
            {
                throw new ArgumentNullException("status");
            }

            OleCommandStatus result = new OleCommandStatus();

            // Get command handler instance
            ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId);

            if (commandHandler == null)
            {
                return(base.GetCommandStatus(itemIds, command, textType, status));
            }
            result.Supported = true;

            // Determine visibility
            if (!commandHandler.GetIsVisible(Hierarchy, itemIds))
            {
                result.Visible = false;
                return(result);
            }
            result.Visible = true;
            result.Enabled = true;

            // TODO: Find out why this doesn't work at all!
            // Localize text if possible
            string localizedText = commandHandler.GetText(Hierarchy, itemIds);

            if (!String.IsNullOrEmpty(localizedText))
            {
                result.Text = localizedText;
            }

            return(result);
        }
Пример #5
0
        /// <summary>
        /// This method supplies information about a command's status. At this point all 
        /// commands are supported and visible.
        /// </summary>
        /// <param name="itemIds">
        /// Array of identifiers for the items in the data view hierarchy on which this 
        /// command should be invoked.
        /// </param>
        /// <param name="command">
        /// The OleCommand object representing the command to invoke.
        /// </param>
        /// <param name="textType">
        /// The OleCommandTextType object instance for the specified command.
        /// </param>
        /// <param name="status">
        /// The OleCommandStatus object instance for the specified command.
        /// </param>
        /// <returns>
        /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. /// 
        /// </returns>        
        public override OleCommandStatus GetCommandStatus(
            int[] itemIds,
            OleCommand command,
            OleCommandTextType textType,
            OleCommandStatus status)
        {
            if (command == null)
                throw new ArgumentNullException("command");
            if (status == null)
                throw new ArgumentNullException("status");

            OleCommandStatus result = new OleCommandStatus();

            // Get command handler instance
            ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId);
            if (commandHandler == null)
                return base.GetCommandStatus(itemIds, command, textType, status);
            result.Supported = true;

            // Determine visibility
            if (!commandHandler.GetIsVisible(Hierarchy, itemIds))
            {
                result.Visible = false;
                return result;
            }
            result.Visible = true;
            result.Enabled = true;

            // TODO: Find out why this doesn't work at all!
            // Localize text if possible
            string localizedText = commandHandler.GetText(Hierarchy, itemIds);
            if (!String.IsNullOrEmpty(localizedText))
                result.Text = localizedText;
            
            return result;
        }
Пример #6
0
        public override OleCommandStatus GetCommandStatus(int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status)
        {
            if (command.GroupGuid == guidSQLiteCmdSet)
            {
                switch ((cmdid)command.CommandId)
                {
                case cmdid.CreateTable:
                case cmdid.Vacuum:
                case cmdid.Rekey:
                    status.Supported = true;
                    status.Visible   = true;
                    status.Enabled   = true;
                    return(status);
                }
            }
            else if (command.GroupGuid == VSConstants.GUID_VSStandardCommandSet97)
            {
                switch ((VSConstants.VSStd97CmdID)command.CommandId)
                {
                case VSConstants.VSStd97CmdID.Delete:
                    status.Supported = true;
                    status.Visible   = true;
                    status.Enabled   = (SystemTableSelected == false && SystemIndexSelected == false);
                    return(status);
                }
            }
            else if (command.GroupGuid == guidDataCmdSet)
            {
                switch ((cmdid)command.CommandId)
                {
                case cmdid.Alter:
                    status.Supported = true;
                    status.Visible   = true;
                    status.Enabled   = (SystemTableSelected == false && SystemIndexSelected == false);
                    return(status);

                case cmdid.CreateTable:
                case cmdid.CreateView:
                    status.Supported = true;
                    status.Visible   = true;
                    status.Enabled   = true;
                    return(status);
                }
            }
            base.GetCommandStatus(itemIds, command, textType, status);

            return(status);
        }