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

The following examples show how to use com.intellij.openapi.util.text.StringUtil#containsIgnoreCase() . 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: GeneratorDialog.java    From idea-gitignore with MIT License 6 votes vote down vote up
/**
 * Checks if given template is accepted by passed filter.
 *
 * @param template to check
 * @param filter   templates filter
 * @return template is accepted
 */
private boolean isTemplateAccepted(@NotNull Resources.Template template, @NotNull String filter) {
    filter = filter.toLowerCase();

    if (StringUtil.containsIgnoreCase(template.getName(), filter)) {
        return true;
    }

    boolean nameAccepted = true;
    for (String word : Utils.getWords(filter)) {
        if (!StringUtil.containsIgnoreCase(template.getName(), word)) {
            nameAccepted = false;
            break;
        }
    }

    List<Pair<Integer, Integer>> ranges = getFilterRanges(filter, StringUtil.notNullize(template.getContent()));
    return nameAccepted || ranges.size() > 0;
}
 
Example 2
Source File: VcsLogTextFilterImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static boolean matches(@Nonnull VcsLogTextFilter filter, @Nonnull String message) {
  Pattern pattern;
  if (filter instanceof VcsLogTextFilterImpl) {
    pattern = ((VcsLogTextFilterImpl)filter).myPattern;
  }
  else {
    pattern = createPattern(filter.getText(), filter.isRegex(), filter.matchesCase());
  }
  if (pattern != null) return pattern.matcher(message).find();

  if (filter.matchesCase()) return message.contains(filter.getText());
  return StringUtil.containsIgnoreCase(message, filter.getText());
}
 
Example 3
Source File: WebBrowserManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
static boolean checkNameAndPath(@Nonnull String what, @Nonnull WebBrowser browser) {
  if (StringUtil.containsIgnoreCase(browser.getName(), what)) {
    return true;
  }
  String path = browser.getPath();
  if (path != null) {
    int index = path.lastIndexOf('/');
    return index > 0 ? path.indexOf(what, index + 1) != -1 : path.contains(what);
  }
  return false;
}
 
Example 4
Source File: PluginManagerMain.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean isAccepted(final Set<String> search, @Nonnull final String filter, @Nonnull final String description) {
  if (StringUtil.containsIgnoreCase(description, filter)) return true;
  final SearchableOptionsRegistrar optionsRegistrar = SearchableOptionsRegistrar.getInstance();
  final HashSet<String> descriptionSet = new HashSet<>(search);
  descriptionSet.removeAll(optionsRegistrar.getProcessedWords(description));
  if (descriptionSet.isEmpty()) {
    return true;
  }
  return false;
}
 
Example 5
Source File: PantsScalaUtil.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public static boolean isScalaLibraryLib(final String libraryId) {
  return StringUtil.containsIgnoreCase(libraryId, getFullScalaLibId(scalaLibrary));
}
 
Example 6
Source File: UnityProcessDialog.java    From consulo-unity3d with Apache License 2.0 4 votes vote down vote up
@Nullable
public static UnityProcess tryParseIfUnityProcess(ProcessInfo processInfo)
{
	String name = processInfo.getName();

	// Unity 2019.3 linux bug - 2020.1 ok
	if(name.equals("Main"))
	{
		List<String> list = StringUtil.split(processInfo.getCommand(), " ");
		String first = ContainerUtil.getFirstItem(list);
		if(first != null && first.endsWith("/Editor/Unity"))
		{
			return new UnityProcess(processInfo.getPid(), name, "localhost", buildDebuggerPort(processInfo.getPid()));
		}
	}

	if(StringUtil.startsWithIgnoreCase(name, "unity") || StringUtil.containsIgnoreCase(name, "Unity.app"))
	{
		// ignore 'UnityHelper' and 'Unity Helper'
		if(StringUtil.containsIgnoreCase(name, "Unity") && StringUtil.containsIgnoreCase(name, "Helper"))
		{
			return null;
		}

		if(StringUtil.containsIgnoreCase(name, "Unity") && StringUtil.containsIgnoreCase(name, "Hub") || StringUtil.containsIgnoreCase(name, "unityhub"))
		{
			return null;
		}

		if(StringUtil.containsIgnoreCase(name, "Unity") && StringUtil.containsIgnoreCase(name, "CrashHandler"))
		{
			return null;
		}

		// UnityShader - Package Manager - Hub compiler
		if(StringUtil.containsIgnoreCase(name, "UnityShader") || StringUtil.containsIgnoreCase(name, "UnityPackageMan"))
		{
			return null;
		}

		return new UnityProcess(processInfo.getPid(), name, "localhost", buildDebuggerPort(processInfo.getPid()));
	}

	return null;
}
 
Example 7
Source File: GuiForm.java    From MavenHelper with Apache License 2.0 4 votes vote down vote up
private boolean contains(String searchFieldText, String artifactKey) {
	return StringUtils.isBlank(searchFieldText) || StringUtil.containsIgnoreCase(artifactKey, searchFieldText);
}
 
Example 8
Source File: PlainPrefixMatcher.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean prefixMatches(@Nonnull String name) {
  return StringUtil.containsIgnoreCase(name, getPrefix());
}
 
Example 9
Source File: SystemInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isOracleJvm() {
  final String vendor = SystemProperties.getJavaVmVendor();
  return vendor != null && StringUtil.containsIgnoreCase(vendor, "Oracle");
}
 
Example 10
Source File: SystemInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isSunJvm() {
  final String vendor = SystemProperties.getJavaVmVendor();
  return vendor != null && StringUtil.containsIgnoreCase(vendor, "Sun") && StringUtil.containsIgnoreCase(vendor, "Microsystems");
}
 
Example 11
Source File: SystemInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isIbmJvm() {
  final String vendor = SystemProperties.getJavaVmVendor();
  return vendor != null && StringUtil.containsIgnoreCase(vendor, "IBM");
}
 
Example 12
Source File: SystemInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isAppleJvm() {
  final String vendor = SystemProperties.getJavaVmVendor();
  return vendor != null && StringUtil.containsIgnoreCase(vendor, "Apple");
}
 
Example 13
Source File: SystemInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isJetbrainsJvm() {
  final String vendor = SystemProperties.getJavaVendor();
  return vendor != null && StringUtil.containsIgnoreCase(vendor, "jetbrains");
}
 
Example 14
Source File: SystemInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isConsuloJvm() {
  final String vendor = SystemProperties.getJavaVendor();
  return vendor != null && StringUtil.containsIgnoreCase(vendor, "consulo");
}
 
Example 15
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;
}