void () { final List<NamedScope> localScopes = new ArrayList<>(); final List<NamedScope> sharedScopes = new ArrayList<>(); for (int i = 0; i < myRoot.getChildCount(); i++) { final MyNode node = (MyNode)myRoot.getChildAt(i); final ScopeConfigurable scopeConfigurable = (ScopeConfigurable)node.getConfigurable(); final NamedScope namedScope = scopeConfigurable.getScope(); if (scopeConfigurable.getHolder() == myLocalScopesManager) { localScopes.add(namedScope); } else { sharedScopes.add(namedScope); } } myLocalScopesManager.setScopes(localScopes.toArray(NamedScope.EMPTY_ARRAY)); mySharedScopesManager.setScopes(sharedScopes.toArray(NamedScope.EMPTY_ARRAY)); }