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


Java URI.authority方法代码示例

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


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

示例1: getStorages

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public Iterable<Pair<IStorage, IProject>> getStorages(URI uri) {
	if (uri.isArchive()) {
		URIBasedStorage storage = new URIBasedStorage(uri);
		String authority = uri.authority();
		URI archiveFileURI = URI.createURI(authority.substring(0, authority.length() - 1));
		Optional<? extends IN4JSEclipseProject> optionalProject = eclipseCore.findProject(archiveFileURI);
		if (optionalProject.isPresent()) {
			return Collections.singletonList(Tuples.<IStorage, IProject> create(storage, optionalProject.get()
					.getProject()));
		} else {
			return Collections.singletonList(Tuples.create(storage, null));
		}
	} else {
		return Collections.emptyList();
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:NfarStorageMapper.java

示例2: removeStorage

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public boolean removeStorage(ToBeBuilt toBeBuilt, IStorage storage, IProgressMonitor monitor) {
	if (IN4JSArchive.NFAR_FILE_EXTENSION.equals(storage.getFullPath().getFileExtension())
			&& storage instanceof IFile) {
		IProject project = ((IFile) storage).getProject();
		String key = project.getName() + "|" + storage.getFullPath().toPortableString();
		Set<URI> cachedURIs = knownEntries.remove(key);
		if (cachedURIs != null) {
			toBeBuilt.getToBeDeleted().addAll(cachedURIs);
		} else {
			// cache not populated, use the index to find the URIs that shall be removed, e.g.
			// can happen after a restart of Eclipse
			Iterable<IResourceDescription> descriptions = builderState.getAllResourceDescriptions();
			String expectedAuthority = "platform:/resource" + storage.getFullPath() + "!";
			Set<URI> toBeDeleted = toBeBuilt.getToBeDeleted();
			for (IResourceDescription description : descriptions) {
				URI knownURI = description.getURI();
				if (knownURI.isArchive()) {
					String authority = knownURI.authority();
					if (expectedAuthority.equals(authority)) {
						toBeDeleted.add(knownURI);
					}
				}
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:30,代码来源:N4JSToBeBuiltComputer.java


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