1 19 20 package org.netbeans.modules.editor.java; 21 22 import javax.swing.text.BadLocationException ; 23 import org.netbeans.editor.Formatter; 24 25 30 public class JavaFormatterUnitTestCase extends JavaBaseDocumentUnitTestCase { 31 32 public JavaFormatterUnitTestCase(String testMethodName) { 33 super(testMethodName); 34 } 35 36 41 protected void indentNewLine() { 42 Formatter f = getDocument().getFormatter(); 43 int offset = f.indentNewLine(getDocument(), getCaretOffset()); 44 getCaret().setDot(offset); 45 } 46 47 50 protected void reformat() { 51 Formatter f = getDocument().getFormatter(); 52 try { 53 f.reformat(getDocument(), 0, getDocument().getLength()); 54 } catch (BadLocationException e) { 55 e.printStackTrace(getLog()); 56 fail(e.getMessage()); 57 } 58 } 59 60 } 61 | Popular Tags |