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

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.EnclosureAction
All Implemented Interfaces:
IAction

public class EnclosureAction
extends Action

This Action downloads an enclosure and optionally starts the associated application of the downloaded file, e.g. the default music player if the enclosure is a podcast.

Author:
Sebastian Machhausen

Field Summary
private static NumberFormat DEFAULT_NUMBER_FORMAT
           The default formatter for numbers
private  SyndEnclosure enclosure
           The enclosure bound to the Action
 
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
EnclosureAction(SyndEnclosure enclosure)
           Creates a new EnclosureAction instance.
 
Method Summary
private  File getCachedEnclosure(File cacheDirectory)
           Gets the cached enclosure form the specified cacheDirectory.
 void run()
           Executes the action: Downloads the enclosure and optionally starts the associated application of the downloaded file, e.g. the default music player if the enclosure is a podcast.
private  void setEnclosureImage(SyndEnclosure enclosure)
           Sets the Image of this EnclosureAction depending on the specified SyndEnclosure.
 
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

DEFAULT_NUMBER_FORMAT

private static final NumberFormat DEFAULT_NUMBER_FORMAT

The default formatter for numbers


enclosure

private SyndEnclosure enclosure

The enclosure bound to the Action

Constructor Detail

EnclosureAction

public EnclosureAction(SyndEnclosure enclosure)

Creates a new EnclosureAction instance. This Action downloads an enclosure and optionally starts the associated application of the downloaded file, e.g. the default music player if the enclosure is a podcast.

Parameters:
enclosure - the SyndEnclosure to display in the EnclosureAction
Method Detail

run

public void run()

Executes the action:


getCachedEnclosure

private File getCachedEnclosure(File cacheDirectory)

Gets the cached enclosure form the specified cacheDirectory. The method returns null if the enclosure has not been cached yet.

Parameters:
cacheDirectory - the directory that cached enclosures are stored in
Returns:
the File holding the cached enclosure or null if the enclosure has not been cached yet

setEnclosureImage

private void setEnclosureImage(SyndEnclosure enclosure)

Sets the Image of this EnclosureAction depending on the specified SyndEnclosure. This method requests the icon of the application associated with the enclosure file. If no file association can be found the default enclosure Image is set instead.

Parameters:
enclosure - the SyndEnclosure to set the Image for