org.eclipse.ui.part
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.createSite
creates
an instance of this class. This class may be instantiated or subclassed.
Method Summary
|
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. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
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 editor -
editor
- the nested editor
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 interface org.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 interface org.eclipse.ui.internal.services.INestable
-
-
Since:
- 3.2
dispose
public void dispose()
- Dispose the contributions.
-
-
getActionBarContributor
public
IEditorActionBarContributor getActionBarContributor()
- The
MultiPageEditorSite
implementation of this
IEditorSite
method returns null
, since
nested editors do not have their own action bar contributor.
-
-
Specified by:
-
getActionBarContributor
in interface
IEditorSite
-
-
Returns:
-
null
getActionBars
public
IActionBars getActionBars()
- The
MultiPageEditorSite
implementation of this
IEditorSite
method forwards to the multi-page editor to
return the action bars.
-
-
Specified by:
-
getActionBars
in interface
IEditorSite
-
-
Returns:
- The action bars from the parent multi-page editor.
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
getDecoratorManager
public
ILabelDecorator getDecoratorManager()
-
Deprecated. use IWorkbench.getDecoratorManager()
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method 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()
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method returns an empty string since
the nested editor is not created from the registry.
-
-
Specified by:
-
getId
in interface
IWorkbenchPartSite
-
-
Returns:
- An empty string.
getKeyBindingService
public
IKeyBindingService 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 interface
IWorkbenchPartSite
-
-
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()
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor to return the workbench page.
-
-
Specified by:
-
getPage
in interface
IWorkbenchSite
-
-
Returns:
- The workbench page in which this editor site resides.
getPart
public
IWorkbenchPart getPart()
-
Description copied from interface:
IWorkbenchPartSite
- Returns the part associated with this site
-
-
Specified by:
-
getPart
in interface
IWorkbenchPartSite
-
-
Returns:
- the part associated with this site
getPluginId
public
String getPluginId()
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method returns an empty string since
the nested editor is not created from the registry.
-
-
Specified by:
-
getPluginId
in interface
IWorkbenchPartSite
-
-
Returns:
- An empty string.
getRegisteredName
public
String getRegisteredName()
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method returns an empty string since
the nested editor is not created from the registry.
-
-
Specified by:
-
getRegisteredName
in interface
IWorkbenchPartSite
-
-
Returns:
- An empty string.
getSelectionProvider
public
ISelectionProvider getSelectionProvider()
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method returns the selection provider
set by setSelectionProvider
.
-
-
Specified by:
-
getSelectionProvider
in interface
IWorkbenchSite
-
-
Returns:
- The current selection provider.
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()
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor to return the shell.
-
-
Specified by:
-
getShell
in interface
IShellProvider
-
Specified by:
-
getShell
in interface
IWorkbenchSite
-
-
Returns:
- The shell in which this editor site resides.
getWorkbenchWindow
public
IWorkbenchWindow getWorkbenchWindow()
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor to return the workbench window.
-
-
Specified by:
-
getWorkbenchWindow
in interface
IWorkbenchSite
-
-
Returns:
- The workbench window in which this editor site resides.
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 calls
fireSelectionChanged
on it (only if it is
an instance of MultiPageSelectionProvider
), 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:
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(
MenuManager menuManager,
ISelectionProvider selProvider)
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor for registration.
-
-
Specified by:
-
registerContextMenu
in interface
IWorkbenchPartSite
-
-
Parameters:
-
menuManager
- The menu manager -
selProvider
- 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
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)
-
-
Specified by:
-
registerContextMenu
in interface
IEditorSite
-
-
Parameters:
-
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. -
See Also:
-
IWorkbenchPartSite.registerContextMenu(MenuManager, ISelectionProvider)
registerContextMenu
public void registerContextMenu(
String menuID,
MenuManager menuMgr,
ISelectionProvider selProvider)
- The
MultiPageEditorSite
implementation of this
IWorkbenchPartSite
method forwards to the multi-page
editor for registration.
-
-
Specified by:
-
registerContextMenu
in interface
IWorkbenchPartSite
-
-
Parameters:
-
menuID
- The identifier for the menu. -
menuMgr
- The menu manager -
selProvider
- 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
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)
-
-
Specified by:
-
registerContextMenu
in interface
IEditorSite
-
-
Parameters:
-
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. -
See Also:
-
IWorkbenchPartSite.registerContextMenu(MenuManager, ISelectionProvider)
setSelectionProvider
public 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.
-
-
Specified by:
-
setSelectionProvider
in interface
IWorkbenchSite
-
-
Parameters:
-
provider
- The selection provider. -
See Also:
-
handleSelectionChanged(SelectionChangedEvent)
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.