Package de.loskutov.anyedit.actions
Class ConvertUnicode
- 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
-
- de.loskutov.anyedit.actions.ConvertUnicode
-
- 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
public class ConvertUnicode extends AbstractReplaceAction
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
charset
private static int
KEY_ESCAPE
private static int
KEY_UNESCAPE
private boolean
warnAboutUnsupportedUnicode
-
Fields inherited from class de.loskutov.anyedit.actions.AbstractReplaceAction
shouldStopReplace
-
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 ConvertUnicode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 int
getActionKey(java.lang.String actionID)
Mapping between String actions and "smarter" custom int's for inernal (in performReplace() method) use only!protected java.lang.String
performReplace(java.lang.String line, int actionKey)
Does custom replace operation.private boolean
warnAboutUnsupportedUnicode()
-
Methods inherited from class de.loskutov.anyedit.actions.AbstractReplaceAction
estimateActionRange
-
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
-
-
-
-
Field Detail
-
KEY_UNESCAPE
private static final int KEY_UNESCAPE
- See Also:
- Constant Field Values
-
KEY_ESCAPE
private static final int KEY_ESCAPE
- See Also:
- Constant Field Values
-
warnAboutUnsupportedUnicode
private boolean warnAboutUnsupportedUnicode
-
charset
private java.lang.String charset
-
-
Method Detail
-
doTextOperation
protected void doTextOperation(org.eclipse.jface.text.IDocument doc, java.lang.String actionID, TextReplaceResultSet resultSet) throws org.eclipse.jface.text.BadLocationException
Description copied from class:AbstractTextAction
Should be invoked always after estimateActionRange() to ensure that operaton is possible- Overrides:
doTextOperation
in classAbstractReplaceAction
- Parameters:
doc
- cannot be nullactionID
- desired text action idresultSet
- cannot be null- Throws:
org.eclipse.jface.text.BadLocationException
-
warnAboutUnsupportedUnicode
private boolean warnAboutUnsupportedUnicode()
- Returns:
-
performReplace
protected java.lang.String performReplace(java.lang.String line, int actionKey)
Description copied from class:AbstractReplaceAction
Does custom replace operation.- Specified by:
performReplace
in classAbstractReplaceAction
- 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 int getActionKey(java.lang.String actionID)
Description copied from class:AbstractReplaceAction
Mapping between String actions and "smarter" custom int's for inernal (in performReplace() method) use only!- Specified by:
getActionKey
in classAbstractReplaceAction
- 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
-
-