OSDN Git Service

change whitespace chars
[moreemacs/moreemacs.git] / jp.sourceforge.moreemacs / src / jp / sourceforge / moreemacs / handlers / ConvertWordExecution.java
1 package jp.sourceforge.moreemacs.handlers;
2
3 import org.eclipse.jface.text.BadLocationException;
4
5 public abstract class ConvertWordExecution extends TextEditorExecution {
6
7     @Override
8     public void execute() throws BadLocationException {
9         if(!textEditor.isEditable()) {
10             return;
11         }
12         
13         int current = cursor.offset();
14         int next = ForwardWordExecution.getNextWordPosition(doc, current);
15         String word = doc.get(current, next-current);
16         String  convertedWord = convert(word);
17         doc.replace(current, next-current, convertedWord);
18         cursor.move(current + convertedWord.length());
19     }
20     
21     protected abstract String convert(String word);
22 }