public class MultiPageEditorSite extends Object implements IEditorSite, org.eclipse.ui.internal.services.INestable
The base implementation of MultiPageEditor.createSite
creates
an instance of this class. This class may be instantiated or subclassed.
Constructor and Description |
---|
MultiPageEditorSite(MultiPageEditorPart multiPageEditor,
IEditorPart editor)
Creates a site for the given editor nested within the given multi-page
editor.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Notifies the multi page editor service that the component within which it
exists has become active.
|
void |
deactivate()
Notifies the multi page editor service that the component within which it
exists has been deactived.
|
void |
dispose()
Dispose the contributions.
|
IEditorActionBarContributor |
getActionBarContributor()
The
MultiPageEditorSite implementation of this
IEditorSite method returns null , since
nested editors do not have their own action bar contributor. |
IActionBars |
getActionBars()
The
MultiPageEditorSite implementation of this
IEditorSite method forwards to the multi-page editor to
return the action bars. |
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
ILabelDecorator |
getDecoratorManager()
Deprecated.
use IWorkbench.getDecoratorManager()
|
IEditorPart |
getEditor()
Returns the nested editor.
|
String |
getId()
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method returns an empty string since
the nested editor is not created from the registry. |
IKeyBindingService |
getKeyBindingService()
Returns the key binding service in use.
|
MultiPageEditorPart |
getMultiPageEditor()
Returns the multi-page editor.
|
IWorkbenchPage |
getPage()
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method forwards to the multi-page
editor to return the workbench page. |
IWorkbenchPart |
getPart()
Returns the part associated with this site
|
String |
getPluginId()
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method returns an empty string since
the nested editor is not created from the registry. |
String |
getRegisteredName()
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method returns an empty string since
the nested editor is not created from the registry. |
ISelectionProvider |
getSelectionProvider()
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method returns the selection provider
set by setSelectionProvider . |
Object |
getService(Class key)
Retrieves the service corresponding to the given API.
|
Shell |
getShell()
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method forwards to the multi-page
editor to return the shell. |
IWorkbenchWindow |
getWorkbenchWindow()
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method forwards to the multi-page
editor to return the workbench window. |
protected void |
handlePostSelectionChanged(SelectionChangedEvent event)
Handles a post selection changed even from the nexted editor.
|
protected void |
handleSelectionChanged(SelectionChangedEvent event)
Handles a selection changed event from the nested editor.
|
boolean |
hasService(Class key)
Whether this service exists within the scope of this service locator.
|
void |
registerContextMenu(MenuManager menuManager,
ISelectionProvider selProvider)
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method forwards to the multi-page
editor for registration. |
void |
registerContextMenu(MenuManager menuManager,
ISelectionProvider selectionProvider,
boolean includeEditorInput)
Registers a pop-up menu with the default id for extension.
|
void |
registerContextMenu(String menuID,
MenuManager menuMgr,
ISelectionProvider selProvider)
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method forwards to the multi-page
editor for registration. |
void |
registerContextMenu(String menuId,
MenuManager menuManager,
ISelectionProvider selectionProvider,
boolean includeEditorInput)
Registers a pop-up menu with a particular id for extension.
|
void |
setSelectionProvider(ISelectionProvider provider)
The
MultiPageEditorSite implementation of this
IWorkbenchPartSite method remembers the selection
provider, and also hooks a listener on it, which calls
handleSelectionChanged when a selection changed event
occurs. |
public MultiPageEditorSite(MultiPageEditorPart multiPageEditor, IEditorPart editor)
multiPageEditor
- the multi-page editoreditor
- the nested editorpublic final void activate()
activate
in interface org.eclipse.ui.internal.services.INestable
public final void deactivate()
deactivate
in interface org.eclipse.ui.internal.services.INestable
public void dispose()
public IEditorActionBarContributor getActionBarContributor()
MultiPageEditorSite
implementation of this
IEditorSite
method returns null
, since
nested editors do not have their own action bar contributor.getActionBarContributor
in interface IEditorSite
null
public IActionBars getActionBars()
MultiPageEditorSite
implementation of this
IEditorSite
method forwards to the multi-page editor to
return the action bars.getActionBars
in interface IEditorSite
public Object getAdapter(Class adapter)
IAdaptable
null
if
no such object can be found.getAdapter
in interface IAdaptable
adapter
- the adapter class to look upnull
if this object does not
have an adapter for the given class@Deprecated public ILabelDecorator getDecoratorManager()
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor to return the decorator manager.public IEditorPart getEditor()
public String getId()
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method returns an empty string since
the nested editor is not created from the registry.getId
in interface IWorkbenchPartSite
public IKeyBindingService getKeyBindingService()
IWorkbenchPartSite
The part will access this service to register all of its actions, to set the active scope.
getKeyBindingService
in interface IWorkbenchPartSite
IContextService
,
IHandlerService
public MultiPageEditorPart getMultiPageEditor()
public IWorkbenchPage getPage()
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor to return the workbench page.getPage
in interface IWorkbenchSite
public IWorkbenchPart getPart()
IWorkbenchPartSite
getPart
in interface IWorkbenchPartSite
public String getPluginId()
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method returns an empty string since
the nested editor is not created from the registry.getPluginId
in interface IWorkbenchPartSite
public String getRegisteredName()
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method returns an empty string since
the nested editor is not created from the registry.getRegisteredName
in interface IWorkbenchPartSite
public ISelectionProvider getSelectionProvider()
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method returns the selection provider
set by setSelectionProvider
.getSelectionProvider
in interface IWorkbenchSite
public final Object getService(Class key)
IServiceLocator
getService
in interface IServiceLocator
key
- This is the interface that the service implements. Must not be
null
.null
if no such service could be
found.public Shell getShell()
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor to return the shell.getShell
in interface IShellProvider
getShell
in interface IWorkbenchSite
public IWorkbenchWindow getWorkbenchWindow()
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor to return the workbench window.getWorkbenchWindow
in interface IWorkbenchSite
protected void handlePostSelectionChanged(SelectionChangedEvent event)
Subclasses may extend or reimplement this method
event
- the eventprotected void handleSelectionChanged(SelectionChangedEvent event)
fireSelectionChanged
on it (only if it is
an instance of MultiPageSelectionProvider
), passing a new
event object.
Subclasses may extend or reimplement this method.
event
- the eventpublic final boolean hasService(Class key)
IServiceLocator
hasService
in interface IServiceLocator
key
- This is the interface that the service implements. Must not be
null
.true
iff the service locator can find a service
for the given API; false
otherwise.public void registerContextMenu(MenuManager menuManager, ISelectionProvider selProvider)
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor for registration.registerContextMenu
in interface IWorkbenchPartSite
menuManager
- The menu managerselProvider
- The selection provider.public final void registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput)
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
as false
. 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)
registerContextMenu
in interface IEditorSite
menuManager
- the menu manager; must not be null
.selectionProvider
- the selection provider; must not be null
.includeEditorInput
- Whether the editor input should be included when adding object
contributions to this context menu.IWorkbenchPartSite.registerContextMenu(MenuManager,
ISelectionProvider)
public void registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider)
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor for registration.registerContextMenu
in interface IWorkbenchPartSite
menuID
- The identifier for the menu.menuMgr
- The menu managerselProvider
- The selection provider.public final void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput)
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
as false
. 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)
registerContextMenu
in interface IEditorSite
menuId
- the menu id; must not be null
.menuManager
- the menu manager; must not be null
.selectionProvider
- the selection provider; must not be null
.includeEditorInput
- Whether the editor input should be included when adding object
contributions to this context menu.IWorkbenchPartSite.registerContextMenu(MenuManager,
ISelectionProvider)
public void setSelectionProvider(ISelectionProvider provider)
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method remembers the selection
provider, and also hooks a listener on it, which calls
handleSelectionChanged
when a selection changed event
occurs.setSelectionProvider
in interface IWorkbenchSite
provider
- The selection provider.handleSelectionChanged(SelectionChangedEvent)
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.