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

The following examples show how to use com.intellij.openapi.util.text.StringUtil#equalsIgnoreCase() . 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: PantsResolverTestBase.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
public void assertSourceRoot(String moduleName, final String path) {
  final DataNode<ModuleData> moduleNode = findModule(moduleName);
  assertModuleExists(moduleName, moduleNode);
  final Collection<DataNode<ContentRootData>> contentRoots = ExternalSystemApiUtil.findAll(moduleNode, ProjectKeys.CONTENT_ROOT);
  assertFalse(String.format("No content root for module %s", moduleName), contentRoots.isEmpty());
  for (DataNode<ContentRootData> contentRoot : contentRoots) {
    final ContentRootData contentRootData = contentRoot.getData();
    for (PantsSourceType type : PantsSourceType.values()) {
      for (ContentRootData.SourceRoot sourceRoot : contentRootData.getPaths(type.toExternalSystemSourceType())) {
        final File expectedFile = new File(new File(""), path);
        if (StringUtil.equalsIgnoreCase(expectedFile.getPath(), sourceRoot.getPath())) {
          return;
        }
      }
    }
  }
  fail(String.format("Source root %s is not found for %s!", path, moduleName));
}
 
Example 2
Source File: RTAttributeDescriptorsProvider.java    From react-templates-plugin with MIT License 5 votes vote down vote up
private static boolean tagMatches(String tagName, String tag) {
    if (StringUtil.isEmpty(tag) || StringUtil.equalsIgnoreCase(tag, "ANY")) {
        return true;
    }
    for (String s : tag.split(",")) {
        if (StringUtil.equalsIgnoreCase(tagName, s.trim())) {
            return true;
        }
    }
    return false;
}
 
Example 3
Source File: RTAttributeDescriptorsProvider.java    From react-templates-plugin with MIT License 5 votes vote down vote up
private static boolean tagMatches(String tagName, String tag) {
    if (StringUtil.isEmpty(tag) || StringUtil.equalsIgnoreCase(tag, "ANY")) {
        return true;
    }
    for (String s : tag.split(",")) {
        if (StringUtil.equalsIgnoreCase(tagName, s.trim())) {
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: SearchTextField.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void addElement(String item) {
  final String newItem = item.trim();
  if (newItem.isEmpty()) {
    return;
  }

  final int length = myFullList.size();
  int index = -1;
  for (int i = 0; i < length; i++) {
    if (StringUtil.equalsIgnoreCase(myFullList.get(i), newItem)) {
      index = i;
      break;
    }
  }
  if (index == 0) {
    // item is already at the top of the list
    return;
  }
  else if (index > 0) {
    // move item to top of the list
    myFullList.remove(index);
  }
  else if (myFullList.size() >= myHistorySize && myFullList.size() > 0) {
    // trim list
    myFullList.remove(myFullList.size() - 1);
  }
  insertElementAt(newItem, 0);
}
 
Example 5
Source File: PropertyTable.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void sortPropertiesAndCreateGroups(List<Property> rootProperties) {
  if (!mySorted && !myShowGroups) return;

  Collections.sort(rootProperties, new Comparator<Property>() {
    @Override
    public int compare(Property o1, Property o2) {
      if (o1.getParent() != null || o2.getParent() != null) {
        if (o1.getParent() == o2) return -1;
        if (o2.getParent() == o1) return 1;
        return 0;
      }

      if (myShowGroups) {
        int result = getGroupComparator().compare(o1.getGroup(), o2.getGroup());
        if (result != 0) return result;
      }
      return mySorted ? getPropertyComparator().compare(o1, o2) : 0;
    }
  });

  if (myShowGroups) {
    for (int i = 0; i < rootProperties.size() - 1; i++) {
      Property prev = i == 0 ? null : rootProperties.get(i - 1);
      Property each = rootProperties.get(i);

      String eachGroup = each.getGroup();
      String prevGroup = prev == null ? null : prev.getGroup();

      if (prevGroup != null || eachGroup != null) {
        if (!StringUtil.equalsIgnoreCase(eachGroup, prevGroup)) {
          rootProperties.add(i, new GroupProperty(each.getGroup()));
          i++;
        }
      }
    }
  }
}
 
Example 6
Source File: UrlImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equalsIgnoreCase(@Nullable Url o) {
  if (this == o) {
    return true;
  }
  if (!(o instanceof UrlImpl)) {
    return false;
  }

  UrlImpl url = (UrlImpl)o;
  return StringUtil.equalsIgnoreCase(scheme, url.scheme) &&
         StringUtil.equalsIgnoreCase(authority, url.authority) &&
         getPath().equalsIgnoreCase(url.getPath()) &&
         StringUtil.equalsIgnoreCase(parameters, url.parameters);
}
 
Example 7
Source File: FormatterTagHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean isFormatterTagAt(@Nonnull CharSequence s, int pos, @Nonnull String tagName) {
  if (!tagName.isEmpty() && tagName.charAt(0) == s.charAt(pos)) {
    int end = pos + tagName.length();
    if (end <= s.length()) {
      return StringUtil.equalsIgnoreCase(s.subSequence(pos, end), tagName);
    }
  }
  return false;
}
 
Example 8
Source File: PantsUtil.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public static boolean isBUILDFileName(@NotNull String name) {
  return StringUtil.equalsIgnoreCase(PantsConstants.BUILD, FileUtil.getNameWithoutExtension(name));
}
 
Example 9
Source File: GotoActionModel.java    From consulo with Apache License 2.0 4 votes vote down vote up
private int getRank(@Nonnull String text) {
  if (StringUtil.equalsIgnoreCase(StringUtil.trimEnd(text, "..."), pattern)) return 3;
  if (StringUtil.startsWithIgnoreCase(text, pattern)) return 2;
  if (StringUtil.containsIgnoreCase(text, pattern)) return 1;
  return 0;
}