Java Code Examples for com.intellij.openapi.options.Configurable#Composite

The following examples show how to use com.intellij.openapi.options.Configurable#Composite . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptionsTree.java    From consulo with Apache License 2.0 6 votes vote down vote up
private List<ConfigurableNode> buildChildren(final Configurable configurable, SimpleNode parent) {
  if (configurable instanceof Configurable.Composite) {
    final Configurable[] kids = ((Configurable.Composite)configurable).getConfigurables();
    final List<ConfigurableNode> result = new ArrayList<>(kids.length);
    for (Configurable child : kids) {
      if (isInvisibleNode(child)) {
        result.addAll(buildChildren(child, parent));
      }
      result.add(new ConfigurableNode(parent, child));
      myContext.registerKid(configurable, child);
    }

    result.sort(UnifiedConfigurableComparator.INSTANCE);
    return result;
  }
  else {
    return Collections.emptyList();
  }
}
 
Example 2
Source File: OptionsEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void visitRecursive(Configurable[] configurables, Consumer<Configurable> consumer) {
  for (Configurable configurable : configurables) {
    consumer.accept(configurable);

    if (configurable instanceof Configurable.Composite) {
      visitRecursive(((Configurable.Composite)configurable).getConfigurables(), consumer);
    }
  }
}
 
Example 3
Source File: SearchUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void processConfigurables(final Configurable[] configurables,
                                         final HashMap<SearchableConfigurable, TreeSet<OptionDescription>> options) {
  for (Configurable configurable : configurables) {
    if (configurable instanceof SearchableConfigurable) {
      TreeSet<OptionDescription> configurableOptions = new TreeSet<OptionDescription>();

      if (configurable instanceof Configurable.Composite) {
        final Configurable[] children = ((Configurable.Composite)configurable).getConfigurables();
        processConfigurables(children, options);
      }

      //ignore invisible root nodes
      if (configurable instanceof SearchableConfigurable.Parent && !((SearchableConfigurable.Parent)configurable).isVisible()) {
        continue;
      }

      options.put((SearchableConfigurable)configurable, configurableOptions);

      if (configurable instanceof MasterDetails) {
        final MasterDetails md = (MasterDetails)configurable;
        md.initUi();
        _processComponent(configurable, configurableOptions, md.getMaster());
        _processComponent(configurable, configurableOptions, md.getDetails().getComponent());
      }
      else {
        _processComponent(configurable, configurableOptions, configurable.createComponent());
      }
    }
  }
}
 
Example 4
Source File: SearchUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void addChildren(Configurable configurable, List<Configurable> list) {
  if (configurable instanceof Configurable.Composite) {
    final Configurable[] kids = ((Configurable.Composite)configurable).getConfigurables();
    for (Configurable eachKid : kids) {
      list.add(eachKid);
      addChildren(eachKid, list);
    }
  }
}
 
Example 5
Source File: OptionsTree.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isAlwaysLeaf() {
  return !(myConfigurable instanceof Configurable.Composite) || ((Configurable.Composite)myConfigurable).getConfigurables().length == 0;
}