net.sf.eclipseexeditor.actions
Class FilterActionDelegate

java.lang.Object
  extended bynet.sf.eclipseexeditor.actions.FilterActionDelegate
All Implemented Interfaces:
IActionDelegate, IEditorActionDelegate
Direct Known Subclasses:
QuoteXMLFilterActionDelegate, UnQuoteXMLFilterActionDelegate

public class FilterActionDelegate
extends Object
implements IEditorActionDelegate

Eclipse action for running a (Unix-like) command filter over the selected text. The filter is an external command which accepts standard input and prints standard output. This action applies a filter (after prompting the user for the filter or pipeline) to the selected text, then replaces that text with the output of the filter. If an exception occurs executing the filter, the selected text is not modified; a dialog displays the exception. This action runs in the standard Eclipse text editor.

Author:
David Biesack David.Biesack@mindspring.com

Constructor Summary
FilterActionDelegate()
          Default Constructor for FilterActionDelegate
 
Method Summary
protected  String filter(IProgressMonitor monitor, String selectedText)
          Prompt for a filter command with a dialog and run a filter on the selected text This command also saves the filter command for use next time this method is invoked.
protected  boolean isFilterable()
           
 void run(IAction action)
           
 void selectionChanged(IAction action, ISelection selection)
           
 void setActiveEditor(IAction action, IEditorPart editor)
          The EditorActionDelegate implementation of this IEditorActionDelegate method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterActionDelegate

public FilterActionDelegate()
Default Constructor for FilterActionDelegate

Method Detail

run

public void run(IAction action)
Specified by:
run in interface IActionDelegate

filter

protected String filter(IProgressMonitor monitor,
                        String selectedText)
                 throws FilterException
Prompt for a filter command with a dialog and run a filter on the selected text This command also saves the filter command for use next time this method is invoked.

Parameters:
selectedText -
Returns:
the result of passing the selected text through a filter. Return null if the user cancels from the dialog or no command is entered.
Throws:
FilterException
See Also:
FilterCommandUI.readFilter(String)

isFilterable

protected boolean isFilterable()

setActiveEditor

public void setActiveEditor(IAction action,
                            IEditorPart editor)
The EditorActionDelegate implementation of this IEditorActionDelegate method. The matching editor has been activated. Notification guarantees that only editors that match the type for which this action has been registered will be tracked.

Specified by:
setActiveEditor in interface IEditorActionDelegate
Parameters:
action - action proxy that represents this delegate in the desktop
editor - the matching editor that has been activated

selectionChanged

public void selectionChanged(IAction action,
                             ISelection selection)
Specified by:
selectionChanged in interface IActionDelegate