Package org.eclipse.team.ui.synchronize
Class SynchronizeModelAction
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.ui.actions.BaseSelectionListenerAction
org.eclipse.team.ui.synchronize.SynchronizeModelAction
- All Implemented Interfaces:
- IAction,- ISelectionChangedListener
This action provides utilities for performing operations on selections that
 contain 
ISynchronizeModelElement
 instances. Subclasses can use this support to filter the selection in order
 to determine action enablement and generate the input for a
 SynchronizeModelOperation.- Since:
- 3.0
- See Also:
- 
Field SummaryFields inherited from interface org.eclipse.jface.action.IActionAS_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 SummaryConstructorsModifierConstructorDescriptionprotectedSynchronizeModelAction(String text, ISynchronizePageConfiguration configuration) Create an action with the given text and configuration.protectedSynchronizeModelAction(String text, ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider) Create an action with the given text and configuration.
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleanReturns whether the user should be prompted to save dirty editors.Returns the configuration showing this action.protected final IDiffElement[]Return the selected diff element for which this action is enabled.protected final IDiffElement[]This method returns all instances of IDiffElement that are in the current selection.protected abstract SynchronizeModelOperationgetSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) Return the subscriber operation associated with this action.protected FastSyncInfoFilterFilter uses to filter the user selection to contain only those elements for which this action is enabled.protected voidGeneric error handling code that uses an error dialog to show the error to the user.protected voidinitialize(ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider) Method invoked from the constructor.protected booleanReturn whether dirty editor should be saved before this action is run.voidrun()The default implementation of thisIActionmethod does nothing.protected voidCreate and run the operation for this action.final booleansaveAllEditors(boolean confirm) Save all dirty editors in the workbench that are open on files that may be affected by this operation.voidselectionChanged(ISelection selection) Set the selection of this action to the given selectionprotected booleanupdateSelection(IStructuredSelection selection) Updates this action in response to the given selection.Methods inherited from class org.eclipse.ui.actions.BaseSelectionListenerActionclearCache, getStructuredSelection, runWithEvent, selectionChanged, selectionChangedMethods inherited from class org.eclipse.jface.action.ActionconvertAccelerator, 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, setToolTipTextMethods inherited from class org.eclipse.jface.action.AbstractActionaddPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListenerMethods inherited from class org.eclipse.core.commands.common.EventManageraddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
- 
Constructor Details- 
SynchronizeModelActionCreate an action with the given text and configuration. By default, the action registers for selection change with the selection provider from the configuration's site.- Parameters:
- text- the action's text
- configuration- the actions synchronize page configuration
 
- 
SynchronizeModelActionprotected SynchronizeModelAction(String text, ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider) Create an action with the given text and configuration. By default, the action registers for selection change with the given selection provider.- Parameters:
- text- the action's text
- configuration- the actions synchronize page configuration
- selectionProvider- a selection provider
 
 
- 
- 
Method Details- 
initializeprotected void initialize(ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider) Method invoked from the constructor. The default implementation registers the action as a selection change listener. Subclasses may override.- Parameters:
- configuration- the synchronize page configuration
- selectionProvider- a selection provider
 
- 
runpublic void run()Description copied from class:ActionThe default implementation of thisIActionmethod does nothing. Subclasses should override this method if they do not need information from the triggering event, or overriderunWithEvent(Event)if they do.
- 
runOperationCreate and run the operation for this action. By default, the operation is created by callinggetSubscriberOperationand then run. Subclasses may override.- Throws:
- InvocationTargetException- if an error occurs
- InterruptedException- if operation is interrupted
- Since:
- 3.1
 
- 
needsToSaveDirtyEditorsprotected boolean needsToSaveDirtyEditors()Return whether dirty editor should be saved before this action is run. Default istrue.- Returns:
- whether dirty editor should be saved before this action is run
 
- 
confirmSaveOfDirtyEditorprotected boolean confirmSaveOfDirtyEditor()Returns whether the user should be prompted to save dirty editors. The default istrue.- Returns:
- whether the user should be prompted to save dirty editors
 
- 
getSubscriberOperationprotected abstract SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) Return the subscriber operation associated with this action. This operation will be run when the action is run. Subclass may implement this method and provide an operation subclass or may override therun(IAction)method directly if they choose not to implement aSynchronizeModelOperation.- Parameters:
- configuration- the synchronize page configuration for the page to which this action is associated
- elements- the selected diff element for which this action is enabled.
- Returns:
- the subscriber operation to be run by this action.
 
- 
handleGeneric error handling code that uses an error dialog to show the error to the user. Subclasses can use this method and/or override it.- Parameters:
- e- the exception that occurred.
 
- 
updateSelectionDescription copied from class:BaseSelectionListenerActionUpdates this action in response to the given selection.The BaseSelectionListenerActionimplementation of this method returnstrue. Subclasses may extend to react to selection changes; however, if the super method returnsfalse, the overriding method must also returnfalse.- Overrides:
- updateSelectionin class- BaseSelectionListenerAction
- Parameters:
- selection- the new selection
- Returns:
- trueif the action should be enabled for this selection, and- falseotherwise
 
- 
getSelectedDiffElementsThis method returns all instances of IDiffElement that are in the current selection.- Returns:
- the selected elements
 
- 
getSyncInfoFilterFilter uses to filter the user selection to contain only those elements for which this action is enabled. Default filter includes all out-of-sync elements in the current selection. Subclasses may override.- Returns:
- a sync info filter which selects all out-of-sync resources.
 
- 
getFilteredDiffElementsReturn the selected diff element for which this action is enabled.- Returns:
- the list of selected diff elements for which this action is enabled.
 
- 
selectionChangedSet the selection of this action to the given selection- Parameters:
- selection- the selection
 
- 
getConfigurationReturns the configuration showing this action.- Returns:
- the configuration showing this action.
 
- 
saveAllEditorspublic final boolean saveAllEditors(boolean confirm) Save all dirty editors in the workbench that are open on files that may be affected by this operation. Opens a dialog to prompt the user ifconfirmis true. Return true if successful. Return false if the user has canceled the command. Must be called from the UI thread.- Parameters:
- confirm- prompt the user if true
- Returns:
- boolean false if the operation was canceled.
 
 
-