本文整理汇总了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();
}
}
示例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;
}