//check if there is any selected text.
//if not then just indent the one line
Node[] n = TopComponent.getRegistry().getActivatedNodes();
if (n.length == 1) {
EditorCookie ec = n[0].getCookie(EditorCookie.class);
if (ec != null) {
JEditorPane[] panes = ec.getOpenedPanes();
if (panes.length > 0) {
if (panes[0].getSelectedText() == null || panes[0].getSelectedText().trim() == "") {
int nLineStart = _ctx.lineStartOffset(panes[0].getCaretPosition());
String codeAbove = doc.getText(java.lang.Math.max(0, nLineStart - PREV_CONTEXT_COUNT),
java.lang.Math.min(nLineStart, PREV_CONTEXT_COUNT));