public abstract class AbstractCompareMergeAction extends org.eclipse.jface.action.Action implements IDisposableAction, IRepeatableAction, org.eclipse.jface.viewers.ISelectionChangedListener, ICommandManagerChangeListener, INavigationListener, org.eclipse.jface.util.IPropertyChangeListener
run() method. Concrete subclasses
must provide a definition of the doRun() method to gather any
required input and execute a command. As an implementer of the
IRepeatableAction interface, this class implements the
isRepeatable() method to return true if it is
enabled, and implements the repeat() method to run itself.
Subclasses that aren't repeatable or require special repeat behavior must
override the default implementations of these interface methods.
This action handler supports life cycle methods by implementing the
IDisposableAction interface. Therefore, clients need to call
the init() method to initialize the action, and the
dispose() method when the action is no longer needed.IRepeatableAction.WorkIndicatorType| Constructor and Description |
|---|
AbstractCompareMergeAction(org.eclipse.jface.viewers.ISelectionProvider selectionProvider,
ICompareMergeController controller)
Constructs a new AbstractCompareMergeAction
|
| Modifier and Type | Method and Description |
|---|---|
void |
commandManagerChanged(CommandManagerChangeEvent event)
Handles an event indicating that a command manager has changed.
|
void |
dispose()
dispose should be called as soon as the action is no longer needed
|
protected abstract void |
doRun(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Performs the actual work when this action is run.
|
protected ActionManager |
getActionManager()
Retrieves the action manager for this action
|
protected org.eclipse.swt.widgets.Shell |
getActiveShell()
Returns the active shell instance.
|
protected CommandManager |
getCommandManager()
Retrieves the command manager for this action
|
protected ICompareMergeController |
getCompareMergeController()
Returns the compareMergeController
|
java.lang.String |
getLabel()
Retrieves the label for this action.
|
protected org.eclipse.jface.viewers.ISelection |
getSelection()
Retrieves the current selection.
|
protected org.eclipse.jface.viewers.ISelectionProvider |
getSelectionProvider()
Returns the selectionProvider
|
protected org.eclipse.jface.viewers.IStructuredSelection |
getStructuredSelection()
Retrieves the current structured selection.
|
IRepeatableAction.WorkIndicatorType |
getWorkIndicatorType()
Gets type of work indicator (progress monitor, hourglass, or none).
|
protected void |
handle(java.lang.Throwable exception)
Handles the specified exception.
|
void |
init()
The basic implementation registers the listeners
|
protected boolean |
isBrowseEnabled()
Retrieves a Boolean indicating whether the browse mode is enabled
|
protected boolean |
isBrowseListener()
Retrieves a Boolean indicating whether this action is interested in
browse mode status changes
|
protected boolean |
isCommandStackListener()
Retrieves a Boolean indicating whether this action is interested in
commnd stack changed events.
|
boolean |
isDisposed()
Answers whether or not this action has been disposed and has not been
re-initialized.
|
protected boolean |
isNavigationListener()
Retrieves a Boolean indicating whether this action is interested in
navigation events.
|
boolean |
isRepeatable()
Retrieves a Boolean indicating whether this action can be repeated.
|
boolean |
isRunnable()
Retrieves a Boolean indicating whether this action can be run.
|
protected boolean |
isSelectionListener()
Retrieves a Boolean indicating whether this action is interested in
selection events.
|
boolean |
isSetup()
Returns the setup state of this action.
|
void |
navigationOccured(int eventType,
INavigationProvider provider)
Sent when navigation occurs in the difference viewer
|
protected boolean |
needsSetup()
Answers whether or not this action should be setup before it is run.
|
protected void |
openErrorDialog(org.eclipse.core.runtime.IStatus status)
Opens an error dialog for the specified status object.
|
void |
propertyChange(org.eclipse.jface.util.PropertyChangeEvent event)
Notification that a property has changed.
|
abstract void |
refresh()
Refreshes various aspects of this repeatable action, such as its label
and whether or not it is enabled.
|
void |
repeat(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Re-runs this action
|
void |
run()
Runs this action.
|
void |
run(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Runs this action.
|
void |
runWithEvent(org.eclipse.swt.widgets.Event event)
Runs this action, passing the triggering SWT event.
|
void |
selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Notifies this action that the selection has changed.
|
protected void |
setSetup(boolean setup)
Sets the setup state of this action.
|
boolean |
setup()
Sets up the action.
|
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, setToolTipTextaddPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListeneraddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, removePropertyChangeListener, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipTextpublic AbstractCompareMergeAction(org.eclipse.jface.viewers.ISelectionProvider selectionProvider,
ICompareMergeController controller)
selectionProvider - the selection providercontroller - the compare merge controllerpublic void init()
init in interface IDisposableActionIDisposableAction.init()public void dispose()
IDisposableActiondispose in interface IDisposableActionIDisposableAction.dispose()public boolean isDisposed()
IDisposableActionisDisposed in interface IDisposableActiontrue if the action has been disposed,
false otherwise.IDisposableAction.isDisposed()protected final ActionManager getActionManager()
protected final CommandManager getCommandManager()
public final void run()
run in interface org.eclipse.jface.action.IActionrun in class org.eclipse.jface.action.ActionAction.run()public final void run(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
run in interface IRepeatableActionIAction.run(),
IRepeatableAction.run(IProgressMonitor)public final void runWithEvent(org.eclipse.swt.widgets.Event event)
runWithEvent in interface org.eclipse.jface.action.IActionrunWithEvent in class org.eclipse.jface.action.Actionevent - The SWT event which triggered this action being run.IAction.runWithEvent(Event)public final void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
selectionChanged in interface org.eclipse.jface.viewers.ISelectionChangedListenerevent - Event object describing the change.ISelectionChangedListener.selectionChanged(SelectionChangedEvent)public final java.lang.String getLabel()
getLabel in interface IRepeatableActionIRepeatableAction.getLabel()protected final org.eclipse.jface.viewers.ISelection getSelection()
protected final org.eclipse.jface.viewers.IStructuredSelection getStructuredSelection()
public boolean isRepeatable()
isRepeatable in interface IRepeatableActiontrue if this action handler is enabled;
false otherwise.IRepeatableAction.isRepeatable()public final boolean isRunnable()
isRunnable in interface IRepeatableActiontrue if this action is enabled; false
otherwise.IRepeatableAction.isRunnable()protected boolean isSelectionListener()
true if this action handler is interested;
false otherwise.protected boolean isBrowseListener()
true if this action handler is interested;
false otherwise.protected boolean isBrowseEnabled()
true if browse mode is enabled; false
otherwise.protected boolean isNavigationListener()
true if this action handler is interested;
false otherwise.protected boolean isCommandStackListener()
true if this action handler is interested;
false otherwise.public final void repeat(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
repeat in interface IRepeatableActionIRepeatableAction.repeat(IProgressMonitor)protected final void handle(java.lang.Throwable exception)
exception - The exception to be handled.protected final void openErrorDialog(org.eclipse.core.runtime.IStatus status)
status - The status object for which to open an error dialog.protected abstract void doRun(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
throws org.eclipse.core.runtime.CoreException
progressMonitor - the progress monitor for tracking the progress of this action
when it is run.org.eclipse.core.runtime.CoreExceptionpublic IRepeatableAction.WorkIndicatorType getWorkIndicatorType()
IRepeatableActiongetWorkIndicatorType in interface IRepeatableActionIRepeatableAction.getWorkIndicatorType()public void commandManagerChanged(CommandManagerChangeEvent event)
commandManagerChanged in interface ICommandManagerChangeListenerevent - The command manager change event to be handled.ICommandManagerChangeListener.commandManagerChanged(CommandManagerChangeEvent)protected final org.eclipse.swt.widgets.Shell getActiveShell()
protected final ICompareMergeController getCompareMergeController()
protected final org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()
public abstract void refresh()
IRepeatableActionrefresh in interface IRepeatableActionIRepeatableAction.refresh()public void navigationOccured(int eventType,
INavigationProvider provider)
INavigationListenernavigationOccured in interface INavigationListenereventType - the kind of event that happened. Event type is a bit flag.
Event types are defined in the NavigationEventType.provider - the provider of the navigation functionalityINavigationListener.navigationOccured(int,
com.ibm.xtools.comparemerge.ui.provider.INavigationProvider)public boolean setup()
IRepeatableActionIRepeatableAction.run(IProgressMonitor) is called.setup in interface IRepeatableActiontrue if the setup completed successfully,
false otherwise.IRepeatableAction.setup()public boolean isSetup()
true if the action has been setup,
false otherwise.protected void setSetup(boolean setup)
setup - true if the action has been setup,
false otherwise.protected boolean needsSetup()
true if the action has a setup, false
otherwise.public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event)
This method gets called when the observed object fires a property change event.
propertyChange in interface org.eclipse.jface.util.IPropertyChangeListenerevent - the property change event object describing which property
changed and howIPropertyChangeListener.propertyChange(org.eclipse.jface.util.PropertyChangeEvent)