void (@Nullable PsiDirectory defaultSelection, int selectionIndex) { if (myView.getItemsSize() > 0){ myView.clearItems(); } int existingIdx = 0; for(int i = 0; i < myItems.size(); i++){ ItemWrapper itemWrapper = myItems.get(i); PsiDirectory directory = itemWrapper.getDirectory(); String postfixForDirectory = itemWrapper.myPostfix; if (myShowExisting) { if (selectionIndex == i) selectionIndex = -1; if (postfixForDirectory != null && directory != null && directory.getVirtualFile().findFileByRelativePath(StringUtil.trimStart(postfixForDirectory, File.separator)) == null ) { if (isParent(directory, defaultSelection)) { myDefaultSelection = directory; } continue; } } myView.addItem(itemWrapper); if (selectionIndex < 0 && isParent(directory, defaultSelection)) { selectionIndex = existingIdx; } existingIdx++; } buildFragments(); myView.listFilled(); if (myView.getItemsSize() > 0) { if (selectionIndex != -1) { myView.selectItemByIndex(selectionIndex); } else { myView.selectItemByIndex(0); } } else { myView.clearSelection(); } enableButtons(); myView.getComponent().repaint(); }