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


Java IContainer.accept方法代码示例

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


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

示例1: run

import org.eclipse.core.resources.IContainer; //导入方法依赖的package包/类
@Override
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
	startTime = System.currentTimeMillis();
	AbstractTextSearchResult textResult = (AbstractTextSearchResult) getSearchResult();
	textResult.removeAll();

	try {

		IContainer dir = configFile.getParent();
		dir.accept(new AbstractSectionPatternVisitor(section) {

			@Override
			protected void collect(IResourceProxy proxy) {
				Match match = new FileMatch((IFile) proxy.requestResource());
				result.addMatch(match);
			}
		}, IResource.NONE);

		return Status.OK_STATUS;
	} catch (Exception ex) {
		return new Status(IStatus.ERROR, EditorConfigPlugin.PLUGIN_ID, ex.getMessage(), ex);
	}
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:24,代码来源:EditorConfigSearchQuery.java

示例2: getFolderIterator

import org.eclipse.core.resources.IContainer; //导入方法依赖的package包/类
@Override
public UnmodifiableIterator<URI> getFolderIterator(URI folderLocation) {
	final IContainer container;
	if (DIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT == folderLocation.segmentCount()) {
		container = workspace.getProject(folderLocation.lastSegment());
	} else {
		container = workspace.getFolder(new Path(folderLocation.toPlatformString(true)));
	}
	if (container != null && container.exists()) {
		final List<URI> result = Lists.newLinkedList();
		try {
			container.accept(new IResourceVisitor() {
				@Override
				public boolean visit(IResource resource) throws CoreException {
					if (resource.getType() == IResource.FILE) {
						result.add(URI.createPlatformResourceURI(resource.getFullPath().toString(), true));
					}
					return true;
				}
			});
			return Iterators.unmodifiableIterator(result.iterator());
		} catch (CoreException e) {
			return Iterators.unmodifiableIterator(result.iterator());
		}
	}
	return Iterators.emptyIterator();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:EclipseBasedN4JSWorkspace.java

示例3: getFolderIterator

import org.eclipse.core.resources.IContainer; //导入方法依赖的package包/类
@Override
public Iterator<URI> getFolderIterator(URI folderLocation) {
	ensureInitialized();
	final URI findProjectWith = findProjectWith(folderLocation);
	if (null != findProjectWith) {
		final String projectName = findProjectWith.lastSegment();
		final ExternalProject project = getProjectMapping().get(projectName);
		if (null != project) {
			String projectPath = new File(project.getLocationURI()).getAbsolutePath();
			String folderPath = folderLocation.toFileString();
			final IContainer container = projectPath.equals(folderPath) ? project
					: project.getFolder(folderPath.substring(projectPath.length() + 1));
			final Collection<URI> result = Lists.newLinkedList();
			try {
				container.accept(resource -> {
					if (resource instanceof IFile) {
						final String path = new File(resource.getLocationURI()).getAbsolutePath();
						result.add(URI.createFileURI(path));
					}
					return true;
				});
				return unmodifiableIterator(result.iterator());
			} catch (CoreException e) {
				return unmodifiableIterator(result.iterator());
			}
		}
	}

	return emptyIterator();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:31,代码来源:EclipseExternalLibraryWorkspace.java

示例4: countFiles

import org.eclipse.core.resources.IContainer; //导入方法依赖的package包/类
public static int countFiles(IContainer container) throws CoreException {
    int[] count = new int[1];
    container.accept(p -> {
        if (p.getType() == IResource.FILE) {
            ++count[0];
        }
        return true;
    }, 0);
    return count[0];
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:11,代码来源:PgUIDumpLoader.java


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