Package de.loskutov.anyedit.actions
Class AbstractReplaceAction
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.core.commands.AbstractHandler
-
- de.loskutov.anyedit.actions.AbstractAction
-
- de.loskutov.anyedit.actions.AbstractTextAction
-
- de.loskutov.anyedit.actions.AbstractReplaceAction
-
- 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:
Base64UnEncode,ChangeCase,ConvertUnicode,UnEscape
public abstract class AbstractReplaceAction extends AbstractTextAction
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanshouldStopReplacecontains possible error information during replace-
Fields inherited from class de.loskutov.anyedit.actions.AbstractTextAction
ACTION_ID_CAMEL, ACTION_ID_CAMEL_TO_PASCAL, ACTION_ID_CAPITALIZE, ACTION_ID_CONVERT_SPACES, ACTION_ID_CONVERT_TABS, ACTION_ID_ENCODE, ACTION_ID_TO_LOWER, ACTION_ID_TO_UPPER, ACTION_ID_UNESCAPE, ACTION_ID_UNICODIFY, textUtil
-
Fields inherited from class de.loskutov.anyedit.actions.AbstractAction
editor
-
-
Constructor Summary
Constructors Constructor Description AbstractReplaceAction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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 TextReplaceResultSetestimateActionRange(org.eclipse.jface.text.IDocument doc)protected abstract intgetActionKey(java.lang.String actionID)Mapping between String actions and "smarter" custom int's for inernal (in performReplace() method) use only!protected abstract java.lang.StringperformReplace(java.lang.String line, int actionKey)Does custom replace operation.-
Methods inherited from class de.loskutov.anyedit.actions.AbstractTextAction
init, isSaveDirtyBufferEnabled, isUsedOnSave, run, setUsedOnSave
-
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
-
-
-
-
Method Detail
-
estimateActionRange
protected TextReplaceResultSet estimateActionRange(org.eclipse.jface.text.IDocument doc)
- Specified by:
estimateActionRangein classAbstractTextAction
-
doTextOperation
protected void doTextOperation(org.eclipse.jface.text.IDocument doc, java.lang.String actionID, TextReplaceResultSet resultSet) throws org.eclipse.jface.text.BadLocationExceptionDescription copied from class:AbstractTextActionShould be invoked always after estimateActionRange() to ensure that operaton is possible- Specified by:
doTextOperationin classAbstractTextAction- Parameters:
doc- cannot be nullactionID- desired text action idresultSet- cannot be null- Throws:
org.eclipse.jface.text.BadLocationException
-
performReplace
protected abstract java.lang.String performReplace(java.lang.String line, int actionKey)Does custom replace operation.- Parameters:
line- text to "replace"actionKey- any one action key as delivered by getActionKey(String) method- Returns:
- "replace" result or old unchanged string, if replace was not performed
-
getActionKey
protected abstract int getActionKey(java.lang.String actionID)
Mapping between String actions and "smarter" custom int's for inernal (in performReplace() method) use only!- Parameters:
actionID- action id starts with one of AbstractTextAction.ACTION_ID_ constants (it starts with the constant cause we have multiple actions there which are used once for key bindings and once for editor actions).- Returns:
- any one int value for given action
-
-