Package org.eclipse.team.ui.synchronize
Class ModelParticipantAction
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.ModelParticipantAction
- All Implemented Interfaces:
- IAction,- ISelectionChangedListener
Model provider actions for use with a 
ModelSynchronizeParticipant.- Since:
- 3.2
- 
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 SummaryConstructorsConstructorDescriptionModelParticipantAction(String text, ISynchronizePageConfiguration configuration) Create the model participant action.
- 
Method SummaryModifier and TypeMethodDescriptionprotected SaveableComparisonReturn the currently active saveable.protected ISynchronizePageConfigurationReturn the page configuration.protected ISynchronizationContextReturn the synchronization context associated with this action.protected SaveableComparisonReturn the saveable that is the target of this operation.protected voidCheck to see if the target saveable differs from the currently active saveable.static voidhandleTargetSaveableChange(Shell shell, SaveableComparison targetSaveable, SaveableComparison activeSaveable, boolean allowCancel, IProgressMonitor monitor) Convenience method that prompts if the currently active saveable is dirty and either saves or reverts the saveable depending on the users input.protected abstract booleanisEnabledForSelection(IStructuredSelection selection) Return whether the action is enabled for the given selectionprotected booleanReturn whether the given node is visible in the page based on the mode in the configuration.static booleanpromptToSaveChanges(Shell shell, SaveableComparison saveable, boolean allowCancel) Convenience method that prompts to save changes in the given dirty model.voidselectionChanged(ISelection selection) Set the selection of this action to the given selectionprotected voidsetActiveSaveable(SaveableComparison saveable) Set the active saveable.voidMethod called when the action is about to be shown in a context menu.protected 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, run, 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- 
ModelParticipantActionCreate the model participant action.- Parameters:
- text- the label of the action or- null
- configuration- the configuration for the page that is surfacing the action
 
 
- 
- 
Method Details- 
getConfigurationReturn the page configuration.- Returns:
- the page configuration
 
- 
selectionChangedSet the selection of this action to the given selection- Parameters:
- selection- the selection
 
- 
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
 
- 
isEnabledForSelectionReturn whether the action is enabled for the given selection- Parameters:
- selection- the selection
- Returns:
- whether the action is enabled for the given selection
 
- 
getSynchronizationContextReturn the synchronization context associated with this action.- Returns:
- the synchronization context associated with this action
 
- 
isVisibleReturn whether the given node is visible in the page based on the mode in the configuration.- Parameters:
- node- a diff node
- Returns:
- whether the given node is visible in the page
 
- 
handleTargetSaveableChangeCheck to see if the target saveable differs from the currently active saveable. If it does, prompt to save changes in the active saveable if it is dirty.- Throws:
- InterruptedException- if operation is interrupted
- InvocationTargetException- if an error occurs
 
- 
handleTargetSaveableChangepublic static void handleTargetSaveableChange(Shell shell, SaveableComparison targetSaveable, SaveableComparison activeSaveable, boolean allowCancel, IProgressMonitor monitor) throws CoreException, InterruptedException Convenience method that prompts if the currently active saveable is dirty and either saves or reverts the saveable depending on the users input.- Parameters:
- shell- a parent shell
- targetSaveable- the new saveable
- activeSaveable- the current saveable
- allowCancel- whether canceling the action is an option
- monitor- a progress monitor
- Throws:
- CoreException- if an error occurs
- InterruptedException- if operation is interrupted
 
- 
promptToSaveChangespublic static boolean promptToSaveChanges(Shell shell, SaveableComparison saveable, boolean allowCancel) throws InterruptedException Convenience method that prompts to save changes in the given dirty model.- Parameters:
- shell- a shell
- saveable- a dirty saveable model
- allowCancel- whether canceling the action is an option
- Returns:
- whether the user choose to save (true) or revert (false() the model
- Throws:
- InterruptedException- thrown if the user choose to cancel
 
- 
getActiveSaveableReturn the currently active saveable. By default, the active saveable is obtained from the synchronization page configuration.- Returns:
- the currently active saveable (or nullif no buffer is active).
 
- 
setActiveSaveableSet the active saveable. By default to active saveable is stored with the synchronize page configuration.- Parameters:
- saveable- the saveable that is now active (or- nullif no saveable is active).
 
- 
getTargetSaveableReturn the saveable that is the target of this operation. By default,nullis returned.- Returns:
- the saveable that is the target of this operation
 
- 
updateEnablementpublic void updateEnablement()Method called when the action is about to be shown in a context menu. This method recalculates the enablement for the current selection and uses that to set the enablement.
 
-