public class PropertyDialogAction extends SelectionProviderAction
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.
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 and 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)
|
Modifier and Type | Method and 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 this
IAction method does
nothing. |
void |
selectionChanged(IStructuredSelection selection)
Notifies this action that the given structured selection has changed
in the selection provider.
|
dispose, getSelection, getSelectionProvider, getStructuredSelection, selectionChanged, selectionChanged
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
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
@Deprecated public PropertyDialogAction(Shell shell, ISelectionProvider provider)
shell
- the shell in which the dialog will openprovider
- the selection provider whose elements the property dialog will
describepublic PropertyDialogAction(IShellProvider shell, ISelectionProvider provider)
shell
- provides the shell in which the dialog will openprovider
- the selection provider whose elements the property dialog will
describepublic boolean isApplicableForSelection()
false
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.
true
if the selection is not empty and there are
property pages for the selected element, and false
otherwisepublic boolean isApplicableForSelection(IStructuredSelection selection)
This method is generally too expensive to use when updating the enabled state of the action on each selection change.
selection
- The selection to testtrue
if the selection is of not empty and there are
property pages for the selected element, and false
otherwisepublic void run()
Action
IAction
method does
nothing. Subclasses should override this method if they do not need
information from the triggering event, or override
runWithEvent(Event)
if they do.run
in interface IAction
run
in class Action
How radio buttons are handled
,
How check boxes are handled
public PreferenceDialog createDialog()
null
if no applicable pages
are found.public void selectionChanged(IStructuredSelection selection)
SelectionProviderAction
The SelectionProviderAction
implementation of this method
does nothing. Subclasses may reimplement to react to this selection change.
selectionChanged
in class SelectionProviderAction
selection
- the new selection
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.