ComponentPopupBuilder (Project project, JComponent component, JComponent preferableFocusComponent, @Nullable Runnable cancelCallback, @Nullable String dimensionKey) { ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(component, preferableFocusComponent); builder.setResizable(true) .setMovable(true) .setRequestFocus(true); if (dimensionKey != null) { builder.setDimensionServiceKey(project, dimensionKey, false); } if (cancelCallback != null) { builder.setCancelCallback(() -> { cancelCallback.run(); return true; }); } return builder; }