1 33 34 package edu.rice.cs.drjava.model.definitions.indent; 35 36 import javax.swing.text.*; 37 38 import edu.rice.cs.drjava.model.AbstractDJDocument; 39 40 import edu.rice.cs.util.UnexpectedException; 41 42 48 class QuestionCurrLineEmptyOrEnterPress extends IndentRuleQuestion { 49 50 QuestionCurrLineEmptyOrEnterPress(IndentRule yesRule, IndentRule noRule) { super(yesRule, noRule); } 51 52 56 boolean applyRule(AbstractDJDocument doc, int reason) { 57 if (reason == Indenter.ENTER_KEY_PRESS) return true; 58 try { 59 int here = doc.getCurrentLocation(); 61 int endOfLine = doc.getLineEndPos(here); 62 int firstNonWS = doc.getLineFirstCharPos(here); 63 return (endOfLine == firstNonWS); 64 } 65 catch (BadLocationException e) { 66 throw new UnexpectedException(e); 68 } 69 } 70 } 71 | Popular Tags |