Prasad S Deshpande
Prasad S Deshpande

Reputation: 1412

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

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.

Upvotes: 0

Views: 1206

Answers (1)

greg-449
greg-449

Reputation: 111142

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.

Upvotes: 3

Related Questions