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

时间:2022-09-08 23:06:46

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 . I found visibleWhen keyword. But I could not use it very well. Thanks in advance.

我正在开发一个插件,它的命令只会显示在特定包foo.com.network.svc下的某些包中。我发现visibleWhen是关键字。但我不能很好地使用它。提前致谢。

1 个解决方案

#1


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>

输入 < / visibleWhen>

#1


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>

输入 < / visibleWhen>