boolean (final ComponentItem item) { if (item.getClassName().equals(HSpacer.class.getName()) || item.getClassName().equals(VSpacer.class.getName())) { // this is mostly required for IDEA developers, so that developers don't receive prompt to offer ui-designer-impl dependency return true; } try (AccessToken ignore = SlowOperations.knownIssue("IDEA-307701, EA-681545")) { PsiManager manager = PsiManager.getInstance(myEditor.getProject()); final GlobalSearchScope projectScope = GlobalSearchScope.allScope(myEditor.getProject()); final GlobalSearchScope moduleScope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(myEditor.getModule()); final PsiClass componentClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(item.getClassName(), projectScope); if (componentClass != null && JavaPsiFacade.getInstance(manager.getProject()).findClass(item.getClassName(), moduleScope) == null) { final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myEditor.getProject()).getFileIndex(); List<OrderEntry> entries = fileIndex.getOrderEntriesForFile(componentClass.getContainingFile().getVirtualFile()); if (entries.size() > 0) { if (entries.get(0) instanceof ModuleSourceOrderEntry) { if (!checkAddModuleDependency(item, (ModuleSourceOrderEntry)entries.get(0))) return false; } else if (entries.get(0) instanceof LibraryOrderEntry) { if (!checkAddLibraryDependency(item, (LibraryOrderEntry)entries.get(0))) return false; } } } } return true; }