void (@NotNull final AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setEnabled(false); Pair<PackageDependenciesNode, PackageDependenciesNode> pair = e.getUpdateSession() .compute(this, "getSelectedNodes", ActionUpdateThread.EDT, () -> Pair.pair(myLeftTree.getSelectedNode(), myRightTree.getSelectedNode())); if (pair.first != null && pair.second != null) { final PatternDialectProvider provider = PatternDialectProvider.getInstance(mySettings.SCOPE_TYPE); assert provider != null; presentation.setEnabled((provider.createPackageSet(pair.first, true) != null || provider.createPackageSet(pair.first, false) != null) && (provider.createPackageSet(pair.second, true) != null || provider.createPackageSet(pair.second, false) != null)); } }