public void addEntryPoint(RefElement newEntryPoint, boolean isPersistent) { if (!newEntryPoint.isValid()) return; if (newEntryPoint instanceof RefClass) { RefClass refClass = (RefClass) newEntryPoint; if (refClass.isAnonymous()) { // Anonymous class cannot be an entry point. return; } ArrayList<RefMethod> refConstructors = refClass.getConstructors(); if (refConstructors.size() == 1) { addEntryPoint(refConstructors.get(0), isPersistent); return; } else if (refConstructors.size() > 1) { // Many constructors here. Need to ask user which ones are used for (int i = 0; i < refConstructors.size(); i++) { addEntryPoint((RefMethod) ((ArrayList) refConstructors).get(i), isPersistent); } return; } } if (isPersistent) { myTemporaryEntryPoints.add(newEntryPoint); ((RefElementImpl) newEntryPoint).setEntry(true); } else { if (myPersistentEntryPoints.get(newEntryPoint.getExternalName()) == null) { final 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 final EntryPointsManagerImpl entryPointsManager = getInstance(newEntryPoint.getElement().getProject()); if (this != entryPointsManager) { entryPointsManager.addEntryPoint(newEntryPoint, true); } } } } }