Search in sources :

Example 1 with CachingSimpleNode

use of com.intellij.ui.treeStructure.CachingSimpleNode in project android by JetBrains.

the class IdeSettingsDialogFixture method getProjectSettingsNames.

@NotNull
public List<String> getProjectSettingsNames() {
    List<String> names = Lists.newArrayList();
    JPanel optionsEditor = field("myEditor").ofType(JPanel.class).in(getDialogWrapper()).get();
    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();
    ConfigurableGroup[] groups = field("myGroups").ofType(ConfigurableGroup[].class).in(root).get();
    for (ConfigurableGroup current : groups) {
        Configurable[] configurables = current.getConfigurables();
        for (Configurable configurable : configurables) {
            names.add(configurable.getDisplayName());
        }
    }
    return names;
}
Also used : ConfigurableGroup(com.intellij.openapi.options.ConfigurableGroup) Configurable(com.intellij.openapi.options.Configurable) CachingSimpleNode(com.intellij.ui.treeStructure.CachingSimpleNode) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with CachingSimpleNode

use of com.intellij.ui.treeStructure.CachingSimpleNode in project intellij-community by JetBrains.

the class IdeSettingsDialogFixture method getProjectSettingsNames.

@NotNull
public List<String> getProjectSettingsNames() {
    List<String> names = new ArrayList<>();
    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);
    for (ConfigurableGroup current : groups) {
        Configurable[] configurables = current.getConfigurables();
        for (Configurable configurable : configurables) {
            names.add(configurable.getDisplayName());
        }
    }
    return names;
}
Also used : ConfigurableGroup(com.intellij.openapi.options.ConfigurableGroup) ArrayList(java.util.ArrayList) Configurable(com.intellij.openapi.options.Configurable) CachingSimpleNode(com.intellij.ui.treeStructure.CachingSimpleNode) Assert.assertNotNull(org.junit.Assert.assertNotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with CachingSimpleNode

use of com.intellij.ui.treeStructure.CachingSimpleNode in project intellij-community by JetBrains.

the class SettingsTreeFixture method getValueFromNode.

@Nullable
public static String getValueFromNode(@NotNull JTree jTree, Object treeNode) {
    if (!(treeNode instanceof DefaultMutableTreeNode))
        return null;
    Object userObject = ((DefaultMutableTreeNode) treeNode).getUserObject();
    if (!(userObject instanceof FilteringTreeStructure.FilteringNode))
        return null;
    FilteringTreeStructure.FilteringNode myNode = (FilteringTreeStructure.FilteringNode) userObject;
    Object delegate = myNode.getDelegate();
    if (!(delegate instanceof CachingSimpleNode))
        return null;
    CachingSimpleNode simpleNode = (CachingSimpleNode) delegate;
    return simpleNode.toString();
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) FilteringTreeStructure(com.intellij.ui.treeStructure.filtered.FilteringTreeStructure) CachingSimpleNode(com.intellij.ui.treeStructure.CachingSimpleNode) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

CachingSimpleNode (com.intellij.ui.treeStructure.CachingSimpleNode)3 Configurable (com.intellij.openapi.options.Configurable)2 ConfigurableGroup (com.intellij.openapi.options.ConfigurableGroup)2 NotNull (org.jetbrains.annotations.NotNull)2 FilteringTreeStructure (com.intellij.ui.treeStructure.filtered.FilteringTreeStructure)1 ArrayList (java.util.ArrayList)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 Nullable (org.jetbrains.annotations.Nullable)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1