void () { if (listModel == null) return; listModel.clear(); VirtualFile[] selection = getSelection(); ImageTagManager tagManager = ImageTagManager.getInstance(thumbnailView.getProject()); List<String> commonTags = null; for (VirtualFile virtualFile : selection) { List<String> tags = tagManager.getTags(virtualFile); if (commonTags == null) { commonTags = new ArrayList<>(tags); } else { commonTags.retainAll(tags); } } if (commonTags != null) { commonTags.forEach(listModel::addElement); } }