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

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.NewTreeElementAction
All Implemented Interfaces:
IAction, IMenuCreator

public class NewTreeElementAction
extends Action
implements IMenuCreator

Used in a drop down Menu to display the elements which can be created in the NewsFeedFavoritesTree and NewsFeedWatchesTree components.

Author:
Sebastian Machhausen

Field Summary
 AddCategoryAction actionAddCategory
           The AddCategoryAction to add a new Category
 AddFavoriteAction actionAddFavorite
           The AddFavoriteAction to add a new Favorite
 AddWatchAction actionAddWatch
           The AddWatchAction to add a new Watch
 AddWatchFolderAction actionAddWatchFolder
           The AddWatchFolderAction to add a new WatchFolder
private  MainApplicationWindow mainWindow
           The Feed'n Read main window
private  MenuManager menuMgr
           The MenuManager used by this NewTreeElementAction to create the sub menu
 
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
NewTreeElementAction(MainApplicationWindow mainWindow)
           Creates a new NewTreeElementAction instance.
 
Method Summary
private  void createMenuManager()
           Creates the MenuManager used by this NewTreeElementAction.
private  void createSubActions()
           Creates all sub Actions of this NewTreeElementAction.
 void dispose()
          Disposes the menu returned by getMenu.
 Menu getMenu(Control parent)
          Returns the SWT menu, created as a pop up menu parented by the given control.
 Menu getMenu(Menu parent)
          Returns an SWT menu created as a drop down menu parented by the given menu.
 void run()
           Executes the action: Executes the AddCategoryAction by default
 
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


menuMgr

private MenuManager menuMgr

The MenuManager used by this NewTreeElementAction to create the sub menu


actionAddCategory

public AddCategoryAction actionAddCategory

The AddCategoryAction to add a new Category


actionAddFavorite

public AddFavoriteAction actionAddFavorite

The AddFavoriteAction to add a new Favorite


actionAddWatchFolder

public AddWatchFolderAction actionAddWatchFolder

The AddWatchFolderAction to add a new WatchFolder


actionAddWatch

public AddWatchAction actionAddWatch

The AddWatchAction to add a new Watch

Constructor Detail

NewTreeElementAction

public NewTreeElementAction(MainApplicationWindow mainWindow)

Creates a new NewTreeElementAction instance. This Action acts as container for all sub actions defined to create a new ITreeElement. It shows a drop down menu from which a sub Action may be activated.

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

run

public void run()

Executes the action:

Specified by:
run in interface IAction

dispose

public void dispose()
Disposes the menu returned by getMenu. Does nothing if there is no menu. This method will be executed only when the parent of the menu is disposed.

Specified by:
dispose in interface IMenuCreator

getMenu

public Menu getMenu(Control parent)
Returns the SWT menu, created as a pop up menu parented by the given control. In most cases, this menu can be created once, cached and reused when the pop-up/drop-down action occurs. If the menu must be dynamically created (i.e., each time it is popped up or dropped down), the old menu should be disposed of before replacing it with the new menu.

Specified by:
getMenu in interface IMenuCreator
Parameters:
parent - the parent control
Returns:
the menu, or null if the menu could not be created

getMenu

public Menu getMenu(Menu parent)
Returns an SWT menu created as a drop down menu parented by the given menu. In most cases, this menu can be created once, cached and reused when the pop-up/drop-down action occurs. If the menu must be dynamically created (i.e., each time it is popped up or dropped down), the old menu should be disposed of before replacing it with the new menu.

Specified by:
getMenu in interface IMenuCreator
Parameters:
parent - the parent menu
Returns:
the menu, or null if the menu could not be created

createMenuManager

private void createMenuManager()

Creates the MenuManager used by this NewTreeElementAction. All sub Actions are created and added to the MenuManager.


createSubActions

private void createSubActions()

Creates all sub Actions of this NewTreeElementAction.