Class MultiPageEditorSite
- All Implemented Interfaces:
IAdaptable
,IShellProvider
,IEditorSite
,org.eclipse.ui.internal.services.INestable
,IWorkbenchPartSite
,IWorkbenchSite
,IServiceLocator
The base implementation of MultiPageEditor.createSite
creates an
instance of this class. This class may be instantiated or subclassed.
-
Constructor Summary
ConstructorDescriptionMultiPageEditorSite
(MultiPageEditorPart multiPageEditor, IEditorPart editor) Creates a site for the given editor nested within the given multi-page editor. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
activate()
Notifies the multi page editor service that the component within which it exists has become active.final void
Notifies the multi page editor service that the component within which it exists has been deactived.void
dispose()
Dispose the contributions.TheMultiPageEditorSite
implementation of thisIEditorSite
method returnsnull
, since nested editors do not have their own action bar contributor.TheMultiPageEditorSite
implementation of thisIEditorSite
method forwards to the multi-page editor to return the action bars.<T> T
getAdapter
(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.Deprecated.use IWorkbench.getDecoratorManager()Returns the nested editor.getId()
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method returns an empty string since the nested editor is not created from the registry.Returns the key binding service in use.Returns the multi-page editor.protected IWorkbenchPartSite
getPage()
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor to return the workbench page.getPart()
Returns the part associated with this siteTheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method returns an empty string since the nested editor is not created from the registry.TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method returns an empty string since the nested editor is not created from the registry.TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method returns the selection provider set bysetSelectionProvider
.final <T> T
getService
(Class<T> key) Retrieves the service corresponding to the given API.getShell()
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor to return the shell.TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor to return the workbench window.protected void
Handles a post selection changed even from the nexted editor.protected void
Handles a selection changed event from the nested editor.final boolean
hasService
(Class key) Whether this service exists within the scope of this service locator.void
registerContextMenu
(String menuID, MenuManager menuMgr, ISelectionProvider selProvider) TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor for registration.final void
registerContextMenu
(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput) Registers a pop-up menu with a particular id for extension.void
registerContextMenu
(MenuManager menuManager, ISelectionProvider selProvider) TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor for registration.final void
registerContextMenu
(MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput) Registers a pop-up menu with the default id for extension.void
setSelectionProvider
(ISelectionProvider provider) TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method remembers the selection provider, and also hooks a listener on it, which callshandleSelectionChanged
when a selection changed event occurs.toString()
-
Constructor Details
-
MultiPageEditorSite
Creates a site for the given editor nested within the given multi-page editor.- Parameters:
multiPageEditor
- the multi-page editoreditor
- the nested editor
-
-
Method Details
-
activate
public final void activate()Notifies the multi page editor service that the component within which it exists has become active.- Specified by:
activate
in 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:
deactivate
in interfaceorg.eclipse.ui.internal.services.INestable
- Since:
- 3.2
-
dispose
public void dispose()Dispose the contributions. -
getActionBarContributor
TheMultiPageEditorSite
implementation of thisIEditorSite
method returnsnull
, since nested editors do not have their own action bar contributor.- Specified by:
getActionBarContributor
in interfaceIEditorSite
- Returns:
null
-
getActionBars
TheMultiPageEditorSite
implementation of thisIEditorSite
method forwards to the multi-page editor to return the action bars.- Specified by:
getActionBars
in interfaceIEditorSite
- Returns:
- The action bars from the parent multi-page editor.
-
getAdapter
Description copied from interface:IAdaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if 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:
getAdapter
in interfaceIAdaptable
- Type Parameters:
T
- the class type- Parameters:
adapter
- the adapter class to look up- Returns:
- a object of the given class, or
null
if this object does not have an adapter for the given class
-
getDecoratorManager
Deprecated.use IWorkbench.getDecoratorManager()TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor to return the decorator manager.- Returns:
- The decorator from the workbench window.
-
getEditor
Returns the nested editor.- Returns:
- the nested editor
-
getId
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method returns an empty string since the nested editor is not created from the registry.- Specified by:
getId
in interfaceIWorkbenchPartSite
- Returns:
- An empty string.
-
getKeyBindingService
Description copied from interface:IWorkbenchPartSite
Returns 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:
getKeyBindingService
in interfaceIWorkbenchPartSite
- Returns:
- the key binding service in use
- See Also:
-
getMultiPageEditor
Returns the multi-page editor.- Returns:
- the multi-page editor
-
getPage
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor to return the workbench page.- Specified by:
getPage
in interfaceIWorkbenchSite
- Returns:
- The workbench page in which this editor site resides.
-
getPart
Description copied from interface:IWorkbenchPartSite
Returns the part associated with this site- Specified by:
getPart
in interfaceIWorkbenchPartSite
- Returns:
- the part associated with this site
-
getPluginId
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method returns an empty string since the nested editor is not created from the registry.- Specified by:
getPluginId
in interfaceIWorkbenchPartSite
- Returns:
- An empty string.
-
getRegisteredName
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method returns an empty string since the nested editor is not created from the registry.- Specified by:
getRegisteredName
in interfaceIWorkbenchPartSite
- Returns:
- An empty string.
-
getSelectionProvider
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method returns the selection provider set bysetSelectionProvider
.- Specified by:
getSelectionProvider
in interfaceIWorkbenchSite
- Returns:
- The current selection provider.
-
getService
Description copied from interface:IServiceLocator
Retrieves the service corresponding to the given API.- Specified by:
getService
in interfaceIServiceLocator
- Parameters:
key
- This is the interface that the service implements. Must not benull
.- Returns:
- The service, or
null
if no such service could be found.
-
getShell
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor to return the shell.- Specified by:
getShell
in interfaceIShellProvider
- Specified by:
getShell
in interfaceIWorkbenchSite
- Returns:
- The shell in which this editor site resides.
-
getWorkbenchWindow
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor to return the workbench window.- Specified by:
getWorkbenchWindow
in interfaceIWorkbenchSite
- Returns:
- The workbench window in which this editor site resides.
-
getNestedEditorSite
- Returns:
IWorkbenchPartSite
of the nested multi-page editor.- Since:
- 3.115
-
handlePostSelectionChanged
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
Handles a selection changed event from the nested editor. The default implementation gets the selection provider from the multi-page editor's site, and callsfireSelectionChanged
on 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
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 interfaceIServiceLocator
- Parameters:
key
- This is the interface that the service implements. Must not benull
.- Returns:
true
if the service locator can find a service for the given API;false
otherwise.
-
registerContextMenu
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor for registration.- Specified by:
registerContextMenu
in interfaceIWorkbenchPartSite
- Parameters:
menuManager
- The menu managerselProvider
- The selection provider.
-
registerContextMenu
public final void registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput) Description copied from interface:IEditorSite
Registers 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
includeEditorInput
asfalse
. 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:
registerContextMenu
in 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:
-
registerContextMenu
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method forwards to the multi-page editor for registration.- Specified by:
registerContextMenu
in 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:IEditorSite
Registers 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
includeEditorInput
asfalse
. 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:
registerContextMenu
in 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:
-
setSelectionProvider
TheMultiPageEditorSite
implementation of thisIWorkbenchPartSite
method remembers the selection provider, and also hooks a listener on it, which callshandleSelectionChanged
when a selection changed event occurs.- Specified by:
setSelectionProvider
in interfaceIWorkbenchSite
- Parameters:
provider
- The selection provider.- See Also:
-
toString
-