|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.action.Action
org.eclipse.ui.actions.BaseSelectionListenerAction
org.eclipse.team.ui.synchronize.SynchronizeModelAction
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
.
SyncInfo
,
SyncInfoSet
,
SynchronizeModelOperation
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 | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.eclipse.ui.actions.BaseSelectionListenerAction |
---|
clearCache, getStructuredSelection, runWithEvent, selectionChanged, selectionChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
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 providerMethod Detail |
protected 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
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 selection
true
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
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.