當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。