@Nullable private IProperty getSelectedProperty() { final Collection<DefaultMutableTreeNode> selectedNode = getSelectedNodes(); if (selectedNode.isEmpty()) { return null; } final ResourceBundleEditorViewElement element = getSelectedElement(ContainerUtil.getFirstItem(selectedNode)); return element instanceof ResourceBundlePropertyStructureViewElement ? ((ResourceBundlePropertyStructureViewElement) element).getProperty() : null; }
public static boolean areTooManyDocumentsInTheQueue(Collection<Document> documents) { if (documents.size() > 100) return true; int totalSize = 0; for (Document document : documents) { totalSize += document.getTextLength(); if (totalSize > 10 * FileUtilRt.MEGABYTE) return true; } return false; }
@Nullable public ResourceBundleEditorViewElement getSelectedElementIfOnlyOne() { final Collection<ResourceBundleEditorViewElement> selectedElements = getSelectedElements(); return selectedElements.size() == 1 ? ContainerUtil.getFirstItem(selectedElements) : null; }