public abstract class SynchronizeModelAction extends BaseSelectionListenerAction
ISynchronizeModelElement
instances. Subclasses can use this support to filter the selection in order
to determine action enablement and generate the input for a
SynchronizeModelOperation
.SyncInfo
,
SyncInfoSet
,
SynchronizeModelOperation
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
Modifier | Constructor and Description |
---|---|
protected |
SynchronizeModelAction(String text,
ISynchronizePageConfiguration configuration)
Create an action with the given text and configuration.
|
protected |
SynchronizeModelAction(String text,
ISynchronizePageConfiguration configuration,
ISelectionProvider selectionProvider)
Create an action with the given text and configuration.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
confirmSaveOfDirtyEditor()
Returns whether the user should be prompted to save dirty editors.
|
ISynchronizePageConfiguration |
getConfiguration()
Returns the configuration showing this action.
|
protected IDiffElement[] |
getFilteredDiffElements()
Return the selected diff element for which this action is enabled.
|
protected IDiffElement[] |
getSelectedDiffElements()
This method returns all instances of IDiffElement that are in the current
selection.
|
protected abstract SynchronizeModelOperation |
getSubscriberOperation(ISynchronizePageConfiguration configuration,
IDiffElement[] elements)
Return the subscriber operation associated with this action.
|
protected FastSyncInfoFilter |
getSyncInfoFilter()
Filter uses to filter the user selection to contain only those elements
for which this action is enabled.
|
protected void |
handle(Exception e)
Generic error handling code that uses an error dialog to show the error
to the user.
|
protected void |
initialize(ISynchronizePageConfiguration configuration,
ISelectionProvider selectionProvider)
Method invoked from the constructor.
|
protected boolean |
needsToSaveDirtyEditors()
Return whether dirty editor should be saved before this action is run.
|
void |
run()
The default implementation of this
IAction method does
nothing. |
protected void |
runOperation()
Create and run the operation for this action.
|
boolean |
saveAllEditors(boolean confirm)
Save all dirty editors in the workbench that are open on files that may
be affected by this operation.
|
void |
selectionChanged(ISelection selection)
Set the selection of this action to the given selection
|
protected boolean |
updateSelection(IStructuredSelection selection)
Updates this action in response to the given selection.
|
clearCache, getStructuredSelection, runWithEvent, 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, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
protected SynchronizeModelAction(String text, ISynchronizePageConfiguration configuration)
text
- the action's textconfiguration
- the actions synchronize page configurationprotected SynchronizeModelAction(String text, ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider)
text
- the action's textconfiguration
- the actions synchronize page configurationselectionProvider
- a selection providerprotected void initialize(ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider)
configuration
- the synchronize page configurationselectionProvider
- a selection providerpublic 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
protected void runOperation() throws InvocationTargetException, InterruptedException
getSubscriberOperation
and then run. Subclasses may
override.InvocationTargetException
InterruptedException
protected boolean needsToSaveDirtyEditors()
true
.protected boolean confirmSaveOfDirtyEditor()
true
.protected abstract SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements)
run(IAction)
method directly if they choose not to
implement a SynchronizeModelOperation
.configuration
- the synchronize page configuration for the page to
which this action is associatedelements
- the selected diff element for which this action is
enabled.protected void handle(Exception e)
e
- the exception that occurred.protected boolean updateSelection(IStructuredSelection selection)
BaseSelectionListenerAction
The BaseSelectionListenerAction
implementation of this method
returns true
. Subclasses may extend to react to selection
changes; however, if the super method returns false
, the
overriding method must also return false
.
updateSelection
in class BaseSelectionListenerAction
selection
- the new selectiontrue
if the action should be enabled for this selection,
and false
otherwiseprotected final IDiffElement[] getSelectedDiffElements()
protected FastSyncInfoFilter getSyncInfoFilter()
protected final IDiffElement[] getFilteredDiffElements()
public void selectionChanged(ISelection selection)
selection
- the selectionpublic ISynchronizePageConfiguration getConfiguration()
public final boolean saveAllEditors(boolean confirm)
confirm
is true. Return true if successful. Return false
if the user has canceled the command. Must be called from the UI thread.confirm
- prompt the user if true
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.