我有一个包含两个视图的插件。目前,如果我想添加视图,我将转到Window - >显示视图 - >其他
问题是,两个视图显示在单独的文件夹下(ImageView和MemoryView)。如何让它们显示在同一文件夹下?
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.views">
<category
name="ImageView"
id="ImageView">
</category>
<view
name="ImageView"
icon="icons/sample.gif"
category="ImageView"
class="imageplugin.views.ImageView"
id="imageplugin.views.ImageView">
</view>
</extension>
<extension
point="org.eclipse.ui.views">
<category
name="MemoryView"
id="MemoryView">
</category>
<view
name="MemoryView"
icon="icons/sample.gif"
category="MemoryView"
class="imageplugin.views.MemoryView"
id="imageplugin.views.MemoryView">
</view>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.jdt.ui.JavaPerspective">
<view
ratio="0.5"
relative="org.eclipse.ui.views.ProblemView"
relationship="right"
id="imageplugin.views.ImageView">
</view>
<view
ratio="0.5"
relative="org.eclipse.ui.views.ProblemView"
relationship="right"
id="imageplugin.views.MemoryView">
</view>
</perspectiveExtension>
</extension>
<extension
point="org.eclipse.help.contexts">
<contexts
file="contexts.xml">
</contexts>
</extension>
</plugin>
答案 0 :(得分:3)
您的视图org.eclipse.ui.views
定义通过定义两个不同的category
条目,要求视图位于不同的类别中。只需为两个视图使用单个类别将它们一起显示,您就没有为每个视图定义单独的类别:
<extension
point="org.eclipse.ui.views">
<category
name="My Category"
id="my.view.category">
</category>
<view
name="ImageView"
icon="icons/sample.gif"
category="my.view.category"
class="imageplugin.views.ImageView"
id="imageplugin.views.ImageView">
</view>
<view
name="MemoryView"
icon="icons/sample.gif"
category="my.view.category"
class="imageplugin.views.MemoryView"
id="imageplugin.views.MemoryView">
</view>
</extension>