boolean (LookupImpl lookup) { int start = Math.max(lookup.getLookupStart() - 1, 0); int end = lookup.getEditor().getCaretModel().getOffset(); if (end - start < 3) return false; Document doc = lookup.getEditor().getDocument(); return doc.getTextLength() > start && doc.getCharsSequence().charAt(start) == '&'; }