Class MultiPageEditorSite
- java.lang.Object
-
- org.eclipse.ui.part.MultiPageEditorSite
-
- All Implemented Interfaces:
IAdaptable,IShellProvider,IEditorSite,org.eclipse.ui.internal.services.INestable,IWorkbenchPartSite,IWorkbenchSite,IServiceLocator
public class MultiPageEditorSite extends Object implements IEditorSite, org.eclipse.ui.internal.services.INestable
Site for a nested editor within a multi-page editor. Selection is handled by forwarding the event to the multi-page editor's selection listeners; most other methods are forwarded to the multi-page editor's site.The base implementation of
MultiPageEditor.createSitecreates an instance of this class. This class may be instantiated or subclassed.
-
-
Constructor Summary
Constructors Constructor Description MultiPageEditorSite(MultiPageEditorPart multiPageEditor, IEditorPart editor)Creates a site for the given editor nested within the given multi-page editor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactivate()Notifies the multi page editor service that the component within which it exists has become active.voiddeactivate()Notifies the multi page editor service that the component within which it exists has been deactived.voiddispose()Dispose the contributions.IEditorActionBarContributorgetActionBarContributor()TheMultiPageEditorSiteimplementation of thisIEditorSitemethod returnsnull, since nested editors do not have their own action bar contributor.IActionBarsgetActionBars()TheMultiPageEditorSiteimplementation of thisIEditorSitemethod forwards to the multi-page editor to return the action bars.<T> TgetAdapter(Class<T> adapter)Returns an object which is an instance of the given class associated with this object.ILabelDecoratorgetDecoratorManager()Deprecated.use IWorkbench.getDecoratorManager()IEditorPartgetEditor()Returns the nested editor.StringgetId()TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod returns an empty string since the nested editor is not created from the registry.IKeyBindingServicegetKeyBindingService()Returns the key binding service in use.MultiPageEditorPartgetMultiPageEditor()Returns the multi-page editor.protected IWorkbenchPartSitegetNestedEditorSite()IWorkbenchPagegetPage()TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor to return the workbench page.IWorkbenchPartgetPart()Returns the part associated with this siteStringgetPluginId()TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod returns an empty string since the nested editor is not created from the registry.StringgetRegisteredName()TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod returns an empty string since the nested editor is not created from the registry.ISelectionProvidergetSelectionProvider()TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod returns the selection provider set bysetSelectionProvider.<T> TgetService(Class<T> key)Retrieves the service corresponding to the given API.ShellgetShell()TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor to return the shell.IWorkbenchWindowgetWorkbenchWindow()TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor to return the workbench window.protected voidhandlePostSelectionChanged(SelectionChangedEvent event)Handles a post selection changed even from the nexted editor.protected voidhandleSelectionChanged(SelectionChangedEvent event)Handles a selection changed event from the nested editor.booleanhasService(Class key)Whether this service exists within the scope of this service locator.voidregisterContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider)TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor for registration.voidregisterContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput)Registers a pop-up menu with a particular id for extension.voidregisterContextMenu(MenuManager menuManager, ISelectionProvider selProvider)TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor for registration.voidregisterContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput)Registers a pop-up menu with the default id for extension.voidsetSelectionProvider(ISelectionProvider provider)TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod remembers the selection provider, and also hooks a listener on it, which callshandleSelectionChangedwhen a selection changed event occurs.StringtoString()
-
-
-
Constructor Detail
-
MultiPageEditorSite
public MultiPageEditorSite(MultiPageEditorPart multiPageEditor, IEditorPart editor)
Creates a site for the given editor nested within the given multi-page editor.- Parameters:
multiPageEditor- the multi-page editoreditor- the nested editor
-
-
Method Detail
-
activate
public final void activate()
Notifies the multi page editor service that the component within which it exists has become active.- Specified by:
activatein interfaceorg.eclipse.ui.internal.services.INestable- Since:
- 3.2
-
deactivate
public final void deactivate()
Notifies the multi page editor service that the component within which it exists has been deactived.- Specified by:
deactivatein interfaceorg.eclipse.ui.internal.services.INestable- Since:
- 3.2
-
dispose
public void dispose()
Dispose the contributions.
-
getActionBarContributor
public IEditorActionBarContributor getActionBarContributor()
TheMultiPageEditorSiteimplementation of thisIEditorSitemethod returnsnull, since nested editors do not have their own action bar contributor.- Specified by:
getActionBarContributorin interfaceIEditorSite- Returns:
null
-
getActionBars
public IActionBars getActionBars()
TheMultiPageEditorSiteimplementation of thisIEditorSitemethod forwards to the multi-page editor to return the action bars.- Specified by:
getActionBarsin interfaceIEditorSite- Returns:
- The action bars from the parent multi-page editor.
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
Description copied from interface:IAdaptableReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.Clients may implement this method but should generally call
Adapters.adapt(Object, Class, boolean)rather than invoking it directly.- Specified by:
getAdapterin interfaceIAdaptable- 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
-
getDecoratorManager
@Deprecated public ILabelDecorator getDecoratorManager()
Deprecated.use IWorkbench.getDecoratorManager()TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor to return the decorator manager.- Returns:
- The decorator from the workbench window.
-
getEditor
public IEditorPart getEditor()
Returns the nested editor.- Returns:
- the nested editor
-
getId
public String getId()
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod returns an empty string since the nested editor is not created from the registry.- Specified by:
getIdin interfaceIWorkbenchPartSite- Returns:
- An empty string.
-
getKeyBindingService
public IKeyBindingService getKeyBindingService()
Description 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 interfaceIWorkbenchPartSite- Returns:
- the key binding service in use
- See Also:
IContextService,IHandlerService
-
getMultiPageEditor
public MultiPageEditorPart getMultiPageEditor()
Returns the multi-page editor.- Returns:
- the multi-page editor
-
getPage
public IWorkbenchPage getPage()
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor to return the workbench page.- Specified by:
getPagein interfaceIWorkbenchSite- Returns:
- The workbench page in which this editor site resides.
-
getPart
public IWorkbenchPart getPart()
Description copied from interface:IWorkbenchPartSiteReturns the part associated with this site- Specified by:
getPartin interfaceIWorkbenchPartSite- Returns:
- the part associated with this site
-
getPluginId
public String getPluginId()
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod returns an empty string since the nested editor is not created from the registry.- Specified by:
getPluginIdin interfaceIWorkbenchPartSite- Returns:
- An empty string.
-
getRegisteredName
public String getRegisteredName()
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod returns an empty string since the nested editor is not created from the registry.- Specified by:
getRegisteredNamein interfaceIWorkbenchPartSite- Returns:
- An empty string.
-
getSelectionProvider
public ISelectionProvider getSelectionProvider()
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod returns the selection provider set bysetSelectionProvider.- Specified by:
getSelectionProviderin interfaceIWorkbenchSite- Returns:
- The current selection provider.
-
getService
public final <T> T getService(Class<T> key)
Description copied from interface:IServiceLocatorRetrieves the service corresponding to the given API.- Specified by:
getServicein interfaceIServiceLocator- Parameters:
key- This is the interface that the service implements. Must not benull.- Returns:
- The service, or
nullif no such service could be found.
-
getShell
public Shell getShell()
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor to return the shell.- Specified by:
getShellin interfaceIShellProvider- Specified by:
getShellin interfaceIWorkbenchSite- Returns:
- The shell in which this editor site resides.
-
getWorkbenchWindow
public IWorkbenchWindow getWorkbenchWindow()
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor to return the workbench window.- Specified by:
getWorkbenchWindowin interfaceIWorkbenchSite- Returns:
- The workbench window in which this editor site resides.
-
getNestedEditorSite
protected IWorkbenchPartSite getNestedEditorSite()
- Returns:
IWorkbenchPartSiteof the nested multi-page editor.- Since:
- 3.115
-
handlePostSelectionChanged
protected void handlePostSelectionChanged(SelectionChangedEvent event)
Handles a post selection changed even from the nexted editor.Subclasses may extend or reimplement this method
- Parameters:
event- the event- Since:
- 3.2
-
handleSelectionChanged
protected void handleSelectionChanged(SelectionChangedEvent event)
Handles a selection changed event from the nested editor. The default implementation gets the selection provider from the multi-page editor's site, and callsfireSelectionChangedon it (only if it is an instance ofMultiPageSelectionProvider), passing a new event object.Subclasses may extend or reimplement this method.
- Parameters:
event- the event
-
hasService
public final boolean hasService(Class key)
Description 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 interfaceIServiceLocator- Parameters:
key- This is the interface that the service implements. Must not benull.- Returns:
trueif the service locator can find a service for the given API;falseotherwise.
-
registerContextMenu
public void registerContextMenu(MenuManager menuManager, ISelectionProvider selProvider)
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor for registration.- Specified by:
registerContextMenuin interfaceIWorkbenchPartSite- Parameters:
menuManager- The menu managerselProvider- The selection provider.
-
registerContextMenu
public final void registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput)
Description copied from interface:IEditorSiteRegisters a pop-up menu with the default id for extension. The default id is defined as the part id.
By default, context menus include object contributions based on the editor input for the current editor. It is possible to override this behaviour by calling this method with
includeEditorInputasfalse. This might be desirable for editors that present a localized view of an editor input (e.g., a node in a model editor).For a detailed description of context menu registration see
IWorkbenchPartSite.registerContextMenu(MenuManager, ISelectionProvider)- Specified by:
registerContextMenuin interfaceIEditorSite- Parameters:
menuManager- the menu manager; must not benull.selectionProvider- the selection provider; must not benull.includeEditorInput- Whether the editor input should be included when adding object contributions to this context menu.- See Also:
IWorkbenchPartSite.registerContextMenu(MenuManager, ISelectionProvider)
-
registerContextMenu
public void registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider)
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod forwards to the multi-page editor for registration.- Specified by:
registerContextMenuin interfaceIWorkbenchPartSite- Parameters:
menuID- The identifier for the menu.menuMgr- The menu managerselProvider- The selection provider.
-
registerContextMenu
public final void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput)
Description copied from interface:IEditorSiteRegisters a pop-up menu with a particular id for extension. This method should only be called if the target part has more than one context menu to register.
By default, context menus include object contributions based on the editor input for the current editor. It is possible to override this behaviour by calling this method with
includeEditorInputasfalse. This might be desirable for editors that present a localized view of an editor input (e.g., a node in a model editor).For a detailed description of context menu registration see
IWorkbenchPartSite.registerContextMenu(MenuManager, ISelectionProvider)- Specified by:
registerContextMenuin interfaceIEditorSite- Parameters:
menuId- the menu id; must not benull.menuManager- the menu manager; must not benull.selectionProvider- the selection provider; must not benull.includeEditorInput- Whether the editor input should be included when adding object contributions to this context menu.- See Also:
IWorkbenchPartSite.registerContextMenu(MenuManager, ISelectionProvider)
-
setSelectionProvider
public void setSelectionProvider(ISelectionProvider provider)
TheMultiPageEditorSiteimplementation of thisIWorkbenchPartSitemethod remembers the selection provider, and also hooks a listener on it, which callshandleSelectionChangedwhen a selection changed event occurs.- Specified by:
setSelectionProviderin interfaceIWorkbenchSite- Parameters:
provider- The selection provider.- See Also:
handleSelectionChanged(SelectionChangedEvent)
-
-