当前位置: 首页>>代码示例>>Java>>正文


Java SearchPattern.R_CASE_SENSITIVE属性代码示例

本文整理汇总了Java中org.eclipse.jdt.core.search.SearchPattern.R_CASE_SENSITIVE属性的典型用法代码示例。如果您正苦于以下问题:Java SearchPattern.R_CASE_SENSITIVE属性的具体用法?Java SearchPattern.R_CASE_SENSITIVE怎么用?Java SearchPattern.R_CASE_SENSITIVE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jdt.core.search.SearchPattern的用法示例。


在下文中一共展示了SearchPattern.R_CASE_SENSITIVE属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findType

/**
 * Find type
 * 
 * @param className
 * @param monitor
 * @return type or <code>null</code>
 */
public IType findType(String className, IProgressMonitor monitor) {
	final IType[] result = { null };
	TypeNameMatchRequestor nameMatchRequestor = new TypeNameMatchRequestor() {
		@Override
		public void acceptTypeNameMatch(TypeNameMatch match) {
			result[0] = match.getType();
		}
	};
	int lastDot = className.lastIndexOf('.');
	char[] packageName = lastDot >= 0 ? className.substring(0, lastDot).toCharArray() : null;
	char[] typeName = (lastDot >= 0 ? className.substring(lastDot + 1) : className).toCharArray();
	SearchEngine engine = new SearchEngine();
	int packageMatchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
	try {
		engine.searchAllTypeNames(packageName, packageMatchRule, typeName, packageMatchRule, IJavaSearchConstants.TYPE,
				SearchEngine.createWorkspaceScope(), nameMatchRequestor,
				IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, monitor);
	} catch (JavaModelException e) {
		EditorUtil.INSTANCE.logError("Was not able to search all type names",e);
	}
	return result[0];
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:29,代码来源:JDTDataAccess.java

示例2: findAllDeclarations

private void findAllDeclarations(IProgressMonitor monitor, WorkingCopyOwner owner) throws CoreException {
	fDeclarations = new ArrayList<>();

	class MethodRequestor extends SearchRequestor {
		@Override
		public void acceptSearchMatch(SearchMatch match) throws CoreException {
			IMethod method = (IMethod) match.getElement();
			boolean isBinary = method.isBinary();
			if (!isBinary) {
				fDeclarations.add(method);
			}
		}
	}

	int limitTo = IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE;
	int matchRule = SearchPattern.R_ERASURE_MATCH | SearchPattern.R_CASE_SENSITIVE;
	SearchPattern pattern = SearchPattern.createPattern(fMethod, limitTo, matchRule);
	MethodRequestor requestor = new MethodRequestor();
	SearchEngine searchEngine = owner != null ? new SearchEngine(owner) : new SearchEngine();

	searchEngine.search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, createSearchScope(), requestor, monitor);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:22,代码来源:RippleMethodFinder.java

示例3: findTypeInfos

private static List<TypeNameMatch> findTypeInfos(String typeName, IType contextType, IProgressMonitor pm) throws JavaModelException {
	IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaProject[]{contextType.getJavaProject()}, true);
	IPackageFragment currPackage= contextType.getPackageFragment();
	ArrayList<TypeNameMatch> collectedInfos= new ArrayList<TypeNameMatch>();
	TypeNameMatchCollector requestor= new TypeNameMatchCollector(collectedInfos);
	int matchMode= SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
	new SearchEngine().searchAllTypeNames(null, matchMode, typeName.toCharArray(), matchMode, IJavaSearchConstants.TYPE, scope, requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, pm);

	List<TypeNameMatch> result= new ArrayList<TypeNameMatch>();
	for (Iterator<TypeNameMatch> iter= collectedInfos.iterator(); iter.hasNext();) {
		TypeNameMatch curr= iter.next();
		IType type= curr.getType();
		if (type != null) {
			boolean visible=true;
			try {
				visible= JavaModelUtil.isVisible(type, currPackage);
			} catch (JavaModelException e) {
				//Assume visibile if not available
			}
			if (visible) {
				result.add(curr);
			}
		}
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:TypeContextChecker.java

示例4: findAllTypes

private TypeNameMatch[] findAllTypes(String simpleTypeName, IJavaSearchScope searchScope, SimpleName nameNode, IProgressMonitor monitor) throws JavaModelException {
	boolean is50OrHigher= JavaModelUtil.is50OrHigher(fCompilationUnit.getJavaProject());

	int typeKinds= SimilarElementsRequestor.ALL_TYPES;
	if (nameNode != null) {
		typeKinds= ASTResolving.getPossibleTypeKinds(nameNode, is50OrHigher);
	}

	ArrayList<TypeNameMatch> typeInfos= new ArrayList<TypeNameMatch>();
	TypeNameMatchCollector requestor= new TypeNameMatchCollector(typeInfos);
	int matchMode= SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
	new SearchEngine().searchAllTypeNames(null, matchMode, simpleTypeName.toCharArray(), matchMode, getSearchForConstant(typeKinds), searchScope, requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, monitor);

	ArrayList<TypeNameMatch> typeRefsFound= new ArrayList<TypeNameMatch>(typeInfos.size());
	for (int i= 0, len= typeInfos.size(); i < len; i++) {
		TypeNameMatch curr= typeInfos.get(i);
		if (curr.getPackageName().length() > 0) { // do not suggest imports from the default package
			if (isOfKind(curr, typeKinds, is50OrHigher) && isVisible(curr)) {
				typeRefsFound.add(curr);
			}
		}
	}
	return typeRefsFound.toArray(new TypeNameMatch[typeRefsFound.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:AddImportsOperation.java

示例5: findAllTypes

private TypeNameMatch[] findAllTypes(
    String simpleTypeName,
    IJavaSearchScope searchScope,
    SimpleName nameNode,
    IProgressMonitor monitor)
    throws JavaModelException {
  boolean is50OrHigher = JavaModelUtil.is50OrHigher(fCompilationUnit.getJavaProject());

  int typeKinds = SimilarElementsRequestor.ALL_TYPES;
  if (nameNode != null) {
    typeKinds = ASTResolving.getPossibleTypeKinds(nameNode, is50OrHigher);
  }

  ArrayList<TypeNameMatch> typeInfos = new ArrayList<TypeNameMatch>();
  TypeNameMatchCollector requestor = new TypeNameMatchCollector(typeInfos);
  int matchMode = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
  new SearchEngine()
      .searchAllTypeNames(
          null,
          matchMode,
          simpleTypeName.toCharArray(),
          matchMode,
          getSearchForConstant(typeKinds),
          searchScope,
          requestor,
          IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
          monitor);

  ArrayList<TypeNameMatch> typeRefsFound = new ArrayList<TypeNameMatch>(typeInfos.size());
  for (int i = 0, len = typeInfos.size(); i < len; i++) {
    TypeNameMatch curr = typeInfos.get(i);
    if (curr.getPackageName().length() > 0) { // do not suggest imports from the default package
      if (isOfKind(curr, typeKinds, is50OrHigher) && isVisible(curr)) {
        typeRefsFound.add(curr);
      }
    }
  }
  return typeRefsFound.toArray(new TypeNameMatch[typeRefsFound.size()]);
}
 
开发者ID:eclipse,项目名称:che,代码行数:39,代码来源:AddImportsOperation.java

示例6: findAllDeclarations

private void findAllDeclarations(IProgressMonitor monitor, WorkingCopyOwner owner)
    throws CoreException {
  fDeclarations = new ArrayList<IMethod>();

  class MethodRequestor extends SearchRequestor {
    @Override
    public void acceptSearchMatch(SearchMatch match) throws CoreException {
      IMethod method = (IMethod) match.getElement();
      boolean isBinary = method.isBinary();
      if (fBinaryRefs != null || !(fExcludeBinaries && isBinary)) {
        fDeclarations.add(method);
      }
      if (isBinary && fBinaryRefs != null) {
        fDeclarationToMatch.put(method, match);
      }
    }
  }

  int limitTo =
      IJavaSearchConstants.DECLARATIONS
          | IJavaSearchConstants.IGNORE_DECLARING_TYPE
          | IJavaSearchConstants.IGNORE_RETURN_TYPE;
  int matchRule = SearchPattern.R_ERASURE_MATCH | SearchPattern.R_CASE_SENSITIVE;
  SearchPattern pattern = SearchPattern.createPattern(fMethod, limitTo, matchRule);
  SearchParticipant[] participants = SearchUtils.getDefaultSearchParticipants();
  IJavaSearchScope scope =
      RefactoringScopeFactory.createRelatedProjectsScope(
          fMethod.getJavaProject(),
          IJavaSearchScope.SOURCES
              | IJavaSearchScope.APPLICATION_LIBRARIES
              | IJavaSearchScope.SYSTEM_LIBRARIES);
  MethodRequestor requestor = new MethodRequestor();
  SearchEngine searchEngine = owner != null ? new SearchEngine(owner) : new SearchEngine();

  searchEngine.search(pattern, participants, scope, requestor, monitor);
}
 
开发者ID:eclipse,项目名称:che,代码行数:36,代码来源:RippleMethodFinder2.java

示例7: findTypeInfos

private static List<TypeNameMatch> findTypeInfos(
    String typeName, IType contextType, IProgressMonitor pm) throws JavaModelException {
  IJavaSearchScope scope =
      SearchEngine.createJavaSearchScope(
          new IJavaProject[] {contextType.getJavaProject()}, true);
  IPackageFragment currPackage = contextType.getPackageFragment();
  ArrayList<TypeNameMatch> collectedInfos = new ArrayList<TypeNameMatch>();
  TypeNameMatchCollector requestor = new TypeNameMatchCollector(collectedInfos);
  int matchMode = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
  new SearchEngine()
      .searchAllTypeNames(
          null,
          matchMode,
          typeName.toCharArray(),
          matchMode,
          IJavaSearchConstants.TYPE,
          scope,
          requestor,
          IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
          pm);

  List<TypeNameMatch> result = new ArrayList<TypeNameMatch>();
  for (Iterator<TypeNameMatch> iter = collectedInfos.iterator(); iter.hasNext(); ) {
    TypeNameMatch curr = iter.next();
    IType type = curr.getType();
    if (type != null) {
      boolean visible = true;
      try {
        visible = JavaModelUtil.isVisible(type, currPackage);
      } catch (JavaModelException e) {
        // Assume visibile if not available
      }
      if (visible) {
        result.add(curr);
      }
    }
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:39,代码来源:TypeContextChecker.java

示例8: getExistingCategories

private List<String> getExistingCategories() {
	if(existingCategories==null) {
		final Set<String> categories = new TreeSet<String>();		
		if(selectedJavaProject!=null) {
			SearchRequestor requestor = new SearchRequestor() {
				@Override
				public void acceptSearchMatch(SearchMatch match) throws CoreException {
					if(match.getElement() instanceof IType) {
						String fqn = ((IType) match.getElement()).getFullyQualifiedName();
						if(!fqn.startsWith("net.sf.jasperreports.functions.standard")) {
							// avoid to propose standard functions categories
							categories.add(fqn);
						}
					}
				}
			};
			IJavaElement[] elements= new IJavaElement[] { selectedJavaProject };
			IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
			int matchRule= SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
			SearchPattern fullAnnotationPattern= SearchPattern.createPattern(
					"net.sf.jasperreports.functions.annotations.FunctionCategory", IJavaSearchConstants.ANNOTATION_TYPE, IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE, matchRule);
			SearchPattern simpleNamePattern= SearchPattern.createPattern(
					"FunctionCategory", IJavaSearchConstants.ANNOTATION_TYPE, IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE, matchRule);
			SearchPattern annotationsPattern= SearchPattern.createOrPattern(fullAnnotationPattern, simpleNamePattern);
			SearchParticipant[] searchParticipants= new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
			try {
				new SearchEngine().search(annotationsPattern, searchParticipants, scope, requestor,new NullProgressMonitor());
			} catch (CoreException e) {
			}
		}
		existingCategories = new ArrayList<String>(categories);
		((NewFunctionsLibraryWizard)getWizard()).setAvailableCategories(existingCategories);
	}
	return existingCategories;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:35,代码来源:FunctionsLibraryInformationPage.java

示例9: findAllDeclarations

private void findAllDeclarations(IProgressMonitor monitor, WorkingCopyOwner owner) throws CoreException {
	fDeclarations= new ArrayList<IMethod>();

	class MethodRequestor extends SearchRequestor {
		@Override
		public void acceptSearchMatch(SearchMatch match) throws CoreException {
			IMethod method= (IMethod) match.getElement();
			boolean isBinary= method.isBinary();
			if (fBinaryRefs != null || ! (fExcludeBinaries && isBinary)) {
				fDeclarations.add(method);
			}
			if (isBinary && fBinaryRefs != null) {
				fDeclarationToMatch.put(method, match);
			}
		}
	}

	int limitTo = IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE;
	int matchRule= SearchPattern.R_ERASURE_MATCH | SearchPattern.R_CASE_SENSITIVE;
	SearchPattern pattern= SearchPattern.createPattern(fMethod, limitTo, matchRule);
	SearchParticipant[] participants= SearchUtils.getDefaultSearchParticipants();
	IJavaSearchScope scope= RefactoringScopeFactory.createRelatedProjectsScope(fMethod.getJavaProject(), IJavaSearchScope.SOURCES | IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SYSTEM_LIBRARIES);
	MethodRequestor requestor= new MethodRequestor();
	SearchEngine searchEngine= owner != null ? new SearchEngine(owner) : new SearchEngine();

	searchEngine.search(pattern, participants, scope, requestor, monitor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:RippleMethodFinder2.java

示例10: getFixImportProposals

@Override
public ClasspathFixProposal[] getFixImportProposals(final IJavaProject project, String name) throws CoreException
{
	IProject requestedProject = project.getProject();
	if( !requestedProject.hasNature(JPFProjectNature.NATURE_ID) )
	{
		return null;
	}
	ArrayList<ClasspathFixProposal> props = new ArrayList<ClasspathFixProposal>();

	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	int idx = name.lastIndexOf('.');
	char[] packageName = idx != -1 ? name.substring(0, idx).toCharArray() : null;
	char[] typeName = name.substring(idx + 1).toCharArray();

	if( typeName.length == 1 && typeName[0] == '*' )
	{
		typeName = null;
	}

	ArrayList<TypeNameMatch> res = new ArrayList<TypeNameMatch>();
	TypeNameMatchCollector requestor = new TypeNameMatchCollector(res);

	IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
	int matchMode = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
	new SearchEngine().searchAllTypeNames(packageName, matchMode, typeName, matchMode, IJavaSearchConstants.TYPE,
		scope, requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);

	if( res.isEmpty() )
	{
		return null;
	}
	JPFPluginModelManager service = JPFPluginModelManager.instance();
	for( TypeNameMatch curr : res )
	{
		IType type = curr.getType();
		if( type != null )
		{
			IPackageFragmentRoot root = (IPackageFragmentRoot) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
			IPluginModel model = null;
			if( root.isArchive() )
			{
				model = service.findModel((IFile) root.getResource());
			}
			else if( !root.isExternal() )
			{
				model = service.findModel(root.getResource().getProject());
			}
			if( model != null )
			{
				System.err.println("Found in " + model.getParsedManifest().getId());
				props.add(new JPFClasspathFixProposal(project, JPFProject.getManifest(requestedProject), model));
			}
		}
	}
	return props.toArray(new ClasspathFixProposal[props.size()]);
}
 
开发者ID:equella,项目名称:Equella,代码行数:57,代码来源:JPFClasspathFixProcessor.java

示例11: findClassesInContainer

private List<String> findClassesInContainer(
    IJavaElement container, String testMethodAnnotation, String testClassAnnotation) {
  List<String> result = new LinkedList<>();
  IRegion region = getRegion(container);
  try {
    ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
    IType[] allClasses = hierarchy.getAllClasses();

    // search for all types with references to RunWith and Test and all subclasses
    HashSet<IType> candidates = new HashSet<>(allClasses.length);
    SearchRequestor requestor = new AnnotationSearchRequestor(hierarchy, candidates);

    IJavaSearchScope scope =
        SearchEngine.createJavaSearchScope(allClasses, IJavaSearchScope.SOURCES);
    int matchRule = SearchPattern.R_CASE_SENSITIVE;

    SearchPattern testPattern =
        SearchPattern.createPattern(
            testMethodAnnotation,
            IJavaSearchConstants.ANNOTATION_TYPE,
            IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE,
            matchRule);

    SearchPattern runWithPattern =
        isNullOrEmpty(testClassAnnotation)
            ? testPattern
            : SearchPattern.createPattern(
                testClassAnnotation,
                IJavaSearchConstants.ANNOTATION_TYPE,
                IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE,
                matchRule);

    SearchPattern annotationsPattern = SearchPattern.createOrPattern(runWithPattern, testPattern);
    SearchParticipant[] searchParticipants =
        new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()};
    new SearchEngine().search(annotationsPattern, searchParticipants, scope, requestor, null);

    // find all classes in the region
    for (IType candidate : candidates) {
      if (isAccessibleClass(candidate)
          && !Flags.isAbstract(candidate.getFlags())
          && region.contains(candidate)) {
        result.add(candidate.getFullyQualifiedName());
      }
    }
  } catch (CoreException e) {

    LOG.info("Can't build project hierarchy.", e);
  }

  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:52,代码来源:JavaTestFinder.java


注:本文中的org.eclipse.jdt.core.search.SearchPattern.R_CASE_SENSITIVE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。