Java Code Examples for com.intellij.openapi.util.text.StringUtil#capitalizeWords()

The following examples show how to use com.intellij.openapi.util.text.StringUtil#capitalizeWords() . 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: FileTypeRenderer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
  LayeredIcon layeredIcon = new LayeredIcon(2);
  layeredIcon.setIcon(EMPTY_ICON, 0);
  final Icon icon = TargetAWT.to(type.getIcon());
  if (icon != null) {
    layeredIcon.setIcon(icon, 1, (- icon.getIconWidth() + EMPTY_ICON.getIconWidth())/2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight())/2);
  }

  setIcon(layeredIcon);

  String description = type.getDescription();
  String trimmedDescription = StringUtil.capitalizeWords(description.replaceAll("(?i)\\s*file(?:s)?$", ""), true);
  if (isDuplicated(description)) {
    setText(trimmedDescription + " (" + type.getName() + ")");

  }
  else {
    setText(trimmedDescription);
  }
}
 
Example 2
Source File: RunAnythingUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
static JComponent createTitle(@Nonnull String titleText, @Nonnull Color background) {
  JLabel titleLabel = new JLabel(StringUtil.capitalizeWords(titleText, true));
  titleLabel.setFont(getTitleFont());
  titleLabel.setForeground(UIUtil.getLabelDisabledForeground());

  SeparatorComponent separatorComponent = new SeparatorComponent(titleLabel.getPreferredSize().height / 2, new JBColor(Gray._220, Gray._80), null);

  JPanel panel = new JPanel(new BorderLayout());
  panel.add(titleLabel, BorderLayout.WEST);
  panel.add(separatorComponent, BorderLayout.CENTER);

  panel.setBorder(JBUI.Borders.empty(3));
  titleLabel.setBorder(JBUI.Borders.emptyRight(3));

  panel.setBackground(background);
  return panel;
}
 
Example 3
Source File: UsageViewManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private UsageView doSearchAndShow(@Nonnull final UsageTarget[] searchFor,
                                  @Nonnull final Factory<UsageSearcher> searcherFactory,
                                  @Nonnull final UsageViewPresentation presentation,
                                  @Nonnull final FindUsagesProcessPresentation processPresentation,
                                  @Nullable final UsageViewStateListener listener) {
  final SearchScope searchScopeToWarnOfFallingOutOf = getMaxSearchScopeToWarnOfFallingOutOf(searchFor);
  final AtomicReference<UsageViewImpl> usageViewRef = new AtomicReference<>();
  long start = System.currentTimeMillis();
  Task.Backgroundable task = new Task.Backgroundable(myProject, getProgressTitle(presentation), true, new SearchInBackgroundOption()) {
    @Override
    public void run(@Nonnull final ProgressIndicator indicator) {
      new SearchForUsagesRunnable(UsageViewManagerImpl.this, UsageViewManagerImpl.this.myProject, usageViewRef, presentation, searchFor, searcherFactory, processPresentation,
                                  searchScopeToWarnOfFallingOutOf, listener).run();
    }

    @Nonnull
    @Override
    public NotificationInfo getNotificationInfo() {
      UsageViewImpl usageView = usageViewRef.get();
      int count = usageView == null ? 0 : usageView.getUsagesCount();
      String notification = StringUtil.capitalizeWords(UsageViewBundle.message("usages.n", count), true);
      LOG.debug(notification + " in " + (System.currentTimeMillis() - start) + "ms.");
      return new NotificationInfo("Find Usages", "Find Usages Finished", notification);
    }
  };
  ProgressManager.getInstance().run(task);
  return usageViewRef.get();
}
 
Example 4
Source File: TypePresentationService.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static String getDefaultTypeName(final Class aClass) {
  String simpleName = aClass.getSimpleName();
  final int i = simpleName.indexOf('$');
  if (i >= 0) {
    simpleName = simpleName.substring(i + 1);
  }
  return StringUtil.capitalizeWords(StringUtil.join(NameUtil.nameToWords(simpleName), " "), true);
}
 
Example 5
Source File: SingleInspectionProfilePanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String renderSeverity(HighlightSeverity severity) {
  return StringUtil.capitalizeWords(severity.getName().toLowerCase(), true);
}