在FileNodes/DependentFileNodes上启用粘贴命令 [英] Enabling Paste Command on FileNodes/DependentFileNodes

查看:53
本文介绍了在FileNodes/DependentFileNodes上启用粘贴命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的filenode上启用我的粘贴命令.仅当我在vsct文件中的自己的CommandGroup中执行Commandplacement时,该参数才可见.

我将projectnode中的allowpastecommand值设置为true.甚至所有QueryStatusCommandOnNode都被设置为Supported | Supported.已启用.我可以像这样控制所有其他命令,例如复制,重命名,删除,但不能控制粘贴命令.我可以控制的奇怪 粘贴命令放在我自己的组中,但未在标准vsstd97中显示.

我什至试图像这样放置一个新的命令.

< CommandPlacement guid ="guidVSStd97"; id ="cmdidPaste";优先级="0x0160&">
    < Parent guid =" guidSHLMainMenu" id ="IDM_VS_CTXT_ITEMNODE" />
</CommandPlacement>

我想念东西或遇到同样的问题吗?

最好的问候

解决方案

Hi TobiasSt,

根据您的描述,我创建了一个演示,看来还可以.如下所示的vsct文件供您参考.

<?xml version ="1.0" encoding ="utf-8"?
< CommandTable xmlns ="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs ="http://www.w3.org/2001/XMLSchema"

  <!-这是定义命令实际布局和类型的文件.
        它分为不同的部分(例如,命令定义,命令
        放置...),每个定义了一组特定的属性.
        有关各部分的更多详细信息,请参见每节之前的评论.
        用它. ->

  <!-VSCT编译器(将该文件转换为二进制文件的工具
        VisualStudio将使用的格式)具有运行预处理器的能力
        在vsct文件上;该预处理器(通常)是C ++预处理器,因此
        可以使用相同的语法定义包含和宏
        在C ++文件中.在这里使用编译器的这种功能,我们包含了一些文件
        定义一些我们将在文件内部使用的常量. ->

  <!-这是为VisualStudio公开的所有命令定义ID的文件. ->
  < Extern href ="stdidcmd.h"/>

  < ;!-此标头包含Shell提供的菜单的命令ID. ->
  < Extern href ="vsshlids.h"/>

  <!-命令"部分是定义命令,菜单和菜单组的位置.
      本节使用Guid来标识提供其中定义的命令的软件包. ->
  < Commands package =" guidToolbarButtonPackage">
    <!-在此部分中,我们有不同的子部分:一个用于菜单,另一个用于菜单
    对于菜单组,一个用于按钮(实际命令),一个用于组合
    最后一个用于所使用的位图.每个元素都由一个命令ID标识,该命令ID
    是唯一的guid和数字标识符对;标识符的引导部分通常是
    称为命令集";并用于在逻辑相关的内部将不同的命令分组
    团体;您的软件包应定义自己的命令集,以免发生冲突
    带有其他软件包定义的命令ID. ->

    <!-在此部分中,您可以定义新的菜单组.菜单组是用于
         其他菜单或按钮(命令);从视觉上看,您可以看到
         组是包含在两行之间的菜单的一部分.小组的父母
         必须是菜单. ->
    <组>
      <!-< Group guid =" guidToolbarButtonPackageCmdSet" id ="SolutionToolbarGroup"优先级="0xF000"
        -> !!-<父guid =" guidSHLMainMenu" id =" IDM_VS_TOOL_PROJWIN"/>-><!-
        -> !!-<父guid =" guidSHLMainMenu" id =" IDM_VS_CTXT_SOLNNODE"/>-><!-
        < Parent guid =" guidSHLMainMenu" id ="IDM_VS_CTXT_ITEMNODE" />
      </Group>
      < Group guid =" guidToolbarButtonPackageCmdSet" id ="MyMenuGroup"优先级="0x0600&"
        < Parent guid =" guidSHLMainMenu" id ="IDM_VS_MENU_TOOLS"/>
      </Group>->

      < Group guid =" guidToolbarButtonPackageCmdSet" id ="MyMenuGroup"优先级="0x0600&"
        < Parent guid =" guidSHLMainMenu" id ="IDM_VS_CTXT_ITEMNODE"/>
      </Group>
    </Groups>

    <!-按钮"部分. ->
    < ;!-此部分定义了用户可以与之交互的元素,例如菜单命令或按钮
        或工具栏中的组合框. ->
    <按钮>
      <!-要定义菜单组,您必须指定其ID,父菜单及其显示优先级.
          该命令是可见的,并且默认情况下处于启用状态.如果您需要更改可见性,状态等,可以使用
          CommandFlag节点.
          您可以添加多个CommandFlag节点,例如:
              < CommandFlag> DefaultInvisible</CommandFlag>
              < CommandFlag>动态可见性</CommandFlag>
          如果您不希望在命令旁边放置图像,请删除图标"节点/> ->
      <!-< Button guid =" guidToolbarButtonPackageCmdSet" id =" ToolbarButtonId"优先级="0x0100&"; type ="Button"
        <父guid =" guidToolbarButtonPackageCmdSet" id ="SolutionToolbarGroup" />
        < Icon guid =" guidImages" id ="bmpPicStrikethrough"; />
        <字符串>
          < ButtonText>调用工具栏按钮</ButtonText>
        </字符串>
      </Button>->
      < Button guid =" guidToolbarButtonPackageCmdSet" id ="TestStatusBarCommandId";优先级="0x0100&"; type ="Button"
        <父guid =" guidToolbarButtonPackageCmdSet" id ="MyMenuGroup" />
        < Icon guid =" guidImages" id ="bmpPic1" />
        <字符串>
          < ButtonText>粘贴</ButtonText>
        </字符串>
      </按钮>


   
    </按钮>

    <!-位图部分用于定义用于命令的位图.
    <位图>
      <!-位图ID的定义方式与其他方式略有不同:
            声明以位图条的guid开头,然后是
            包含位图的位图带,然后是所使用元素的数字标识
            在按钮定义中.该声明的一个重要方面是元素id
            必须是位图条中位图的实际索引(从1开始). ->
      < Bitmap guid =" guidImages" href =" Resources \ ToolbarButton.png" usedList ="bmpPic1,bmpPic2,bmpPicSearch,bmpPicX,bmpPicArrows,bmpPicStrikethrough".
    </位图>
  </命令>

  <符号>
    <!-这是程序包guid. ->
    < GuidSymbol name =" guidToolbarButtonPackage"值="{ad3f2e05-1f78-49b7-aa8e-93002abdb6f2}" />
    < GuidSymbol name =" guidToolbarButtonPackageCmdSet"值="{50072ebc-3e5b-4c23-8ab2-ce31f46b3f74}"
      < IDSymbol name =" MyMenuGroup"值="0x1020" />
      < IDSymbol name =" TestStatusBarCommandId"值="0x0100&"; />
    </GuidSymbol>

    < GuidSymbol name =" guidImages"值="{b3a4d6f8-c062-4065-abb6-6efa0fc9e5b8}" >
      < IDSymbol name ="bmpPic1"值="1" />
      < IDSymbol name ="bmpPic2".值="2" />
      < IDSymbol name =" bmpPicSearch"值="3" />
      < IDSymbol name ="bmpPicX";值="4" />
      < IDSymbol name ="bmpPicArrows";值="5" />
      < IDSymbol name ="bmpPicStrikethrough";值="6" />
    </GuidSymbol>
  </符号>
</CommandTable>

最诚挚的问候,

吴可乐


Hi,

I am trying to enabling my paste command on my filenode. It's only visible if I do a Commandplacement in my own CommandGroup in the vsct file.

I set the allowpastecommand value in my projectnode to true. And even all QueryStatusCommandOnNode are set to Supported | Enabled. I can control all other commands like copy, rename, delete like this but not the paste command. Its strange that I can control the the paste command when it is placed in my own group but is not showed in the standard vsstd97. 

I even tried to make a new command placement like this.

<CommandPlacement guid="guidVSStd97" id="cmdidPaste" priority="0x0160">
     <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE" />
</CommandPlacement>

Do I miss something or had anybody the same problem?

Best Regards

解决方案

Hi TobiasSt,

Based on your description, I create a demo, it seems ok. the vsct file as below for your reference.

<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!--  This is the file that defines the actual layout and type of the commands.
        It is divided in different sections (e.g. command definition, command
        placement, ...), with each defining a specific set of properties.
        See the comment before each section for more details about how to
        use it. -->

  <!--  The VSCT compiler (the tool that translates this file into the binary
        format that VisualStudio will consume) has the ability to run a preprocessor
        on the vsct file; this preprocessor is (usually) the C++ preprocessor, so
        it is possible to define includes and macros with the same syntax used
        in C++ files. Using this ability of the compiler here, we include some files
        defining some of the constants that we will use inside the file. -->

  <!--This is the file that defines the IDs for all the commands exposed by VisualStudio. -->
  <Extern href="stdidcmd.h"/>

  <!--This header contains the command ids for the menus provided by the shell. -->
  <Extern href="vsshlids.h"/>

  <!--The Commands section is where commands, menus, and menu groups are defined.
      This section uses a Guid to identify the package that provides the command defined inside it. -->
  <Commands package="guidToolbarButtonPackage">
    <!-- Inside this section we have different sub-sections: one for the menus, another
    for the menu groups, one for the buttons (the actual commands), one for the combos
    and the last one for the bitmaps used. Each element is identified by a command id that
    is a unique pair of guid and numeric identifier; the guid part of the identifier is usually
    called "command set" and is used to group different command inside a logically related
    group; your package should define its own command set in order to avoid collisions
    with command ids defined by other packages. -->

    <!-- In this section you can define new menu groups. A menu group is a container for
         other menus or buttons (commands); from a visual point of view you can see the
         group as the part of a menu contained between two lines. The parent of a group
         must be a menu. -->
    <Groups>
      <!--<Group guid="guidToolbarButtonPackageCmdSet" id="SolutionToolbarGroup" priority="0xF000">
        --><!--<Parent guid="guidSHLMainMenu" id="IDM_VS_TOOL_PROJWIN"/>--><!--
        --><!--<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_SOLNNODE"/>--><!--
        <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE" />
      </Group>
      <Group guid="guidToolbarButtonPackageCmdSet" id="MyMenuGroup" priority="0x0600">
        <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
      </Group>-->

      <Group guid="guidToolbarButtonPackageCmdSet" id="MyMenuGroup" priority="0x0600">
        <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE"/>
      </Group>
    </Groups>

    <!--Buttons section. -->
    <!--This section defines the elements the user can interact with, like a menu command or a button
        or combo box in a toolbar. -->
    <Buttons>
      <!--To define a menu group you have to specify its ID, the parent menu and its display priority.
          The command is visible and enabled by default. If you need to change the visibility, status, etc, you can use
          the CommandFlag node.
          You can add more than one CommandFlag node e.g.:
              <CommandFlag>DefaultInvisible</CommandFlag>
              <CommandFlag>DynamicVisibility</CommandFlag>
          If you do not want an image next to your command, remove the Icon node /> -->
      <!--<Button guid="guidToolbarButtonPackageCmdSet" id="ToolbarButtonId" priority="0x0100" type="Button">
        <Parent guid="guidToolbarButtonPackageCmdSet" id="SolutionToolbarGroup" />
        <Icon guid="guidImages" id="bmpPicStrikethrough" />
        <Strings>
          <ButtonText>Invoke ToolbarButton</ButtonText>
        </Strings>
      </Button>-->
      <Button guid="guidToolbarButtonPackageCmdSet" id="TestStatusBarCommandId" priority="0x0100" type="Button">
        <Parent guid="guidToolbarButtonPackageCmdSet" id="MyMenuGroup" />
        <Icon guid="guidImages" id="bmpPic1" />
        <Strings>
          <ButtonText>Paste</ButtonText>
        </Strings>
      </Button>


   
    </Buttons>

    <!--The bitmaps section is used to define the bitmaps that are used for the commands.-->
    <Bitmaps>
      <!--  The bitmap id is defined in a way that is a little bit different from the others:
            the declaration starts with a guid for the bitmap strip, then there is the resource id of the
            bitmap strip containing the bitmaps and then there are the numeric ids of the elements used
            inside a button definition. An important aspect of this declaration is that the element id
            must be the actual index (1-based) of the bitmap inside the bitmap strip. -->
      <Bitmap guid="guidImages" href="Resources\ToolbarButton.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough"/>
    </Bitmaps>
  </Commands>

  <Symbols>
    <!-- This is the package guid. -->
    <GuidSymbol name="guidToolbarButtonPackage" value="{ad3f2e05-1f78-49b7-aa8e-93002abdb6f2}" />
    <GuidSymbol name="guidToolbarButtonPackageCmdSet" value="{50072ebc-3e5b-4c23-8ab2-ce31f46b3f74}">
      <IDSymbol name="MyMenuGroup" value="0x1020" />
      <IDSymbol name="TestStatusBarCommandId" value="0x0100" />
    </GuidSymbol>

    <GuidSymbol name="guidImages" value="{b3a4d6f8-c062-4065-abb6-6efa0fc9e5b8}" >
      <IDSymbol name="bmpPic1" value="1" />
      <IDSymbol name="bmpPic2" value="2" />
      <IDSymbol name="bmpPicSearch" value="3" />
      <IDSymbol name="bmpPicX" value="4" />
      <IDSymbol name="bmpPicArrows" value="5" />
      <IDSymbol name="bmpPicStrikethrough" value="6" />
    </GuidSymbol>
  </Symbols>
</CommandTable>

Best regards,

Cole Wu


这篇关于在FileNodes/DependentFileNodes上启用粘贴命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆