How to show a view programmably in a position defined in plugin.xml?

此生再无相见时 提交于 2019-12-10 23:48:49

问题


I want to show views (multiple) in my plugin source code using:

showView(id, id2, IWorkbenchPage.VIEW_ACTIVATE)

This view is first closed, shown after my proccess completed.

I defined the view and its positon in plugin.xml as below:

        name="..."
        icon="..."
        category="..."
        class="..."
        allowMultiple="true"            
        id="myid"

extension

point="org.eclipse.ui.perspectiveExtensions"
  perspectiveExtension
        targetID="org.eclipse.jdt.ui.JavaPerspective"  

view

       ratio="0.5"
       relative="org.eclipse.ui.views.ContentOutline"
       relationship="stack"
       visible="false"
       id="myid"

I want to show them top right area of perspective (the same as Outline view).

If I set visible true or open my view manually in GUI, it appears top right as I expected, but when I use "showView()" above, views always appears at the bottom (console, problems, etc.)

How can I show my views always top right programmably?


回答1:


You need to add placeholders for the rest of your views, that have a secondary ID. Another entry in your perspectiveExtension with a compound ID and a wildcard should work: myid:*. See IPageLayout javadoc for more information.



来源:https://stackoverflow.com/questions/8500678/how-to-show-a-view-programmably-in-a-position-defined-in-plugin-xml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!