/** * Updates the optional window listing likely completion choices. */ private void prepareParamChoicesWindow() { // If this window was set to null, the user pressed Escape to hide it if (paramChoicesWindow!=null) { int offs = getCurrentParameterStartOffset(); if (offs==-1) { paramChoicesWindow.setVisible(false); return; } JTextComponent tc = ac.getTextComponent(); try { Rectangle r = tc.modelToView(offs); Point p = new Point(r.x, r.y); SwingUtilities.convertPointToScreen(p, tc); r.x = p.x; r.y = p.y; paramChoicesWindow.setLocationRelativeTo(r); } catch (BadLocationException ble) { // Should never happen UIManager.getLookAndFeel().provideErrorFeedback(tc); ble.printStackTrace(); } // Toggles visibility, if necessary. paramChoicesWindow.setParameter(lastSelectedParam, paramPrefix); } }