You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Eclipse插件:测试Subversion资源名称需用什么属性?

解决Subclipse RepositoriesView右键菜单按项目名称过滤的问题

在Subclipse的RepositoriesView中,右键菜单的选中对象并非本地工作空间的IProject(除非项目已导入),而是Subclipse自身的SVN资源类型,所以你之前的本地项目适配逻辑无法生效。以下是正确的配置方案:

基础配置(适配所有SVN资源)

针对RepositoriesView中的远程/本地SVN资源,使用Subclipse核心接口ISVNResource进行适配,搭配对应的名称属性测试:

<command...
    <visibleWhen>
       <with variable="activeMenuSelection">
         <iterate ifEmpty="false">
            <adapt type="org.tigris.subversion.subclipse.core.ISVNResource">
                <test property="org.tigris.subversion.subclipse.core.name" value="Test_*"/>
            </adapt>
         </iterate>
       </with>
    </visibleWhen>
</command>

兼容本地+远程资源的配置

如果需要同时支持已导入本地工作空间的SVN项目和远程未导入的SVN资源,可以用<or>标签组合两种适配逻辑:

<command...
    <visibleWhen>
       <with variable="activeMenuSelection">
         <iterate ifEmpty="false">
            <or>
                <!-- 匹配已导入本地工作空间的SVN项目 -->
                <adapt type="org.eclipse.core.resources.IProject">
                    <test property="org.eclipse.core.resources.name" value="Test_*"/>
                </adapt>
                <!-- 匹配RepositoriesView中的远程SVN资源 -->
                <adapt type="org.tigris.subversion.subclipse.core.ISVNResource">
                    <test property="org.tigris.subversion.subclipse.core.name" value="Test_*"/>
                </adapt>
            </or>
         </iterate>
       </with>
    </visibleWhen>
</command>

关键注意事项

  • 确保你的插件已添加对org.tigris.subversion.subclipse.core插件的依赖,否则无法识别ISVNResource接口和对应的属性。
  • org.tigris.subversion.subclipse.core.name属性直接对应SVN资源的getName()方法返回值,支持通配符匹配(如Test_*)。

内容的提问来源于stack exchange,提问作者AnnHa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 01:01:20