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

The following examples show how to use com.intellij.openapi.util.text.StringUtil#contains() . 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: Unity3dPackageOrderEntry.java    From consulo-unity3d with Apache License 2.0 6 votes vote down vote up
private void addDotNetModulesInsideLibrary(@Nonnull List<VirtualFile> result, @Nullable VirtualFile virtualFile)
{
	if(virtualFile == null)
	{
		return;
	}

	result.add(virtualFile);

	boolean isEditor = StringUtil.contains(myModuleRootLayer.getModule().getName(), "Editor");
	if(virtualFile.isDirectory())
	{
		addChildrenNetModules(virtualFile, result);

		if(isEditor)
		{
			VirtualFile editorDirectory = virtualFile.findChild("Editor");
			if(editorDirectory != null)
			{
				addChildrenNetModules(editorDirectory, result);
			}
		}
	}
}
 
Example 2
Source File: ExtendWordSelectionHandlerBase.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static List<TextRange> expandToWholeLine(CharSequence text, @Nullable TextRange range, boolean isSymmetric) {
  List<TextRange> result = new ArrayList<TextRange>();

  if (range == null) {
    return result;
  }

  LOG.assertTrue(range.getEndOffset() <= text.length());
  if (!StringUtil.contains(text, range.getStartOffset(), range.getEndOffset(), '\n')) {
    result.add(range);
  }

  TextRange expanded = getExpandedRange(text, range, isSymmetric);
  if (expanded != null) {
    result.add(expanded);
  } else {
    result.add(range);
  }
  return result;
}
 
Example 3
Source File: TypoTolerantMatcher.java    From consulo with Apache License 2.0 5 votes vote down vote up
private int findNextPatternCharOccurrence(int startAt, int patternIndex, boolean allowSpecialChars, boolean wordStartsOnly, @Nonnull ErrorState errorState) {
  int next = wordStartsOnly ? indexOfWordStart(patternIndex, startAt, errorState) : indexOfIgnoreCase(startAt + 1, patternIndex, errorState);

  // pattern humps are allowed to match in words separated by " ()", lowercase characters aren't
  if (!allowSpecialChars && !myHasSeparators && !myHasHumps && StringUtil.containsAnyChar(myName, myHardSeparators, startAt, next)) {
    return -1;
  }
  // if the user has typed a dot, don't skip other dots between humps
  // but one pattern dot may match several name dots
  if (!allowSpecialChars && myHasDots && !isPatternChar(patternIndex - 1, '.', errorState) && StringUtil.contains(myName, startAt, next, '.')) {
    return -1;
  }

  return next;
}
 
Example 4
Source File: MinusculeMatcherImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private int checkForSpecialChars(String name, int start, int end, int patternIndex) {
  if (end < 0) return -1;

  // pattern humps are allowed to match in words separated by " ()", lowercase characters aren't
  if (!myHasSeparators && !myHasHumps && StringUtil.containsAnyChar(name, myHardSeparators, start, end)) {
    return -1;
  }
  // if the user has typed a dot, don't skip other dots between humps
  // but one pattern dot may match several name dots
  if (myHasDots && !isPatternChar(patternIndex - 1, '.') && StringUtil.contains(name, start, end, '.')) {
    return -1;
  }
  return end;
}
 
Example 5
Source File: IdIndex.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static boolean hasIdentifierInFile(@Nonnull PsiFile file, @Nonnull String name) {
  PsiUtilCore.ensureValid(file);
  if (file.getVirtualFile() == null || DumbService.isDumb(file.getProject())) {
    return StringUtil.contains(file.getViewProvider().getContents(), name);
  }

  GlobalSearchScope scope = GlobalSearchScope.fileScope(file);
  return !FileBasedIndex.getInstance().getContainingFiles(NAME, new IdIndexEntry(name, true), scope).isEmpty();
}
 
Example 6
Source File: TargetAddressInfo.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public boolean isScala() {
  return StringUtil.contains("scala", StringUtil.notNullize(getInternalPantsTargetType())) ||
         getGlobs().hasFileExtension("scala");
}
 
Example 7
Source File: TargetAddressInfo.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public boolean isPython() {
  return StringUtil.contains("python", StringUtil.notNullize(getInternalPantsTargetType())) ||
         getGlobs().hasFileExtension("py");
}
 
Example 8
Source File: PantsOutputMessage.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public static boolean containsLevel(@NotNull String line, @NotNull String level) {
  return StringUtil.contains(line, "[" + level + "]") ||
         StringUtil.contains(line, " " + level + ":");
}
 
Example 9
Source File: WildcardFileNameMatcher.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean matches(final CharSequence filename) {
  return StringUtil.contains(filename, myInfix);
}