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.StringACTION_ID_CAMELstatic java.lang.StringACTION_ID_CAMEL_TO_PASCALstatic java.lang.StringACTION_ID_CAPITALIZEstatic java.lang.StringACTION_ID_CONVERT_SPACESstatic java.lang.StringACTION_ID_CONVERT_TABSstatic java.lang.StringACTION_ID_ENCODEstatic java.lang.StringACTION_ID_TO_LOWERstatic java.lang.StringACTION_ID_TO_UPPERstatic java.lang.StringACTION_ID_UNESCAPEstatic java.lang.StringACTION_ID_UNICODIFYprivate booleanisUsedOnSaveprotected TextUtiltextUtil-
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 voiddoTextOperation(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 TextReplaceResultSetestimateActionRange(org.eclipse.jface.text.IDocument doc)protected voidinit()protected static booleanisSaveDirtyBufferEnabled()booleanisUsedOnSave()voidrun(org.eclipse.jface.action.IAction action)voidsetUsedOnSave(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:
runin interfaceorg.eclipse.ui.IActionDelegate- Overrides:
runin 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.BadLocationExceptionShould 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.
-
-