Eclipse Platform Release 3.7

## org.eclipse.ui.part
Class PageSite

    java.lang.Object
      org.eclipse.ui.part.PageSite

All Implemented Interfaces:
  IAdaptable, IShellProvider, org.eclipse.ui.internal.services.INestable, IWorkbenchSite, IPageSite, IServiceLocator

    public class PageSite

extends Object
implements IPageSite, org.eclipse.ui.internal.services.INestable

This implementation of `IPageSite` provides a site for a page within a `PageBookView`. Most methods are forwarded to the view's site.

Constructor Summary
`PageSite(IViewSite parentViewSite)` Creates a new sub view site of the given parent view site.

Method Summary
`void` `activate()` Notifies this service that the component within which it exists has become active.
`void` `deactivate()` Notifies this service that the component within which it exists has become inactive.
`protected void` `dispose()` Disposes of the menu extender contributions.
`IActionBars` `getActionBars()` The PageSite implementation of this `IPageSite` method returns the `SubActionBars` for this site.
`Object` `getAdapter(Class adapter)` Returns an object which is an instance of the given class associated with this object.
`IWorkbenchPage` `getPage()` Returns the page containing this workbench site.
`ISelectionProvider` `getSelectionProvider()` Returns the selection provider for this workbench site.
`Object` `getService(Class key)` Retrieves the service corresponding to the given API.
`Shell` `getShell()` Returns the current shell (or null if none).
`IWorkbenchWindow` `getWorkbenchWindow()` Returns the workbench window containing this workbench site.
`boolean` `hasService(Class key)` Whether this service exists within the scope of this service locator.
`void` `registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider)` Registers a pop-up menu with a particular id for extension.
`void` `setSelectionProvider(ISelectionProvider provider)` Sets the selection provider for this workbench site.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PageSite

    public PageSite(IViewSite parentViewSite)

  Creates a new sub view site of the given parent view site.

  Parameters:
    `parentViewSite` - the parent view site

Method Detail

### dispose

    protected void dispose()

  Disposes of the menu extender contributions.

### getActionBars

    public IActionBars getActionBars()

  The PageSite implementation of this `IPageSite` method returns the `SubActionBars` for this site.

  Specified by:
    `getActionBars` in interface `IPageSite`
  Returns:
    the subactionbars for this site

### getAdapter

    public Object getAdapter(Class adapter)

  Description copied from interface: `IAdaptable`
  Returns an object which is an instance of the given class associated with this object. Returns `null` if no such object can be found.

  Specified by:
    `getAdapter` in interface `IAdaptable`
  Parameters:
    `adapter` - the adapter class to look up
  Returns:
    a object castable to the given class, or `null` if this object does not have an adapter for the given class

### getPage

    public IWorkbenchPage getPage()

  Description copied from interface: `IWorkbenchSite`
  Returns the page containing this workbench site.

  Specified by:
    `getPage` in interface `IWorkbenchSite`
  Returns:
    the page containing this workbench site

### getSelectionProvider

    public ISelectionProvider getSelectionProvider()

  Description copied from interface: `IWorkbenchSite`
  Returns the selection provider for this workbench site.

  Specified by:
    `getSelectionProvider` in interface `IWorkbenchSite`
  Returns:
    the selection provider, or `null` if none

### getService

    public final Object getService(Class key)

  Description copied from interface: `IServiceLocator`
  Retrieves the service corresponding to the given API.

  Specified by:
    `getService` in interface `IServiceLocator`
  Parameters:
    `key` - This is the interface that the service implements. Must not be `null`.
  Returns:
    The service, or `null` if no such service could be found.

### getShell

    public Shell getShell()

  Description copied from interface: `IShellProvider`
  Returns the current shell (or null if none). This return value may change over time, and should not be cached.

  Specified by:
    `getShell` in interface `IShellProvider`
  Specified by:
    `getShell` in interface `IWorkbenchSite`
  Returns:
    the current shell or null if none

### getWorkbenchWindow

    public IWorkbenchWindow getWorkbenchWindow()

  Description copied from interface: `IWorkbenchSite`
  Returns the workbench window containing this workbench site.

  Specified by:
    `getWorkbenchWindow` in interface `IWorkbenchSite`
  Returns:
    the workbench window containing this workbench site

### hasService

    public final boolean hasService(Class key)

  Description copied from interface: `IServiceLocator`
  Whether this service exists within the scope of this service locator. This does not include looking for the service within the scope of the parents. This method can be used to determine whether a particular service supports nesting in this scope.

  Specified by:
    `hasService` in interface `IServiceLocator`
  Parameters:
    `key` - This is the interface that the service implements. Must not be `null`.
  Returns:
    `true` iff the service locator can find a service for the given API; `false` otherwise.

### registerContextMenu

    public void registerContextMenu(String menuID,
                                    MenuManager menuMgr,
                                    ISelectionProvider selProvider)

  Description copied from interface: `IPageSite`
  Registers a pop-up menu with a particular id for extension.

  Within the workbench one plug-in may extend the pop-up menus for a view or editor within another plug-in. In order to be eligible for extension, the menu must be registered by calling `registerContextMenu`. Once this has been done the workbench will automatically insert any action extensions which exist.

  A unique menu id must be provided for each registered menu. This id should be published in the Javadoc for the page.

  Any pop-up menu which is registered with the workbench should also define a `GroupMarker` in the registered menu with id `IWorkbenchActionConstants.MB_ADDITIONS`. Other plug-ins will use this group as a reference point for insertion. The marker should be defined at an appropriate location within the menu for insertion.

  Specified by:
    `registerContextMenu` in interface `IPageSite`
  Parameters:
    `menuID` - the menu id
    `menuMgr` - the menu manager
    `selProvider` - the selection provider

### setSelectionProvider

    public void setSelectionProvider(ISelectionProvider provider)

  Description copied from interface: `IWorkbenchSite`
  Sets the selection provider for this workbench site.

  Specified by:
    `setSelectionProvider` in interface `IWorkbenchSite`
  Parameters:
    `provider` - the selection provider, or `null` to clear it

### activate

    public void activate()

  Description copied from interface: `org.eclipse.ui.internal.services.INestable`
  Notifies this service that the component within which it exists has become active. The service should modify its state as appropriate.

  Specified by:
    `activate` in interface `org.eclipse.ui.internal.services.INestable`

### deactivate

    public void deactivate()

  Description copied from interface: `org.eclipse.ui.internal.services.INestable`
  Notifies this service that the component within which it exists has become inactive. The service should modify its state as appropriate.

  Specified by:
    `deactivate` in interface `org.eclipse.ui.internal.services.INestable`

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.