void (@NotNull RefElement newEntryPoint, boolean isPersistent) { if (!newEntryPoint.isValid()) return; if (isPersistent) { if (newEntryPoint instanceof RefClass || newEntryPoint instanceof RefMethod) { RefClass refClass = newEntryPoint instanceof RefMethod ? ((RefMethod)newEntryPoint).getOwnerClass() : (RefClass)newEntryPoint; if (refClass != null && !refClass.isAnonymous()) { ClassPattern classPattern = new ClassPattern(); classPattern.pattern = new SmartRefElementPointerImpl(refClass, true).getFQName(); if (newEntryPoint instanceof RefMethod && !(newEntryPoint instanceof RefImplicitConstructor)) { classPattern.method = getMethodName(newEntryPoint); } getPatterns().add(classPattern); EntryPointsManager entryPointsManager = getInstance(newEntryPoint.getRefManager().getProject()); if (this != entryPointsManager) { entryPointsManager.addEntryPoint(newEntryPoint, true); } return; } } } if (newEntryPoint instanceof RefClass refClass) { if (refClass.isAnonymous()) { // Anonymous class cannot be an entry point. return; } List<RefMethod> refConstructors = refClass.getConstructors(); if (refConstructors.size() == 1) { addEntryPoint(refConstructors.get(0), isPersistent); } else if (refConstructors.size() > 1) { // Many constructors here. Need to ask user which ones are used for (RefMethod refConstructor : refConstructors) { addEntryPoint(refConstructor, isPersistent); } } } if (!isPersistent) { myTemporaryEntryPoints.add(newEntryPoint); ((RefElementImpl)newEntryPoint).setEntry(true); } else { if (myPersistentEntryPoints.get(newEntryPoint.getExternalName()) == null) { SmartRefElementPointerImpl entry = new SmartRefElementPointerImpl(newEntryPoint, true); myPersistentEntryPoints.put(entry.getFQName(), entry); ((RefElementImpl)newEntryPoint).setEntry(true); ((RefElementImpl)newEntryPoint).setPermanentEntry(true); if (entry.isPersistent()) { //do save entry points EntryPointsManager entryPointsManager = getInstance(newEntryPoint.getRefManager().getProject()); if (this != entryPointsManager) { entryPointsManager.addEntryPoint(newEntryPoint, true); } } } } }