Class SlaveSelectionService
- All Implemented Interfaces:
ISelectionService
,IDisposable
- Since:
- 3.4
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPostSelectionListener
(String partId, ISelectionListener listener) Adds a part-specific selection listener which is notified when selection changes in the part with the given id.void
addPostSelectionListener
(ISelectionListener listener) Adds the given post selection listener.It is equivalent to selection changed if the selection was triggered by the mouse but it has a delay if the selection is triggered by the keyboard arrows.void
addSelectionListener
(String partId, ISelectionListener listener) Adds a part-specific selection listener which is notified when selection changes in the part with the given id.void
addSelectionListener
(ISelectionListener listener) Adds the given selection listener.void
dispose()
Disposes of this service.Returns the current selection in the active part.getSelection
(String partId) Returns the current selection in the part with the given id.void
removePostSelectionListener
(String partId, ISelectionListener listener) Removes the given part-specific post selection listener.void
Removes the given post selection listener.void
removeSelectionListener
(String partId, ISelectionListener listener) Removes the given part-specific selection listener.void
removeSelectionListener
(ISelectionListener listener) Removes the given selection listener.
-
Constructor Details
-
SlaveSelectionService
-
-
Method Details
-
addPostSelectionListener
Description copied from interface:ISelectionService
Adds the given post selection listener.It is equivalent to selection changed if the selection was triggered by the mouse but it has a delay if the selection is triggered by the keyboard arrows. Has no effect if an identical listener is already registered. Note: Works only for StructuredViewer(s).Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.
Note: only update the UI when the UI is visible. See the
SelectionListenerFactory
for listeners that will only be called when the UI is visible to the user.- Specified by:
addPostSelectionListener
in interfaceISelectionService
- Parameters:
listener
- a selection listener- See Also:
-
addPostSelectionListener
Description copied from interface:ISelectionService
Adds a part-specific selection listener which is notified when selection changes in the part with the given id. This is independent of part activation - the part need not be active for notification to be sent.When the part is created, the listener is passed the part's initial selection. When the part is disposed, the listener is passed a
null
selection, but only if the listener implementsINullSelectionListener
.Note: this will not correctly track editor parts as each editor does not have a unique partId.
Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.
Note: only update the UI when the UI is visible. See the
SelectionListenerFactory
for listeners that will only be called when the UI is visible to the user.- Specified by:
addPostSelectionListener
in interfaceISelectionService
- Parameters:
partId
- the id of the part to tracklistener
- a selection listener- See Also:
-
addSelectionListener
Description copied from interface:ISelectionService
Adds the given selection listener. Has no effect if an identical listener is already registered.Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.
Note: only update the UI when the UI is visible. See the
SelectionListenerFactory
for listeners that will only be called when the UI is visible to the user.- Specified by:
addSelectionListener
in interfaceISelectionService
- Parameters:
listener
- a selection listener- See Also:
-
addSelectionListener
Description copied from interface:ISelectionService
Adds a part-specific selection listener which is notified when selection changes in the part with the given id. This is independent of part activation - the part need not be active for notification to be sent.When the part is created, the listener is passed the part's initial selection. When the part is disposed, the listener is passed a
null
selection, but only if the listener implementsINullSelectionListener
.Note: this will not correctly track editor parts as each editor does not have a unique partId.
Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.
Note: only update the UI when the UI is visible. See the
SelectionListenerFactory
for listeners that will only be called when the UI is visible to the user.- Specified by:
addSelectionListener
in interfaceISelectionService
- Parameters:
partId
- the id of the part to tracklistener
- a selection listener- See Also:
-
getSelection
Description copied from interface:ISelectionService
Returns the current selection in the active part. If the selection in the active part is undefined (the active part has no selection provider) the result will benull
.- Specified by:
getSelection
in interfaceISelectionService
- Returns:
- the current selection, or
null
if undefined
-
getSelection
Description copied from interface:ISelectionService
Returns the current selection in the part with the given id. If the part is not open, or if the selection in the active part is undefined (the active part has no selection provider) the result will benull
.- Specified by:
getSelection
in interfaceISelectionService
- Parameters:
partId
- the id of the part- Returns:
- the current selection, or
null
if undefined
-
removePostSelectionListener
Description copied from interface:ISelectionService
Removes the given post selection listener. Has no effect if an identical listener is not registered.- Specified by:
removePostSelectionListener
in interfaceISelectionService
- Parameters:
listener
- a selection listener
-
removePostSelectionListener
Description copied from interface:ISelectionService
Removes the given part-specific post selection listener. Has no effect if an identical listener is not registered for the given part id.- Specified by:
removePostSelectionListener
in interfaceISelectionService
- Parameters:
partId
- the id of the part to tracklistener
- a selection listener
-
removeSelectionListener
Description copied from interface:ISelectionService
Removes the given selection listener. Has no effect if an identical listener is not registered.- Specified by:
removeSelectionListener
in interfaceISelectionService
- Parameters:
listener
- a selection listener
-
removeSelectionListener
Description copied from interface:ISelectionService
Removes the given part-specific selection listener. Has no effect if an identical listener is not registered for the given part id.- Specified by:
removeSelectionListener
in interfaceISelectionService
- Parameters:
partId
- the id of the part to tracklistener
- a selection listener
-
dispose
public void dispose()Description copied from interface:IDisposable
Disposes of this service. All resources must be freed. All listeners must be detached. Dispose will only be called once during the life cycle of a service.- Specified by:
dispose
in interfaceIDisposable
-