Class PropertyDialogAction
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.jface.action.AbstractAction
-
- org.eclipse.jface.action.Action
-
- org.eclipse.ui.actions.SelectionProviderAction
-
- org.eclipse.ui.dialogs.PropertyDialogAction
-
- All Implemented Interfaces:
IAction
,ISelectionChangedListener
public class PropertyDialogAction extends SelectionProviderAction
Standard action for opening a Property Pages Dialog on the currently selected element.This class may be instantiated; it is not intended to be subclassed.
Generally speaking, this action is useful in pop-up menus because it allows the user to browse and change properties of selected elements. When performed, the action will bring up a Property Pages Dialog containing property pages registered with the workbench for elements of the selected type.
Although the action is capable of calculating if there are any applicable pages for the current selection, this calculation is costly because it require searching the workbench registry. Where performance is critical, the action can simply be added to the pop-up menu. In the event of no applicable pages, the action will just open an appropriate message dialog.
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
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
Constructors Constructor Description PropertyDialogAction(IShellProvider shell, ISelectionProvider provider)
Creates a new action for opening a property dialog on the elements from the given selection provider.PropertyDialogAction(Shell shell, ISelectionProvider provider)
Deprecated.use PropertyDialogAction(IShellProvider, ISelectionProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PreferenceDialog
createDialog()
Create the dialog for the receiver.boolean
isApplicableForSelection()
Returns whether this action is actually applicable to the current selection.boolean
isApplicableForSelection(IStructuredSelection selection)
Returns whether this action is applicable to the current selection.void
run()
The default implementation of thisIAction
method does nothing.void
selectionChanged(IStructuredSelection selection)
Notifies this action that the given structured selection has changed in the selection provider.-
Methods inherited from class org.eclipse.ui.actions.SelectionProviderAction
dispose, getSelection, getSelectionProvider, getStructuredSelection, selectionChanged, selectionChanged
-
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, 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
-
-
-
-
Constructor Detail
-
PropertyDialogAction
@Deprecated public PropertyDialogAction(Shell shell, ISelectionProvider provider)
Deprecated.use PropertyDialogAction(IShellProvider, ISelectionProvider)Creates a new action for opening a property dialog on the elements from the given selection provider.- Parameters:
shell
- the shell in which the dialog will openprovider
- the selection provider whose elements the property dialog will describe
-
PropertyDialogAction
public PropertyDialogAction(IShellProvider shell, ISelectionProvider provider)
Creates a new action for opening a property dialog on the elements from the given selection provider.- Parameters:
shell
- provides the shell in which the dialog will openprovider
- the selection provider whose elements the property dialog will describe- Since:
- 3.1
-
-
Method Detail
-
isApplicableForSelection
public boolean isApplicableForSelection()
Returns whether this action is actually applicable to the current selection. If this action is disabled, it will returnfalse
without further calculation. If it is enabled, it will check with the workbench's property page manager to see if there are any property pages registered for the selected element's type.This method is generally too expensive to use when updating the enabled state of the action on each selection change.
- Returns:
true
if the selection is not empty and there are property pages for the selected element, andfalse
otherwise
-
isApplicableForSelection
public boolean isApplicableForSelection(IStructuredSelection selection)
Returns whether this action is applicable to the current selection. This checks that the selection is not empty, and checks with the workbench's property page manager to see if there are any property pages registered for the selected element's type.This method is generally too expensive to use when updating the enabled state of the action on each selection change.
- Parameters:
selection
- The selection to test- Returns:
true
if the selection is of not empty and there are property pages for the selected element, andfalse
otherwise
-
run
public void run()
Description copied from class:Action
The default implementation of thisIAction
method does nothing. Subclasses should override this method if they do not need information from the triggering event, or overriderunWithEvent(Event)
if they do.- Specified by:
run
in interfaceIAction
- Overrides:
run
in classAction
- See Also:
How radio buttons are handled
,How check boxes are handled
-
createDialog
public PreferenceDialog createDialog()
Create the dialog for the receiver. If no pages are found, an informative message dialog is presented instead.- Returns:
- PreferenceDialog or
null
if no applicable pages are found. - Since:
- 3.1
-
selectionChanged
public void selectionChanged(IStructuredSelection selection)
Description copied from class:SelectionProviderAction
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.- Overrides:
selectionChanged
in classSelectionProviderAction
- Parameters:
selection
- the new selection
-
-