Java Code Examples for com.intellij.openapi.options.SearchableConfigurable#Parent

The following examples show how to use com.intellij.openapi.options.SearchableConfigurable#Parent . 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: 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 2
Source File: DebuggerConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public Configurable[] getConfigurables() {
  compute();

  if (myChildren.length == 0 && myRootConfigurable instanceof SearchableConfigurable.Parent) {
    return ((Parent)myRootConfigurable).getConfigurables();
  }
  else {
    return myChildren;
  }
}
 
Example 3
Source File: DebuggerConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void compute() {
  if (myChildren != null) {
    return;
  }

  List<Configurable> configurables = new SmartList<>();
  configurables.add(new DataViewsConfigurable());

  computeMergedConfigurables(configurables);

  configurables.addAll(XDebuggerConfigurableProvider.getConfigurables(DebuggerSettingsCategory.ROOT));

  MergedCompositeConfigurable mergedGeneralConfigurable = computeGeneralConfigurables();
  if (configurables.isEmpty() && mergedGeneralConfigurable == null) {
    myRootConfigurable = null;
    myChildren = EMPTY_CONFIGURABLES;
  }
  else if (configurables.size() == 1) {
    Configurable firstConfigurable = configurables.get(0);
    if (mergedGeneralConfigurable == null) {
      myRootConfigurable = firstConfigurable;
      myChildren = EMPTY_CONFIGURABLES;
    }
    else {
      Configurable[] generalConfigurables = mergedGeneralConfigurable.children;
      Configurable[] mergedArray = new Configurable[generalConfigurables.length + 1];
      System.arraycopy(generalConfigurables, 0, mergedArray, 0, generalConfigurables.length);
      mergedArray[generalConfigurables.length] = firstConfigurable;
      myRootConfigurable = new MergedCompositeConfigurable("", "", mergedArray);
      myChildren = firstConfigurable instanceof SearchableConfigurable.Parent ? ((Parent)firstConfigurable).getConfigurables() : EMPTY_CONFIGURABLES;
    }
  }
  else {
    myChildren = configurables.toArray(new Configurable[configurables.size()]);
    myRootConfigurable = mergedGeneralConfigurable;
  }
}
 
Example 4
Source File: DesktopShowSettingsUtilImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static Configurable containsId(String id2Select, Configurable configurable) {
  if (configurable instanceof SearchableConfigurable && id2Select.equals(((SearchableConfigurable)configurable).getId())) {
    return configurable;
  }
  if (configurable instanceof SearchableConfigurable.Parent) {
    for (Configurable subConfigurable : ((SearchableConfigurable.Parent)configurable).getConfigurables()) {
      final Configurable config = containsId(id2Select, subConfigurable);
      if (config != null) return config;
    }
  }
  return null;
}
 
Example 5
Source File: OptionsEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
private boolean isEmptyParent(Configurable configurable) {
  return configurable instanceof SearchableConfigurable.Parent && !((SearchableConfigurable.Parent)configurable).hasOwnContent();
}
 
Example 6
Source File: OptionsTree.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isInvisibleNode(final Configurable child) {
  return child instanceof SearchableConfigurable.Parent && !((SearchableConfigurable.Parent)child).isVisible();
}