Java Code Examples for com.intellij.openapi.options.Configurable#getDisplayName()

The following examples show how to use com.intellij.openapi.options.Configurable#getDisplayName() . 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: BaseShowSettingsUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static String createDimensionKey(@Nonnull Configurable configurable) {
  String displayName = configurable.getDisplayName();
  if (displayName == null) {
    displayName = configurable.getClass().getName();
  }
  return '#' + StringUtil.replaceChar(StringUtil.replaceChar(displayName, '\n', '_'), ' ', '_');
}
 
Example 2
Source File: MergedCompositeConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nullable
@Override
public Component createUIComponent() {
  if (myRootComponent == null) {
    Configurable firstConfigurable = children[0];
    if (children.length == 1) {
      myRootComponent = firstConfigurable.createUIComponent();
    }
    else {
      VerticalLayout verticalLayout = VerticalLayout.create();
      for (Configurable configurable : children) {
        Component uiComponent = configurable.createUIComponent();
        if (uiComponent == null) {
          continue;
        }

        String displayName = configurable.getDisplayName();
        if (StringUtil.isEmpty(displayName)) {
          verticalLayout.add(uiComponent);
        }
        else {
          LabeledLayout labeledLayout = LabeledLayout.create(displayName);
          labeledLayout.set(uiComponent);
          verticalLayout.add(labeledLayout);
        }
      }
      myRootComponent = verticalLayout;
    }
  }
  return myRootComponent;
}
 
Example 3
Source File: UnifiedConfigurableComparator.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String getConfigurableDisplayName(final Configurable c) {
  final String name = c.getDisplayName();
  return name != null ? name : "{ Unnamed Page:" + c.getClass().getSimpleName() + " }";
}
 
Example 4
Source File: SingleConfigurableEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static String createTitleString(Configurable configurable) {
  String displayName = configurable.getDisplayName();
  LOG.assertTrue(displayName != null, configurable.getClass().getName());
  return displayName.replaceAll("\n", " ");
}
 
Example 5
Source File: SingleConfigurableEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected static String createDimensionKey(Configurable configurable) {
  String displayName = configurable.getDisplayName();
  displayName = displayName.replaceAll("\n", "_").replaceAll(" ", "_");
  return "#" + displayName;
}
 
Example 6
Source File: WholeWestSingleConfigurableEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static String createTitleString(Configurable configurable) {
  String displayName = configurable.getDisplayName();
  LOG.assertTrue(displayName != null, configurable.getClass().getName());
  return displayName.replaceAll("\n", " ");
}
 
Example 7
Source File: WholeWestSingleConfigurableEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected static String createDimensionKey(Configurable configurable) {
  String displayName = configurable.getDisplayName();
  displayName = displayName.replaceAll("\n", "_").replaceAll(" ", "_");
  return "#" + displayName;
}
 
Example 8
Source File: SearchableOptionsRegistrarImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public ConfigurableHit getConfigurables(Configurable[] allConfigurables, final DocumentEvent.EventType type, Set<Configurable> configurables, String option, Project project) {

  final ConfigurableHit hits = new ConfigurableHit();
  final Set<Configurable> contentHits = hits.getContentHits();

  Set<String> options = getProcessedWordsWithoutStemming(option);
  if (configurables == null) {
    contentHits.addAll(SearchUtil.expandGroup(allConfigurables));
  }
  else {
    contentHits.addAll(configurables);
  }

  String optionToCheck = option.trim().toLowerCase();
  for (Configurable each : contentHits) {
    if (each.getDisplayName() == null) continue;
    final String displayName = each.getDisplayName().toLowerCase();
    final List<String> allWords = StringUtil.getWordsIn(displayName);
    if (displayName.contains(optionToCheck)) {
      hits.getNameFullHits().add(each);
      hits.getNameHits().add(each);
    }
    for (String eachWord : allWords) {
      if (eachWord.startsWith(optionToCheck)) {
        hits.getNameHits().add(each);
        break;
      }
    }

    if (options.isEmpty()) {
      hits.getNameHits().add(each);
      hits.getNameFullHits().add(each);
    }
  }

  final Set<Configurable> currentConfigurables = new HashSet<>(contentHits);
  if (options.isEmpty()) { //operate with substring
    String[] components = REG_EXP.split(optionToCheck);
    if (components.length > 0) {
      Collections.addAll(options, components);
    }
    else {
      options.add(option);
    }
  }
  Set<String> helpIds = null;
  for (String opt : options) {
    final Set<OptionDescription> optionIds = getAcceptableDescriptions(opt);
    if (optionIds == null) {
      contentHits.clear();
      return hits;
    }
    final Set<String> ids = new HashSet<>();
    for (OptionDescription id : optionIds) {
      ids.add(id.getConfigurableId());
    }
    if (helpIds == null) {
      helpIds = ids;
    }
    helpIds.retainAll(ids);
  }
  if (helpIds != null) {
    for (Iterator<Configurable> it = contentHits.iterator(); it.hasNext(); ) {
      Configurable configurable = it.next();
      if (CodeStyleFacade.getInstance(project).isUnsuitableCodeStyleConfigurable(configurable)) {
        it.remove();
        continue;
      }
      if (!(configurable instanceof SearchableConfigurable && helpIds.contains(((SearchableConfigurable)configurable).getId()))) {
        it.remove();
      }
    }
  }
  if (currentConfigurables.equals(contentHits) && !(configurables == null && type == DocumentEvent.EventType.CHANGE)) {
    return getConfigurables(allConfigurables, DocumentEvent.EventType.CHANGE, null, option, project);
  }
  return hits;
}