本文整理汇总了Java中org.eclipse.emf.common.util.URI.isArchive方法的典型用法代码示例。如果您正苦于以下问题:Java URI.isArchive方法的具体用法?Java URI.isArchive怎么用?Java URI.isArchive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.common.util.URI
的用法示例。
在下文中一共展示了URI.isArchive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: loadManifest
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
ProjectDescription loadManifest(URI manifest) {
try {
ProjectDescription result = null;
ResourceSet resourceSet = resourceSetProvider.get(null /* we don't care about the project right now */);
String platformPath = manifest.toPlatformString(true);
if (manifest.isArchive() || platformPath != null) {
if (manifest.isArchive() || workspace.getFile(new Path(platformPath)).exists()) {
Resource resource = resourceSet.getResource(manifest, true);
if (resource != null) {
List<EObject> contents = resource.getContents();
if (contents.isEmpty() || !(contents.get(0) instanceof ProjectDescription)) {
return null;
}
result = (ProjectDescription) contents.get(0);
contents.clear();
}
}
}
return result;
} catch (WrappedException e) {
throw new IllegalStateException("Unexpected manifest URI: " + manifest, e);
}
}
示例3: 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;
}
示例4: getResourceSet
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
protected ResourceSet getResourceSet(URI uriFromStorage) {
if (uriFromStorage.isArchive()) {
Optional<? extends IN4JSSourceContainer> containerOpt = eclipseCore.findN4JSSourceContainer(uriFromStorage);
if (containerOpt.isPresent()) {
IN4JSEclipseProject project = (IN4JSEclipseProject) containerOpt.get().getProject();
return getResourceSetProvider().get(project.getProject());
}
}
return getResourceSetProvider().get(null);
}