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

The following examples show how to use com.intellij.openapi.util.text.StringUtil#capitalize() . 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: MoveFilesOrDirectoriesViewDescriptor.java    From consulo with Apache License 2.0 6 votes vote down vote up
public MoveFilesOrDirectoriesViewDescriptor(PsiElement[] elementsToMove, PsiDirectory newParent) {
  myElementsToMove = elementsToMove;
  if (elementsToMove.length == 1) {
    myProcessedElementsHeader = StringUtil.capitalize(RefactoringBundle.message("move.single.element.elements.header",
                                                                                UsageViewUtil.getType(elementsToMove[0]),
                                                                                newParent.getVirtualFile().getPresentableUrl()));
    myCodeReferencesText = RefactoringBundle.message("references.in.code.to.0.1",
                                                     UsageViewUtil.getType(elementsToMove[0]), UsageViewUtil.getLongName(elementsToMove[0]));
  }
  else {
    if (elementsToMove[0] instanceof PsiFile) {
      myProcessedElementsHeader =
        StringUtil.capitalize(RefactoringBundle.message("move.files.elements.header", newParent.getVirtualFile().getPresentableUrl()));
    }
    else if (elementsToMove[0] instanceof PsiDirectory){
      myProcessedElementsHeader = StringUtil
        .capitalize(RefactoringBundle.message("move.directories.elements.header", newParent.getVirtualFile().getPresentableUrl()));
    }
    myCodeReferencesText = RefactoringBundle.message("references.found.in.code");
  }
}
 
Example 2
Source File: ModelCondition.java    From intellij-extra-icons-plugin with MIT License 5 votes vote down vote up
public String asReadableString(String delimiter) {
    ArrayList<String> parameters = new ArrayList<>();
    if (hasRegex) {
        parameters.add("regex: " + this.regex);
    }

    if (checkParent) {
        parameters.add("parent(s): " + String.join(delimiter, this.parentNames));
    }

    if (start || eq) {
        String names = String.join(delimiter, this.names);
        if (start) {
            names = "name starts with: " + names;
            if (noDot) {
                names += " and does not contain a dot";
            }
        }
        else {
            names = "name equals: " + names;
        }
        parameters.add(names);
    }

    if (mayEnd || end) {
        String extensions = String.join(delimiter, this.extensions);
        if (mayEnd) {
            extensions = "name may end with: " + extensions;
        }
        else {
            extensions = "name ends with: " + extensions;
        }
        parameters.add(extensions);
    }

    return StringUtil.capitalize(String.join(", ", parameters));
}
 
Example 3
Source File: NameSuggester.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void appendWord(StringBuffer resultingWords, String propertyWord) {
  if (resultingWords.length() > 0) {
    final char lastChar = resultingWords.charAt(resultingWords.length() - 1);
    if (Character.isLetterOrDigit(lastChar)) {
      propertyWord = StringUtil.capitalize(propertyWord);
    }
  }
  resultingWords.append(propertyWord);
}
 
Example 4
Source File: EncodingPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
protected WidgetState getWidgetState(@Nullable VirtualFile file) {
  if (file == null) {
    return WidgetState.HIDDEN;
  }

  Pair<Charset, String> check = EncodingUtil.getCharsetAndTheReasonTooltip(file);
  String failReason = Pair.getSecond(check);
  Charset charset = ObjectUtils.notNull(Pair.getFirst(check), file.getCharset());
  String charsetName = ObjectUtils.notNull(charset.displayName(), "n/a");
  String toolTipText = failReason == null ? "File Encoding: " + charsetName : StringUtil.capitalize(failReason) + ".";
  return new WidgetState(toolTipText, charsetName, failReason == null);
}
 
Example 5
Source File: ModuleExtensionProviderEP.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public String getName() {
  if (StringUtil.isEmpty(name)) {
    ModuleExtensionProviderEP.LOGGER.error("Name is empty for extension '" + key + "'. Capitalized 'key' used as name. Please define 'name' attribute for ep");
    name = StringUtil.capitalize(key);
  }
  return name;
}
 
Example 6
Source File: LocalFileSystemTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void testFileCaseChange() throws Exception {
  if (SystemInfo.isFileSystemCaseSensitive) {
    System.err.println("Ignored: case-insensitive FS required");
    return;
  }

  File top = createTempDirectory(false);
  File file = IoTestUtil.createTestFile(top, "file.txt", "test");
  File intermediate = new File(top, "_intermediate_");

  VirtualFile topDir = myFS.refreshAndFindFileByIoFile(top);
  assertNotNull(topDir);
  VirtualFile sourceFile = myFS.refreshAndFindFileByIoFile(file);
  assertNotNull(sourceFile);

  String newName = StringUtil.capitalize(file.getName());
  FileUtil.rename(file, intermediate);
  FileUtil.rename(intermediate, new File(top, newName));
  topDir.refresh(false, true);
  assertFalse(((VirtualDirectoryImpl)topDir).allChildrenLoaded());
  assertTrue(sourceFile.isValid());
  assertEquals(newName, sourceFile.getName());

  topDir.getChildren();
  newName = newName.toLowerCase(Locale.ENGLISH);
  FileUtil.rename(file, intermediate);
  FileUtil.rename(intermediate, new File(top, newName));
  topDir.refresh(false, true);
  assertTrue(((VirtualDirectoryImpl)topDir).allChildrenLoaded());
  assertTrue(sourceFile.isValid());
  assertEquals(newName, sourceFile.getName());
}
 
Example 7
Source File: FileInEditorProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static String joinWithCommaAndCapitalize(String reformatNotification, String rearrangeNotification) {
  String firstNotificationLine = reformatNotification != null ? reformatNotification : rearrangeNotification;
  if (reformatNotification != null && rearrangeNotification != null) {
    firstNotificationLine += ", " + rearrangeNotification;
  }
  firstNotificationLine = StringUtil.capitalize(firstNotificationLine);
  return firstNotificationLine;
}
 
Example 8
Source File: RenameHandlerRegistry.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static String getHandlerTitle(RenameHandler renameHandler) {
  return renameHandler instanceof TitledHandler ? StringUtil.capitalize(((TitledHandler)renameHandler).getActionTitle().toLowerCase()) : renameHandler.toString();
}
 
Example 9
Source File: IdeUICustomization.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the title of the Project view toolwindow.
 */
public String getProjectViewTitle() {
  return StringUtil.capitalize(getProjectConceptName());
}
 
Example 10
Source File: IdeUICustomization.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the name to be displayed in the UI for the "Project" concept (Rider changes this to "Solution").
 */
public String getProjectDisplayName() {
  return StringUtil.capitalize(getProjectConceptName());
}
 
Example 11
Source File: ColorSettingsUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
private static String toDisplayName(@Nonnull TextAttributesKey attributesKey) {
  return StringUtil.capitalize(attributesKey.getExternalName().toLowerCase().replaceAll("_", " "));
}
 
Example 12
Source File: CommonActionsPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
MyActionButton createButton(final Listener listener, String name, Icon icon) {
  return new MyActionButton(this, listener, name == null ? StringUtil.capitalize(name().toLowerCase()) : name, icon);
}
 
Example 13
Source File: BeanConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
@NonNls
protected String getterName() {
  return "get" + StringUtil.capitalize(myFieldName);
}
 
Example 14
Source File: UsageViewManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static String getProgressTitle(@Nonnull UsageViewPresentation presentation) {
  final String scopeText = presentation.getScopeText();
  String usagesString = StringUtil.capitalize(presentation.getUsagesString());
  return UsageViewBundle.message("progress.searching.for.in", usagesString, scopeText, presentation.getContextText());
}
 
Example 15
Source File: UsageType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public String toString(@Nonnull UsageViewPresentation presentation) {
  String word = presentation.getUsagesWord();
  String usageWord = StringUtil.startsWithChar(myName, '{') ? StringUtil.capitalize(word) : word;
  return BundleBase.format(myName, usageWord);
}
 
Example 16
Source File: LibrariesContainer.java    From consulo with Apache License 2.0 4 votes vote down vote up
public String toString() {
  return StringUtil.capitalize(name().toLowerCase());
}
 
Example 17
Source File: ProjectSystemId.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ProjectSystemId(@Nonnull String id) {
  this(id, StringUtil.capitalize(id.toLowerCase()));
}
 
Example 18
Source File: AbstractSingularHandler.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NotNull
private String createSingularClearMethodName(String fieldName) {
  return "clear" + StringUtil.capitalize(fieldName);
}
 
Example 19
Source File: ToggleEditorModeAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ToggleEditorModeAction(LightToolWindowManager manager, Project project, ToolWindowAnchor anchor) {
  super(StringUtil.capitalize(anchor.toString()), "Pin/unpin tool window to " + anchor + " side UI Designer Editor", null);
  myManager = manager;
  myProject = project;
  myAnchor = anchor;
}
 
Example 20
Source File: AddArgumentFix.java    From litho with Apache License 2.0 4 votes vote down vote up
static String getCapitalizedMethoName(PsiMethodCallExpression methodCall) {
  return StringUtil.capitalize(methodCall.getMethodExpression().getReferenceName());
}