public static boolean isSameGroup(final GuiEditor editor, final ArrayList<RadComponent> selectedComponents) { final RadRootContainer rootContainer = editor.getRootContainer(); IButtonGroup group = FormEditingUtil.findGroupForComponent(rootContainer, selectedComponents.get(0)); if (group == null) { return false; } for(int i=1; i<selectedComponents.size(); i++) { if (FormEditingUtil.findGroupForComponent(rootContainer, selectedComponents.get(i)) != group) { return false; } } return true; }
public void setButtonGroups(final IButtonGroup[] buttonGroups) { myButtonGroups.clear(); for(IButtonGroup lwGroup: buttonGroups) { final String[] componentIds = lwGroup.getComponentIds(); if (componentIds.length > 0) { RadButtonGroup group = createGroup(lwGroup.getName()); group.setBound(lwGroup.isBound()); group.addComponentIds(componentIds); } } }
@Nullable public static IButtonGroup findGroupForComponent(final IRootContainer radRootContainer, @NotNull final IComponent component) { for(IButtonGroup group : radRootContainer.getButtonGroups()) { for(String id : group.getComponentIds()) { if(component.getId().equals(id)) { return group; } } } return null; }