You can add / remove any view from the "Show View" menu on the "Set Perspective / Menu" tab:

To do the same programmatically, one would have to follow the same course of action than the org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog class, and also learn the okPressed() method, for example:
perspective.setShowViewActionIds(menu.getCheckedItemIds());
Vlad Ilie mentions in the comments :
since I only needed View be completely inaccessible using the normal graphical interface, there was enough for me to follow this blog post " eEclipse Activities - Hide / Show Certain Elements of the User Interface ":
This would mean that the WorkbenchActivitySupport.setEnabledActivityIds(String[]) programmatic method can be used to enable or disable views after they have been put in place.
source share