• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WorkingCopyOwner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.core.WorkingCopyOwner的典型用法代码示例。如果您正苦于以下问题:Java WorkingCopyOwner类的具体用法?Java WorkingCopyOwner怎么用?Java WorkingCopyOwner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getCachedHierarchy

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private ITypeHierarchy getCachedHierarchy(IType type, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException {
	IType rep = fUnionFind.find(type);
	if (rep != null) {
		Collection<IType> collection = fRootReps.get(rep);
		for (Iterator<IType> iter = collection.iterator(); iter.hasNext();) {
			IType root = iter.next();
			ITypeHierarchy hierarchy = fRootHierarchies.get(root);
			if (hierarchy == null) {
				hierarchy = root.newTypeHierarchy(owner, new SubProgressMonitor(monitor, 1));
				fRootHierarchies.put(root, hierarchy);
			}
			if (hierarchy.contains(type)) {
				return hierarchy;
			}
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:19,代码来源:RippleMethodFinder.java


示例2: findAllDeclarations

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
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,代码行数:23,代码来源:RippleMethodFinder.java


示例3: initProjectManager

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
@Before
public void initProjectManager() throws CoreException {
	clientRequests.clear();

	logListener = new SimpleLogListener();
	Platform.addLogListener(logListener);
	preferences = new Preferences();
	if (preferenceManager != null) {
		when(preferenceManager.getPreferences()).thenReturn(preferences);
	}
	projectsManager = new ProjectsManager(preferenceManager);

	WorkingCopyOwner.setPrimaryBufferProvider(new WorkingCopyOwner() {
		@Override
		public IBuffer createBuffer(ICompilationUnit workingCopy) {
			ICompilationUnit original= workingCopy.getPrimary();
			IResource resource= original.getResource();
			if (resource instanceof IFile) {
				return new DocumentAdapter(workingCopy, (IFile)resource);
			}
			return DocumentAdapter.Null;
		}
	});
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:25,代码来源:AbstractProjectsManagerBasedTest.java


示例4: getAllRippleMethods

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private IMethod[] getAllRippleMethods(IProgressMonitor pm, WorkingCopyOwner owner)
    throws CoreException {
  IMethod[] rippleMethods = findAllRippleMethods(pm, owner);
  if (fDeclarationToMatch == null) return rippleMethods;

  List<IMethod> rippleMethodsList = new ArrayList<IMethod>(Arrays.asList(rippleMethods));
  for (Iterator<IMethod> iter = rippleMethodsList.iterator(); iter.hasNext(); ) {
    Object match = fDeclarationToMatch.get(iter.next());
    if (match != null) {
      iter.remove();
      fBinaryRefs.add((SearchMatch) match);
    }
  }
  fDeclarationToMatch = null;
  return rippleMethodsList.toArray(new IMethod[rippleMethodsList.size()]);
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:RippleMethodFinder2.java


示例5: getCachedHierarchy

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private ITypeHierarchy getCachedHierarchy(
    IType type, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException {
  IType rep = fUnionFind.find(type);
  if (rep != null) {
    Collection<IType> collection = fRootReps.get(rep);
    for (Iterator<IType> iter = collection.iterator(); iter.hasNext(); ) {
      IType root = iter.next();
      ITypeHierarchy hierarchy = fRootHierarchies.get(root);
      if (hierarchy == null) {
        hierarchy = root.newTypeHierarchy(owner, new SubProgressMonitor(monitor, 1));
        fRootHierarchies.put(root, hierarchy);
      }
      if (hierarchy.contains(type)) return hierarchy;
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:RippleMethodFinder2.java


示例6: parse

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
public CompilationUnit parse(
    ITypeRoot typeRoot,
    WorkingCopyOwner owner,
    boolean resolveBindings,
    boolean statementsRecovery,
    boolean bindingsRecovery,
    IProgressMonitor pm) {
  fParser.setResolveBindings(resolveBindings);
  fParser.setStatementsRecovery(statementsRecovery);
  fParser.setBindingsRecovery(bindingsRecovery);
  fParser.setSource(typeRoot);
  if (owner != null) fParser.setWorkingCopyOwner(owner);
  fParser.setCompilerOptions(getCompilerOptions(typeRoot));
  CompilationUnit result = (CompilationUnit) fParser.createAST(pm);
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:RefactoringASTParser.java


示例7: search

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
public static SearchResultGroup[] search(
    SearchPattern pattern,
    WorkingCopyOwner owner,
    IJavaSearchScope scope,
    CollectingSearchRequestor requestor,
    IProgressMonitor monitor,
    RefactoringStatus status)
    throws JavaModelException {
  return internalSearch(
      owner != null ? new SearchEngine(owner) : new SearchEngine(),
      pattern,
      scope,
      requestor,
      monitor,
      status);
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:RefactoringSearchEngine.java


示例8: getPerWorkingCopyInfo

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
public PerWorkingCopyInfo getPerWorkingCopyInfo(
    CompilationUnit workingCopy,
    boolean create,
    boolean recordUsage,
    IProblemRequestor problemRequestor) {
  synchronized (
      this.perWorkingCopyInfos) { // use the perWorkingCopyInfo collection as its own lock
    WorkingCopyOwner owner = workingCopy.owner;
    Map workingCopyToInfos = (Map) this.perWorkingCopyInfos.get(owner);
    if (workingCopyToInfos == null && create) {
      workingCopyToInfos = new HashMap();
      this.perWorkingCopyInfos.put(owner, workingCopyToInfos);
    }

    PerWorkingCopyInfo info =
        workingCopyToInfos == null
            ? null
            : (PerWorkingCopyInfo) workingCopyToInfos.get(workingCopy);
    if (info == null && create) {
      info = new PerWorkingCopyInfo(workingCopy, problemRequestor);
      workingCopyToInfos.put(workingCopy, info);
    }
    if (info != null && recordUsage) info.useCount++;
    return info;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:JavaModelManager.java


示例9: getCompilationUnit

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private static ICompilationUnit getCompilationUnit(
    char[] fileName, WorkingCopyOwner workingCopyOwner) {
  char[] slashSeparatedFileName = CharOperation.replaceOnCopy(fileName, File.separatorChar, '/');
  int pkgEnd = CharOperation.lastIndexOf('/', slashSeparatedFileName); // pkgEnd is exclusive
  if (pkgEnd == -1) return null;
  IPackageFragment pkg =
      getPackageFragment(slashSeparatedFileName, pkgEnd, -1 /*no jar separator for .java files*/);
  if (pkg == null) return null;
  int start;
  ICompilationUnit cu =
      pkg.getCompilationUnit(
          new String(
              slashSeparatedFileName, start = pkgEnd + 1, slashSeparatedFileName.length - start));
  if (workingCopyOwner != null) {
    ICompilationUnit workingCopy = cu.findWorkingCopy(workingCopyOwner);
    if (workingCopy != null) return workingCopy;
  }
  return cu;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:Util.java


示例10: findPackageFragment

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
public IJavaElement findPackageFragment(String packageName) throws JavaModelException {
  NameLookup lookup =
      newNameLookup((WorkingCopyOwner) null /*no need to look at working copies for pkgs*/);
  IPackageFragment[] pkgFragments = lookup.findPackageFragments(packageName, false);
  if (pkgFragments == null) {
    return null;

  } else {
    // try to return one that is a child of this project
    for (int i = 0, length = pkgFragments.length; i < length; i++) {

      IPackageFragment pkgFragment = pkgFragments[i];
      if (equals(pkgFragment.getParent().getParent())) {
        return pkgFragment;
      }
    }
    // default to the first one
    return pkgFragments[0];
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:JavaProject.java


示例11: getHandleFromMemento

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
@Override
public IJavaElement getHandleFromMemento(
    String token, MementoTokenizer memento, WorkingCopyOwner owner) {
  switch (token.charAt(0)) {
    case JavaElement.JEM_PACKAGEFRAGMENTROOT:
      String rootPath = IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH;
      token = null;
      while (memento.hasMoreTokens()) {
        token = memento.nextToken();
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331821
        if (token == MementoTokenizer.PACKAGEFRAGMENT || token == MementoTokenizer.COUNT) {
          break;
        }
        rootPath += token;
      }
      JavaElement root = (JavaElement) getPackageFragmentRoot(new Path(rootPath));
      if (token != null && token.charAt(0) == JavaElement.JEM_PACKAGEFRAGMENT) {
        return root.getHandleFromMemento(token, memento, owner);
      } else {
        return root.getHandleFromMemento(memento, owner);
      }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:JavaProject.java


示例12: _processUnit

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private void _processUnit(ICompilationUnit cu)
	throws JavaModelException, MalformedTreeException, BadLocationException {

	// Parse the javacode to be able to modify it
	ASTParser parser = ASTParser.newParser(AST.JLS8);
	parser.setSource(cu);

	// Create a copy of the CompilationUnit to work on
	CompilationUnit copyOfUnit = (CompilationUnit)parser.createAST(null);

	MemberComparator comparator = new MemberComparator();

	// This helper method will sort our java code with the given comparator
	TextEdit edits = CompilationUnitSorter.sort(copyOfUnit, comparator, 0, null, null);

	// The sort method gives us null if there weren't any changes
	if (edits != null) {
		ICompilationUnit workingCopy = cu.getWorkingCopy(new WorkingCopyOwner() {}, null);

		workingCopy.applyTextEdit(edits, null);

		// Commit changes
		workingCopy.commitWorkingCopy(true, null);
	}
}
 
开发者ID:Ixenit,项目名称:eclipsemembersort,代码行数:26,代码来源:SortHandler.java


示例13: getImplicitConstructorReferencesInClassCreations

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private List<SearchMatch> getImplicitConstructorReferencesInClassCreations(WorkingCopyOwner owner, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
	//XXX workaround for jdt core bug 23112
	SearchPattern pattern= SearchPattern.createPattern(fType, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
	IJavaSearchScope scope= RefactoringScopeFactory.create(fType);
	SearchResultGroup[] refs= RefactoringSearchEngine.search(pattern, owner, scope, pm, status);
	List<SearchMatch> result= new ArrayList<SearchMatch>();
	for (int i= 0; i < refs.length; i++) {
		SearchResultGroup group= refs[i];
		ICompilationUnit cu= group.getCompilationUnit();
		if (cu == null)
			continue;
		CompilationUnit cuNode= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(cu, false);
		SearchMatch[] results= group.getSearchResults();
		for (int j= 0; j < results.length; j++) {
			SearchMatch searchResult= results[j];
			ASTNode node= ASTNodeSearchUtil.getAstNode(searchResult, cuNode);
			if (isImplicitConstructorReferenceNodeInClassCreations(node))
				result.add(searchResult);
		}
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:ConstructorReferenceFinder.java


示例14: reportBinding

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private void reportBinding(Object key, ASTRequestor astRequestor, WorkingCopyOwner owner, CompilationUnitDeclaration unit) {
	BindingKeyResolver keyResolver = (BindingKeyResolver) key;
	Binding compilerBinding = keyResolver.getCompilerBinding();
	if (compilerBinding != null) {
		DefaultBindingResolver resolver = new DefaultBindingResolver(unit.scope, owner, this.bindingTables, false, this.fromJavaProject);
		AnnotationBinding annotationBinding = keyResolver.getAnnotationBinding();
		IBinding binding;
		if (annotationBinding != null) {
			binding = resolver.getAnnotationInstance(annotationBinding);
		} else {
			binding = resolver.getBinding(compilerBinding);
		}
		if (binding != null)
			astRequestor.acceptBinding(keyResolver.getKey(), binding);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:CompilationUnitResolver.java


示例15: setExtendedData

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
protected void setExtendedData(
		ITypeRoot typeRoot,
		CompilationUnitDeclaration compilationUnitDeclaration,
		LookupEnvironment lookupEnvironment,
		Scope scope,
		ASTNode astNode,
		ASTNode astNodeParent,
		WorkingCopyOwner owner,
		CompletionParser parser) {
	this.isExtended = true;
	this.extendedContext =
		new InternalExtendedCompletionContext(
				this,
				typeRoot,
				compilationUnitDeclaration,
				lookupEnvironment,
				scope,
				astNode,
				astNodeParent,
				owner,
				parser);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:InternalCompletionContext.java


示例16: getAllRippleMethods

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private IMethod[] getAllRippleMethods(IProgressMonitor pm, WorkingCopyOwner owner) throws CoreException {
	IMethod[] rippleMethods= findAllRippleMethods(pm, owner);
	if (fDeclarationToMatch == null)
		return rippleMethods;

	List<IMethod> rippleMethodsList= new ArrayList<IMethod>(Arrays.asList(rippleMethods));
	for (Iterator<IMethod> iter= rippleMethodsList.iterator(); iter.hasNext(); ) {
		Object match= fDeclarationToMatch.get(iter.next());
		if (match != null) {
			iter.remove();
			fBinaryRefs.add((SearchMatch) match);
		}
	}
	fDeclarationToMatch= null;
	return rippleMethodsList.toArray(new IMethod[rippleMethodsList.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:RippleMethodFinder2.java


示例17: getCompilationUnits

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
/**
 * @see IPackageFragment#getCompilationUnits(WorkingCopyOwner)
 */
public ICompilationUnit[] getCompilationUnits(WorkingCopyOwner owner) {
	ICompilationUnit[] workingCopies = JavaModelManager.getJavaModelManager().getWorkingCopies(owner, false/*don't add primary*/);
	if (workingCopies == null) return JavaModelManager.NO_WORKING_COPY;
	int length = workingCopies.length;
	ICompilationUnit[] result = new ICompilationUnit[length];
	int index = 0;
	for (int i = 0; i < length; i++) {
		ICompilationUnit wc = workingCopies[i];
		if (equals(wc.getParent()) && !Util.isExcluded(wc)) { // 59933 - excluded wc shouldn't be answered back
			result[index++] = wc;
		}
	}
	if (index != length) {
		System.arraycopy(result, 0, result = new ICompilationUnit[index], 0, index);
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:PackageFragment.java


示例18: findPackageFragment

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
public IJavaElement findPackageFragment(String packageName)
		throws JavaModelException {
	NameLookup lookup = newNameLookup((WorkingCopyOwner)null/*no need to look at working copies for pkgs*/);
	IPackageFragment[] pkgFragments = lookup.findPackageFragments(packageName, false);
	if (pkgFragments == null) {
		return null;

	} else {
		// try to return one that is a child of this project
		for (int i = 0, length = pkgFragments.length; i < length; i++) {

			IPackageFragment pkgFragment = pkgFragments[i];
			if (equals(pkgFragment.getParent().getParent())) {
				return pkgFragment;
			}
		}
		// default to the first one
		return pkgFragments[0];
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavaProject.java


示例19: newTypeHierarchy

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
/**
 * @see IJavaProject
 */
public ITypeHierarchy newTypeHierarchy(
	IRegion region,
	WorkingCopyOwner owner,
	IProgressMonitor monitor)
	throws JavaModelException {

	if (region == null) {
		throw new IllegalArgumentException(Messages.hierarchy_nullRegion);
	}
	ICompilationUnit[] workingCopies = JavaModelManager.getJavaModelManager().getWorkingCopies(owner, true/*add primary working copies*/);
	CreateTypeHierarchyOperation op =
		new CreateTypeHierarchyOperation(region, workingCopies, null, true);
	op.runOperation(monitor);
	return op.getResult();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:JavaProject.java


示例20: getCachedHierarchy

import org.eclipse.jdt.core.WorkingCopyOwner; //导入依赖的package包/类
private ITypeHierarchy getCachedHierarchy(IType type, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException {
	IType rep= fUnionFind.find(type);
	if (rep != null) {
		Collection<IType> collection= fRootReps.get(rep);
		for (Iterator<IType> iter= collection.iterator(); iter.hasNext();) {
			IType root= iter.next();
			ITypeHierarchy hierarchy= fRootHierarchies.get(root);
			if (hierarchy == null) {
				hierarchy= root.newTypeHierarchy(owner, new SubProgressMonitor(monitor, 1));
				fRootHierarchies.put(root, hierarchy);
			}
			if (hierarchy.contains(type))
				return hierarchy;
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:RippleMethodFinder2.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractTask类代码示例发布时间:2022-05-22
下一篇:
Java Context类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap