简体   繁体   English

使用plugin.xml中的visibleWhen限制插件中命令的可见性

[英]Limiting visibility of a command in a plugin using visibleWhen in plugin.xml

I am developing a plugin which its command will be displayed only at certain packages which are under a specific package foo.com.network.svc . 我正在开发一个插件,其命令将仅在特定软件包foo.com.network.svc下的某些软件包中显示。 I found visibleWhen keyword. 我发现visibleWhen关键字。 But I could not use it very well. 但是我不能很好地使用它。 Thanks in advance. 提前致谢。

Yes, after a series of trial and error efforts, I managed to limit visibility of the plugin which adds a command on right click at package explorer. 是的,经过一系列的尝试和错误尝试,我设法限制了插件的可见性,这在右键单击包资源管理器时添加了一个命令。 Limit is to show command only in a package fragment under specific path. 限制是仅在特定路径下的程序包片段中显示命令。 Below is some part of my plugin.xml that affects visibility. 以下是我的plugin.xml的一部分,会影响可见性。

<visibleWhen>

<iterate>enter <adapt type="org.eclipse.core.resources.IResource"> <test property="org.eclipse.core.resources.path"
value="/foo/com/bar/svc/*"/> <not> <test property="org.eclipse.core.resources.path" value="/foo/com/bar/svc/*/*"/> </not> </adapt> </iterate> </visibleWhen>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM