private MyNode(CachingSimpleNode parent, Configurable configurable, int level) { super(parent); myComposite = configurable instanceof Configurable.Composite ? (Configurable.Composite)configurable : null; myConfigurable = configurable; String name = configurable.getDisplayName(); myDisplayName = name != null ? name.replace("\n", " ") : "{ " + configurable.getClass().getSimpleName() + " }"; myLevel = level; }
private List<String> getSettingsNames(@NotNull Class<? extends ConfigurableGroup> groupType) { List<String> names = Lists.newArrayList(); JPanel optionsEditor = field("myEditor").ofType(JPanel.class).in(getDialogWrapper()).get(); assertNotNull(optionsEditor); List<JComponent> trees = findComponentsOfType(optionsEditor, "com.intellij.openapi.options.newEditor.SettingsTreeView"); assertThat(trees).hasSize(1); JComponent tree = trees.get(0); CachingSimpleNode root = field("myRoot").ofType(CachingSimpleNode.class).in(tree).get(); assertNotNull(root); ConfigurableGroup[] groups = field("myGroups").ofType(ConfigurableGroup[].class).in(root).get(); assertNotNull(groups); ConfigurableGroup group = null; for (ConfigurableGroup current : groups) { if (groupType.isInstance(current)) { group = current; break; } } assertNotNull(group); for (Configurable configurable : group.getConfigurables()) { names.add(configurable.getDisplayName()); } return names; }