Package de.loskutov.anyedit.actions
Class AbstractTextAction
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.core.commands.AbstractHandler
-
- de.loskutov.anyedit.actions.AbstractAction
-
- de.loskutov.anyedit.actions.AbstractTextAction
-
- All Implemented Interfaces:
org.eclipse.core.commands.IHandler
,org.eclipse.core.commands.IHandler2
,org.eclipse.ui.IActionDelegate
,org.eclipse.ui.IEditorActionDelegate
,org.eclipse.ui.IViewActionDelegate
,org.eclipse.ui.IWorkbenchWindowActionDelegate
- Direct Known Subclasses:
AbstractReplaceAction
,AbstractSortAction
,Spaces
public abstract class AbstractTextAction extends AbstractAction
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACTION_ID_CAMEL
static java.lang.String
ACTION_ID_CAMEL_TO_PASCAL
static java.lang.String
ACTION_ID_CAPITALIZE
static java.lang.String
ACTION_ID_CONVERT_SPACES
static java.lang.String
ACTION_ID_CONVERT_TABS
static java.lang.String
ACTION_ID_ENCODE
static java.lang.String
ACTION_ID_TO_LOWER
static java.lang.String
ACTION_ID_TO_UPPER
static java.lang.String
ACTION_ID_UNESCAPE
static java.lang.String
ACTION_ID_UNICODIFY
private boolean
isUsedOnSave
protected TextUtil
textUtil
-
Fields inherited from class de.loskutov.anyedit.actions.AbstractAction
editor
-
-
Constructor Summary
Constructors Constructor Description AbstractTextAction()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
doTextOperation(org.eclipse.jface.text.IDocument doc, java.lang.String actionID, TextReplaceResultSet resultSet)
Should be invoked always after estimateActionRange() to ensure that operaton is possibleprotected abstract TextReplaceResultSet
estimateActionRange(org.eclipse.jface.text.IDocument doc)
protected void
init()
protected static boolean
isSaveDirtyBufferEnabled()
boolean
isUsedOnSave()
void
run(org.eclipse.jface.action.IAction action)
void
setUsedOnSave(boolean isUsedOnSave)
-
Methods inherited from class de.loskutov.anyedit.actions.AbstractAction
createActiveEditorDelegate, dispose, execute, getCombinedPreferences, getEditor, getFile, getViewPart, getWindow, init, init, selectionChanged, setActiveEditor, setEditor, setFile
-
Methods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled, setEnabled
-
-
-
-
Field Detail
-
ACTION_ID_CONVERT_TABS
public static final java.lang.String ACTION_ID_CONVERT_TABS
- See Also:
- Constant Field Values
-
ACTION_ID_CONVERT_SPACES
public static final java.lang.String ACTION_ID_CONVERT_SPACES
- See Also:
- Constant Field Values
-
ACTION_ID_UNESCAPE
public static final java.lang.String ACTION_ID_UNESCAPE
- See Also:
- Constant Field Values
-
ACTION_ID_ENCODE
public static final java.lang.String ACTION_ID_ENCODE
- See Also:
- Constant Field Values
-
ACTION_ID_UNICODIFY
public static final java.lang.String ACTION_ID_UNICODIFY
- See Also:
- Constant Field Values
-
ACTION_ID_TO_UPPER
public static final java.lang.String ACTION_ID_TO_UPPER
- See Also:
- Constant Field Values
-
ACTION_ID_TO_LOWER
public static final java.lang.String ACTION_ID_TO_LOWER
- See Also:
- Constant Field Values
-
ACTION_ID_CAPITALIZE
public static final java.lang.String ACTION_ID_CAPITALIZE
- See Also:
- Constant Field Values
-
ACTION_ID_CAMEL
public static final java.lang.String ACTION_ID_CAMEL
- See Also:
- Constant Field Values
-
ACTION_ID_CAMEL_TO_PASCAL
public static final java.lang.String ACTION_ID_CAMEL_TO_PASCAL
- See Also:
- Constant Field Values
-
textUtil
protected TextUtil textUtil
-
isUsedOnSave
private boolean isUsedOnSave
-
-
Method Detail
-
init
protected final void init()
-
estimateActionRange
protected abstract TextReplaceResultSet estimateActionRange(org.eclipse.jface.text.IDocument doc)
-
run
public final void run(org.eclipse.jface.action.IAction action)
- Specified by:
run
in interfaceorg.eclipse.ui.IActionDelegate
- Overrides:
run
in classAbstractAction
- See Also:
IActionDelegate.run(IAction)
-
doTextOperation
protected abstract void doTextOperation(org.eclipse.jface.text.IDocument doc, java.lang.String actionID, TextReplaceResultSet resultSet) throws org.eclipse.jface.text.BadLocationException
Should be invoked always after estimateActionRange() to ensure that operaton is possible- Parameters:
doc
- cannot be nullactionID
- desired text action idresultSet
- cannot be null- Throws:
org.eclipse.jface.text.BadLocationException
-
isSaveDirtyBufferEnabled
protected static boolean isSaveDirtyBufferEnabled()
-
isUsedOnSave
public boolean isUsedOnSave()
- Returns:
- true, only if this action is intended to be run (chained) always just before "save" operation.
-
setUsedOnSave
public void setUsedOnSave(boolean isUsedOnSave)
- Parameters:
isUsedOnSave
- true, only if this action is intended to be run (chained) always just before "save" operation.
-
-