Package org.eclipse.ui.internal
Class PartSite
java.lang.Object
org.eclipse.ui.internal.PartSite
- All Implemented Interfaces:
- IAdaptable,- IShellProvider,- IWorkbenchPartSite,- IWorkbenchSite,- IServiceLocator
- Direct Known Subclasses:
- EditorSite,- ViewSite
PartSite is the general implementation for an
 IWorkbenchPartSite. A site maintains the context for a part,
 including the part, its pane, active contributions, selection provider, etc.
 Together, these components make up the complete behavior for a part as if it
 was implemented by one person.
 The PartSite lifecycle is as follows ..
 - a site is constructed
- a part is constructed and stored in the part
- the site calls part.init()
- a pane is constructed and stored in the site
- the action bars for a part are constructed and stored in the site
- the pane is added to a presentation
- the SWT widgets for the pane and part are created
- the site is activated, causing the actions to become visible
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ArrayList<PopupMenuExtender> protected MPartprotected org.eclipse.ui.internal.services.ServiceLocator
- 
Constructor SummaryConstructorsConstructorDescriptionPartSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref, IConfigurationElement element) Build the part site.
- 
Method SummaryModifier and TypeMethodDescriptionvoidactivateActionBars(boolean forceVisibility) voiddeactivateActionBars(boolean forceHide) voiddispose()Dispose the contributions.Returns the action bars for the part.final <T> TgetAdapter(Class<T> adapter) Get an adapter for this type.String[]Get the registered popup menu identifiersgetId()Returns the part registry extension id for this workbench site's part.protected StringReturns the key binding service in use.getModel()getPage()Returns the page containing this workbench site's part.getPart()Returns the part.Returns the part reference.Returns the unique identifier of the plug-in that defines this workbench site's part.Returns the registered name for this workbench site's part.Returns the selection provider for a part.final <T> TgetService(Class<T> key) Retrieves the service corresponding to the given API.getShell()Returns the shell containing this part.Returns the workbench window containing this part.final booleanhasService(Class<?> key) Whether this service exists within the scope of this service locator.voidregisterContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider) Register a popup menu for extension.static final voidregisterContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput, IWorkbenchPart part, IEclipseContext context, Collection<PopupMenuExtender> menuExtenders) This is a helper method for the register context menu functionality.voidregisterContextMenu(MenuManager menuMgr, ISelectionProvider selProvider) Register a popup menu with the default id for extension.voidsetActionBars(SubActionBars bars) Sets the action bars for the part.voidsetPart(IWorkbenchPart newPart) Sets the part.voidsetSelectionProvider(ISelectionProvider provider) Set the selection provider for a part.toString()Prints out the identifier, the plug-in identifier and the registered name.
- 
Field Details
- 
serviceLocatorprotected org.eclipse.ui.internal.services.ServiceLocator serviceLocator
- 
model
 
- 
Constructor Details- 
PartSitepublic PartSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref, IConfigurationElement element) Build the part site.- Parameters:
- part- the part
- ref- the part reference
 
 
- 
- 
Method Details- 
registerContextMenupublic static final void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput, IWorkbenchPart part, IEclipseContext context, Collection<PopupMenuExtender> menuExtenders) This is a helper method for the register context menu functionality. It is provided so that different implementations of theIWorkbenchPartSiteinterface don't have to worry about how context menus should work.- Parameters:
- menuId- the menu id
- menuManager- the menu manager
- selectionProvider- the selection provider
- includeEditorInput- whether editor inputs should be included in the structured selection when calculating contributions
- part- the part for this site
- menuExtenders- the collection of menu extenders for this site
- See Also:
 
- 
disposepublic void dispose()Dispose the contributions.
- 
getActionBarsReturns the action bars for the part. If this part is a view then it has exclusive use of the action bars. If this part is an editor then the action bars are shared among this editor and other editors of the same type.
- 
getIdDescription copied from interface:IWorkbenchPartSiteReturns the part registry extension id for this workbench site's part.The name comes from the idattribute in the configuration element.- Specified by:
- getIdin interface- IWorkbenchPartSite
- Returns:
- the registry extension id
 
- 
getPluginIdDescription copied from interface:IWorkbenchPartSiteReturns the unique identifier of the plug-in that defines this workbench site's part.- Specified by:
- getPluginIdin interface- IWorkbenchPartSite
- Returns:
- the unique identifier of the declaring plug-in
 
- 
getRegisteredNameDescription copied from interface:IWorkbenchPartSiteReturns the registered name for this workbench site's part.The name comes from the nameattribute in the configuration element.- Specified by:
- getRegisteredNamein interface- IWorkbenchPartSite
- Returns:
- the part name
 
- 
getPageReturns the page containing this workbench site's part.- Specified by:
- getPagein interface- IWorkbenchSite
- Returns:
- the page containing this part
 
- 
getPartReturns the part.- Specified by:
- getPartin interface- IWorkbenchPartSite
- Returns:
- the part associated with this site
 
- 
getPartReferenceReturns the part reference.
- 
getSelectionProviderReturns the selection provider for a part.- Specified by:
- getSelectionProviderin interface- IWorkbenchSite
- Returns:
- the selection provider, or nullif none
 
- 
getShellReturns the shell containing this part.- Specified by:
- getShellin interface- IShellProvider
- Specified by:
- getShellin interface- IWorkbenchSite
- Returns:
- the shell containing this part
 
- 
getWorkbenchWindowReturns the workbench window containing this part.- Specified by:
- getWorkbenchWindowin interface- IWorkbenchSite
- Returns:
- the workbench window containing this part
 
- 
registerContextMenuRegister a popup menu for extension.- Specified by:
- registerContextMenuin interface- IWorkbenchPartSite
- Parameters:
- menuID- the menu id
- menuMgr- the menu manager
- selProvider- the selection provider
 
- 
registerContextMenuRegister a popup menu with the default id for extension.- Specified by:
- registerContextMenuin interface- IWorkbenchPartSite
- Parameters:
- menuMgr- the menu manager
- selProvider- the selection provider
 
- 
getContextMenuIdsGet the registered popup menu identifiers
- 
setActionBarsSets the action bars for the part.
- 
setPartSets the part.
- 
setSelectionProviderSet the selection provider for a part.- Specified by:
- setSelectionProviderin interface- IWorkbenchSite
- Parameters:
- provider- the selection provider, or- nullto clear it
 
- 
getKeyBindingServiceDescription copied from interface:IWorkbenchPartSiteReturns the key binding service in use.The part will access this service to register all of its actions, to set the active scope. - Specified by:
- getKeyBindingServicein interface- IWorkbenchPartSite
- Returns:
- the key binding service in use
- See Also:
 
- 
getInitialScopeId
- 
getAdapterGet an adapter for this type.- Specified by:
- getAdapterin interface- IAdaptable
- Type Parameters:
- T- the class type
- Parameters:
- adapter- the adapter class to look up
- Returns:
- a object of the given class, or nullif this object does not have an adapter for the given class
 
- 
activateActionBarspublic void activateActionBars(boolean forceVisibility) 
- 
deactivateActionBarspublic void deactivateActionBars(boolean forceHide) 
- 
getServiceDescription copied from interface:IServiceLocatorRetrieves the service corresponding to the given API.- Specified by:
- getServicein interface- IServiceLocator
- Parameters:
- key- This is the interface that the service implements. Must not be- null.
- Returns:
- The service, or nullif no such service could be found.
 
- 
hasServiceDescription copied from interface:IServiceLocatorWhether 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:
- hasServicein interface- IServiceLocator
- Parameters:
- key- This is the interface that the service implements. Must not be- null.
- Returns:
- trueif the service locator can find a service for the given API;- falseotherwise.
 
- 
toStringPrints out the identifier, the plug-in identifier and the registered name. This is for debugging purposes only.
- 
getModel
- 
getContext
 
-