net.sourceforge.java.feednread.frontend.event.action
Class RemoveTreeElementAction

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.jface.action.AbstractAction
          extended byorg.eclipse.jface.action.Action
              extended bynet.sourceforge.java.feednread.frontend.event.action.RemoveTreeElementAction
All Implemented Interfaces:
IAction

public class RemoveTreeElementAction
extends Action

Action to remove an IMutableTreeElement from the NewsfeedFavoritesTree or NewsFeedWatchesTree component .

Author:
Sebastian Machhausen

Field Summary
private  MainApplicationWindow mainWindow
           The Feed'n Read main window
 
Fields inherited from class org.eclipse.jface.action.Action
 
Fields inherited from class org.eclipse.core.commands.common.EventManager
 
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
RemoveTreeElementAction(MainApplicationWindow mainWindow)
           Creates a new RemoveTreeElementAction instance.
 
Method Summary
private  void cancelScheduler(Category category)
           Cancels the JobManager scheduler for the specified Category, i.e. if an update interval for the specified Category is set the corresponding ScheduledJobs of the Favorites in the Category are canceled.
private  void cancelScheduler(Favorite favorite)
           Cancels the JobManager scheduler for the specified Favorite, i.e. if an update interval for the specified Favorite is set the corresponding ScheduledJob is canceled.
 void run()
           Executes the action: Gets the currently selected component in the SideBar.
 
Methods inherited from class org.eclipse.jface.action.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, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action.IAction
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

mainWindow

private MainApplicationWindow mainWindow

The Feed'n Read main window

Constructor Detail

RemoveTreeElementAction

public RemoveTreeElementAction(MainApplicationWindow mainWindow)

Creates a new RemoveTreeElementAction instance. This Action is being used if the user removes an IMutableTreeElement from the NewsFeedFavoritesTree or NewsFeedWatchesTree component.
This can either be a Category or a Favorite if the NewsFeedFavoritesTree is selected. If the NewsFeedWatchesTree is selected this can be a WatchFolder or a Watch.

Parameters:
mainWindow - the Feed'n Read main window
Method Detail

run

public void run()

Executes the action:

  • Gets the currently selected component in the SideBar. This is either the NewsFeedFavoritesTree or the NewsFeedWatchesTree.
  • Gets the currently selected tree element
  • If the user configured a security check to precede a removal a RemoveTreeElementDialog is displayed which lets the user confirm the removal.
  • If the user disabled the security check or answered yes in a RemoveTreeElementDialog the selected tree element is removed from the NewsFeedFavoritesTree resp. NewsFeedWatchesTree. If the selection points to a Category all sub categories and Favorites contained in this tree element will be removed too. If the selection points to a WatchFolder all sub folders and Watches in this folder will be removed too.


cancelScheduler

private void cancelScheduler(Favorite favorite)

Cancels the JobManager scheduler for the specified Favorite, i.e. if an update interval for the specified Favorite is set the corresponding ScheduledJob is canceled.

Parameters:
favorite - the Favorite to cancel the scheduler for

cancelScheduler

private void cancelScheduler(Category category)

Cancels the JobManager scheduler for the specified Category, i.e. if an update interval for the specified Category is set the corresponding ScheduledJobs of the Favorites in the Category are canceled. This routine works recursively. That means that the potential ScheduledJobs of all Favorites in the specified Category are canceled.

Parameters:
category - the Category to cancel the scheduler for