Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.actions
Class SelectionProviderAction


java.lang.Object
  extended by 

org.eclipse.core.commands.common.EventManager
      extended by 

org.eclipse.jface.action.AbstractAction
          extended by 

org.eclipse.jface.action.Action
              extended by 
org.eclipse.ui.actions.SelectionProviderAction
All Implemented Interfaces:
IAction, ISelectionChangedListener
Direct Known Subclasses:
PropertyDialogAction, ResourceNavigatorAction, ShowInNavigatorAction

public abstract class SelectionProviderAction
extends Action
implements ISelectionChangedListener

The abstract superclass for actions that listen to selection changes from a particular selection provider. This implementation splits the current selection along structured/unstructured lines, providing a convenient place to monitor selection changes that require adjusting action state.

Subclasses must implement the following IAction method:

  • run - to do the action's work

Subclasses may reimplement either of the following methods:

  • selectionChanged(IStructuredSelection)
  • selectionChanged(ISelection)


Field Summary
 
Fields inherited from interface org.eclipse.jface.action. IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
protected SelectionProviderAction ( ISelectionProvider provider, String text)
          Creates a new action with the given text that monitors selection changes within the given selection provider.
 
Method Summary
 void dispose ()
          Disposes this action by removing it as a listener from the selection provider.
  ISelection getSelection ()
          Returns the current selection in the selection provider.
  ISelectionProvider getSelectionProvider ()
          Returns the selection provider that is the target of this action.
  IStructuredSelection getStructuredSelection ()
          Returns the current structured selection in the selection provider, or an empty selection if nothing is selected or if selection does not include objects (for example, raw text).
 void selectionChanged ( ISelection selection)
          Notifies this action that the given (non-structured) selection has changed in the selection provider.
 void selectionChanged ( IStructuredSelection selection)
          Notifies this action that the given structured selection has changed in the selection provider.
 void selectionChanged ( SelectionChangedEvent event)
          The SelectionProviderAction implementation of this ISelectionChangedListener method calls selectionChanged(IStructuredSelection) if the selection is a structured selection but selectionChanged(ISelection) if it is not.
 
Methods inherited from class org.eclipse.jface.action. Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, run, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action. AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common. EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action. IAction
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

SelectionProviderAction

protected SelectionProviderAction(
ISelectionProvider provider,
                                  
String text)
Creates a new action with the given text that monitors selection changes within the given selection provider. The resulting action is added as a listener on the selection provider.

Parameters:
provider - the selection provider that will provide selection notification
text - the string used as the text for the action, or null if there is no text
Method Detail

dispose

public void dispose()
Disposes this action by removing it as a listener from the selection provider. This must be called by the creator of the action when the action is no longer needed.


getSelection

public 
ISelection getSelection()
Returns the current selection in the selection provider.

Returns:
the current selection in the selection provider

getSelectionProvider

public 
ISelectionProvider getSelectionProvider()
Returns the selection provider that is the target of this action.

Returns:
the target selection provider of this action

getStructuredSelection

public 
IStructuredSelection getStructuredSelection()
Returns the current structured selection in the selection provider, or an empty selection if nothing is selected or if selection does not include objects (for example, raw text).

Returns:
the current structured selection in the selection provider

selectionChanged

public void selectionChanged(
ISelection selection)
Notifies this action that the given (non-structured) selection has changed in the selection provider.

The SelectionProviderAction implementation of this method does nothing. Subclasses may reimplement to react to this selection change.

Parameters:
selection - the new selection

selectionChanged

public void selectionChanged(
IStructuredSelection selection)
Notifies this action that the given structured selection has changed in the selection provider.

The SelectionProviderAction implementation of this method does nothing. Subclasses may reimplement to react to this selection change.

Parameters:
selection - the new selection

selectionChanged

public final void selectionChanged(
SelectionChangedEvent event)
The SelectionProviderAction implementation of this ISelectionChangedListener method calls selectionChanged(IStructuredSelection) if the selection is a structured selection but selectionChanged(ISelection) if it is not. Subclasses should override either of those methods method to react to selection changes.

Specified by:
selectionChanged in interface ISelectionChangedListener
Parameters:
event - event object describing the change

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire