/** * {@inheritDoc} */ @Override public boolean isAutoActivateOkay(JTextComponent tc) { boolean ok = super.isAutoActivateOkay(tc); // In our constructor, we set up auto-activation of the completion // popup to occur on space chars. This extra check makes it a little // more sane, by only letting space auto-activate completion choices // for property values. if (ok) { RSyntaxDocument doc = (RSyntaxDocument)tc.getDocument(); int dot = tc.getCaretPosition(); try { if (dot>1 && doc.charAt(dot)==' ') { // Caret hasn't advanced (?) ok = doc.charAt(dot-1)==':'; } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } return ok; }