void (final JBPopup hint, @Nullable final Editor editor, @Nullable DataContext dataContext, Position @NotNull ... relationToExistingPopup) { final LookupEx lookup = LookupManager.getActiveLookup(editor); if (lookup != null && lookup.getCurrentItem() != null && lookup.getComponent().isShowing()) { new PositionAdjuster(lookup.getComponent()).adjust(hint, PopupImplUtil.getPopupSize(hint), relationToExistingPopup); lookup.addLookupListener(new LookupListener() { @Override public void lookupCanceled(@NotNull LookupEvent event) { if (hint.isVisible()) { hint.cancel(); } } }); return; } final PositionAdjuster positionAdjuster = createPositionAdjuster(hint); if (positionAdjuster != null) { positionAdjuster.adjust(hint, PopupImplUtil.getPopupSize(hint), relationToExistingPopup); return; } if (editor != null && editor.getComponent().isShowing() && editor instanceof EditorEx) { dataContext = ((EditorEx)editor).getDataContext(); } if (dataContext != null) { if (hint.canShow()) { hint.showInBestPositionFor(dataContext); } else { hint.setLocation(hint.getBestPositionFor(dataContext)); } } }