How to remove views from Windows-->Show View list?

南笙酒味 提交于 2019-11-28 12:37:12

问题


I have view which I am setting permanently on my perspective. This view can not be closed and can not be opened from Windows --> show views

I struct to remove View from Windows --> view list.

How would I achieve this?

I tried your solution it is doing the things but it is also removing the view from perspective. Below are the steps I followed..

I have added the following view in plugin.XML

<view
     allowMultiple="false"
     category="org.view.ui.IDECategory"
     class="org.view.ui.BannerInformationView"    
     id="org.view.ui.BannerInformationView"
     name="BannerInfo"
     restorable="true">
</view>

After this I have added this view in my Perspective

public void defineLayout( IPageLayout layout )
    {
        layout.setEditorAreaVisible( true );
        layout.addStandaloneView( BANNER_INFO_VIEW_ID, false, IPageLayout.TOP, 0.03f, layout.getEditorArea() );
        IViewLayout viewLayout = layout.getViewLayout( BANNER_INFO_VIEW_ID );
        viewLayout.setMoveable( false );
    }

Now I have added the activity to hide my view name from show view menu

<extension point="org.eclipse.ui.activities">
     <activity
           id="activity.ide"
           name="ide">
     </activity>
     <activityPatternBinding
           activityId="activity.ide"
           isEqualityPattern="true"
           pattern="org.view.ui.IDECategory.pluginid/org.view.ui.BannerInformationView">
     </activityPatternBinding>
  </extension>

Now my problem is, along with hiding the view entry from window -> show view, it is also hiding the view from my perspective.

I want to hide the only entry from show view so that user can not do anything with it, but it should be always visible in my perspective.


回答1:


The view list is filtered by the activities list. So you can define an activity to suppress the view:

<extension point="org.eclipse.ui.activities">  
  <activity id="activity.id" name="Name">
  </activity>
  <activityPatternBinding
     activityId="activity.id"
     isEqualityPattern="true"
     pattern="plugin.id/view.id">
  </activityPatternBinding>
 </extension>

Note: The pattern value is 'contributing plugin id / view id', a common mistake is leaving out the plugin id.



来源:https://stackoverflow.com/questions/22681622/how-to-remove-views-from-windows-show-view-list

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